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

Support selection from multiple lists #82

Closed
wants to merge 2 commits into from

Conversation

JM-Mendez
Copy link

@JM-Mendez JM-Mendez commented Mar 10, 2020

Description

This PR attempts to resolve #32, which would allow the user to select multiple lists from the Gene/Protein intermine lists.

I've managed to add multiple lists to the query using window.imTable.query.addConstraints which allows me to pass in an array of contraints.

I stepped through the debugger and for the most part it returns a result from the server, until it tries to parse the xml. Then I run into the error below. I truncated the view and constraintLogic so the code fits without scrolling.

"Error: XML is not well formatted. Got 
<query model="genomic" view="Gene.symbol Gene.name..." constraintLogic="(A OR B..." >
  <constraint path="Gene" op="IN" value="PL_BHF_UCL_cardiovascGenes" code="N" />
  <constraint path="Gene" op="IN" value="PL_DiabesityGWAS_pval-4" code="N" />
</query>

Yet when I try running the query on the humanMine website, I get this xml structure:

<query model="genomic" view="Gene.name Gene.symbol..." constraintLogic="A and B">
  <constraint path="Gene" op="IN" value="PL_BHF_UCL_cardiovascGenes" code="B" />
  <constraint path="Gene" op="IN" value="PL_DiabesityGWAS_pval-4" code="A"/>
</query>

This seems well formatted to me, so I'm at a loss as to what the error means.

The stack trace throws inside the es6-promise package used by imTables. The last method called that belongs to the imTables library is Service.prototype.authorise (I'm tracing through the compiled package).

I have no idea where to go from here. Any thoughts?

Related issues and discussion

#32

Screenshots, if any

Stack trace:
Screen Shot 2020-03-09 at 20 39 05

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the tests

@JM-Mendez JM-Mendez changed the title --wip-- Support selection from multiple lists #32 --wip-- Support selection from multiple lists Mar 10, 2020
@AdrianBZG
Copy link
Member

Hi @JM-Mendez, from the issue:

In this query:

<query model="genomic" view="Gene.symbol Gene.name..." constraintLogic="(A OR B..." > <constraint path="Gene" op="IN" value="PL_BHF_UCL_cardiovascGenes" code="N" /> <constraint path="Gene" op="IN" value="PL_DiabesityGWAS_pval-4" code="N" /> </query>

You see that in the two constraints, you have the same code (N). Can you try to change that to A for the first one and B for the second one and see if the query works? If I remember correctly, it's required to add an unique code to each constraints (A,B,C,D,E...).

@JM-Mendez JM-Mendez changed the title --wip-- Support selection from multiple lists Support selection from multiple lists Mar 21, 2020
@JM-Mendez JM-Mendez marked this pull request as ready for review March 21, 2020 16:28
@JM-Mendez
Copy link
Author

Hi @AdrianBZG and @Nikhil-Vats, I've managed to add multiple list constraints, thanks to @AdrianBZG's suggestion above. I don't know enough about the charts to know if it's properly filtering according to those constraints, so I'd need someone to verify that.

Also, I started the list constraint codes at letter "N", because I noticed that window.organismFilterLetters codes ran through the letter "J", while GO Annotation, Dataset Name, and Pathway Name used letters "K"-"M" respectively.

@AdrianBZG
Copy link
Member

Hi @JM-Mendez ,

I've taken a look at this, and it looks like it's performing an AND constraint over the selected lists. Basically it's filtering for those genes that appear in common across all the lists you select. I think it would be beter if it's a OR constraint, basically filter for those genes appearing in any of the selected lists.

You can do this by adding OR between the constraints codes, like A OR B OR C OR D ...

@JM-Mendez
Copy link
Author

JM-Mendez commented Mar 25, 2020

@AdrianBZG so I think I've tracked down the root cause of not being able to add multiple lists. I used this query builder and it seems that it does not handle more constraint codes than A-Z, even though the api docs state it only expects a string.

Currently every letter except N is being used for other filters, like Go annotations, or organisms—therefore the only available slot for a list is N.

I could dynamically create the window.tableConstraintLogic string, but this requires deciding which of the other filters to leave out. Or maybe even decide a priority level for adding filters.

So if you'd like me to create the list dynamically, I'd need some guidance on the filtering logic you'd like to use. Otherwise I'm not sure if we could add this feature.

@JM-Mendez
Copy link
Author

As a follow up, I just realized that there are only 7 (A-G) organism types in the human mine, while the constraint codes allow for 10 (A-J). So maybe we could use the other 3 slots and allow up to 4 different lists to be used.

@JM-Mendez JM-Mendez closed this Jun 15, 2020
@JM-Mendez JM-Mendez deleted the issue-32-multiple-lists branch June 15, 2020 13:13
AdrianBZG pushed a commit that referenced this pull request Sep 3, 2020
This commit will present the user a list of all the intermines they may
run queries against. It also adds in loader elements for the inputs in
the constraint popups.

Closes: #81

Squashed commits:

* Fetch available intermines
* Send event to change the mine
* Fetch the initial values for a mine after changing it
* Display a loading screen while fetching constraint items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support selection from multiple lists
2 participants