Closed yochannah closed 6 years ago
@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) ...
@yochannah Or straightforward option: just use all the filters with disjunction (intersection).
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 :)
Ok, let me know if this approach works: for pathway, GO, etc- anywhere we might want multiple filters, do the following:
lookup
or an =
operator, use ONE OF
- e.g. "where": [{
"path": "Gene.symbol",
"op": "ONE OF",
"values": ["ENA6", "TSPAN6"],
"code": "A"
}]
// 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
@yochannah As I already notified you, this ONE OF approach is perfect :+1:
@yochannah Although it was intended for Milestone 3, it's already done 🥇
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