cognoma / frontend

Frontend for Project Cognoma
http://cognoma.org/
Other
4 stars 22 forks source link

Frontend Interface does not correctly take the union of multiple input query genes #160

Closed gwaybio closed 6 years ago

gwaybio commented 6 years ago

When selecting KRAS, HRAS, and NRAS from the gene query the disease-type query displays mutation counts for NRAS only. It should take the union of all query genes to display mutation count.

e.g.

KRAS HRAS NRAS Display Count
sample A 0 0 1 1
sample B 1 0 1 1
sample C 0 0 0 0
kurtwheeler commented 6 years ago

@ramenhog was this the issue that had been fixed in a core-service PR which has since been deployed?

ramenhog commented 6 years ago

Yes, it should've been. But I've been testing it on cognoma.org and it seems like it's still taking the intersection of all the query genes...

kurtwheeler commented 6 years ago

Oh womp womp. Any idea what might be going wrong?

ramenhog commented 6 years ago

@kurtwheeler and I talked about this in person some time ago and we think it might be helpful to have someone who knows the Cognoma backend better to take a peak at this issue. This is how I had attempted to solve it: https://github.com/cognoma/core-service/pull/90

cgreene commented 6 years ago

Looks like the query that is sent for the KRAS/NRAS pair is: "https://api.cognoma.org/samples?disease=BRCA&limit=1&mutations__gene=4893&mutations__gene=3845&offset=1"

I'm imagining that's hitting https://github.com/cognoma/core-service/blob/master/api/views.py#L280.

Following that up to https://github.com/cognoma/core-service/blob/master/api/views.py#L275 seems to be responsible for the actual filtering. There's another solution in the same ticket that's referenced there that uses Q() that looks like it should work as well: https://github.com/carltongibson/django-filter/issues/137#issuecomment-127073878

Overall, I'm confused as to why this isn't working. We could try the Q solution, and I guess we need a test.

cgreene commented 6 years ago

I did a bit more digging.

I looked at Ovarian / Breast tumor counts. I queried in order for: TP53 and will give (Ov/Br) numbers of positives ( 160/299) added PIK3CA (3/316) added KRAS (3/6)

If I query only for KRAS I get (3/6) If I add a query for PIK3CA I get (3/316).

It appears to only be querying the last entry. The API query for the final thing sent from the frontend is to https://api.cognoma.org/samples?disease=STAD&limit=1&mutations__gene=3845&mutations__gene=5290&offset=1

The frontend appears to be making the right query. The backend appears to be only using the final element from the list.

cgreene commented 6 years ago

Tracked this down while writing backend tests. The query being constructed at https://github.com/cognoma/frontend/blob/cc6ee4f25bb28c09d60e2af7eb5cfc35615c40b4/app/js/dataModels/DiseaseModel.js#L93 doesn't hit the new filter. To hit that filter, we need to use any_mutations=g1,g2,g3.

The ListFilter expects things to be comma separated values in the URL.