Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to show multiple filters for the same filter type at once #41

Closed
yochannah opened this issue Jun 18, 2018 · 6 comments

Comments

@yochannah
Copy link
Collaborator

commented Jun 18, 2018

Users may wish to show more than one dataset / GO term / pathway at a time. Can we consider how we might manage adding multiple constraints to filter types?

This should be completed once the other tickets are done; I've labelled it milestone 3 for now

@AdrianBZG

This comment has been minimized.

Copy link
Owner

commented Jun 18, 2018

@yochannah For this one we need a way to query the im-table with a disjunction of conjuctions (intersection of unions), where each set of unions is a different filter -> (A OR B) AND (C OR D) ...

@AdrianBZG

This comment has been minimized.

Copy link
Owner

commented Jun 18, 2018

@yochannah Or straightforward option: just use all the filters with disjunction (intersection).

@yochannah

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 20, 2018

so, it is possible to set OR logic when adding a constraint, but it doesn't always work the way you'd want because it just assigns OR to all of the previous logic - e.g. If I have A and B, I could run

          table.query.addConstraint({
            "path": "goAnnotation.ontologyTerm.namespace",
            "op": "==",
            "value": "biological_process",
            "code" : "C"
          }, "or"); // <-- note the or here

and I'd end up with (A and B) or C - I couldn't set it to A and (B or C) this way. THAT SAID, there might be another way, using ONE OF. I'll put that in the next comment :)

@yochannah

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 20, 2018

Ok, let me know if this approach works: for pathway, GO, etc- anywhere we might want multiple filters, do the following:

  1. rather than using a lookup or an = operator, use ONE OF - e.g.
      "where": [{
        "path": "Gene.symbol",
        "op": "ONE OF",
        "values": ["ENA6", "TSPAN6"],
        "code": "A"
      }]
  1. When it's time to add or remove a filter, simply delete the whole constraint and re-add it:
          // 1. remove the old constraint
          var constraintToRemove = table.query.constraints[0];
          table.query.removeConstraint(constraintToRemove);
          // 2. add a new constraint, with more items appended into the array
          constraintToRemove.values.push("CFH");
          table.query.addConstraint(constraintToRemove);

https://yochannah.github.io/im-tables-examples/constraint-modification.html

@AdrianBZG

This comment has been minimized.

Copy link
Owner

commented Jun 21, 2018

@yochannah As I already notified you, this ONE OF approach is perfect 👍

AdrianBZG added a commit that referenced this issue Jun 24, 2018
AdrianBZG added a commit that referenced this issue Jun 25, 2018
AdrianBZG added a commit that referenced this issue Jun 25, 2018
@AdrianBZG

This comment has been minimized.

Copy link
Owner

commented Jun 25, 2018

@yochannah Although it was intended for Milestone 3, it's already done 🥇

http://im-browser-prototype.herokuapp.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.