monarch-initiative / monarch-legacy

Monarch web application and API
BSD 3-Clause "New" or "Revised" License
42 stars 37 forks source link

get labels for multiple IDs associated with unmatched phenotypes for phenogrid #935

Open harryhoch opened 9 years ago

harryhoch commented 9 years ago

Phenogrid matches a set of input phenotypes to models. In some cases, input phenotypes might not be matched. We'd like to have an easy way of getting labels for any unmatched phenotypes. These might be returned via owlsim results, or we might have a monarch-app layer call that would take a list of ids and return matching labels.

@cmungall, @nlwashington

kshefchek commented 9 years ago

Prior to the august release we stored the phenotypes in this structure:

    "phenotype_list": [
            {
                "id": "HP:0000341",
                "label": "Narrow forehead",
                "observed": "positive"
             },...

For example: http://beta.monarchinitiative.org/legacy/disease/OMIM:615583/phenotype_list.json

However, I changed this when uniquifying the phenotype IDs, now it is list of ids. If I change this back to the original object (with only unique entries) will that allow you to fix the issue?

harryhoch commented 9 years ago

@kshefchek, I thought we had had that functionality beforehand. @yuanzhou, @davism84, would this change do the trick for you?

yuanzhou commented 9 years ago

@harryhoch @kshefchek @davism84 I think the change that Kent mentioned would fix the issues when you run phenogrid inside monarch-app since we always need to get the data from phenotype_list.json. Not sure when we run phenogrid as a standalone widget, we might still need to send ajax calls to grab the labels for unmatched phenotypes. Let's try it out with this change first.

kshefchek commented 9 years ago

I've updated the monarch-app to return a list of objects (see https://github.com/monarch-initiative/monarch-app/issues/935#issuecomment-136416784)

yuanzhou commented 9 years ago

@kshefchek should I still test this against the beta server?

I've tested Phenogrid release branch against your change, the change has no affect to the phenogrid ajax calls to grab the unmatched phenotype labels. Since it runs against the results from simsearch to get the unmatched phenotypes and only id found in the returned data set.

When I was testing this change inside monarch-app, I grabbed the monarch-app github master branch and did a fresh installation. Failed and got this error:

capture

kshefchek commented 9 years ago

@yaunzhou I'm not sure I understand

    the change has no affect to the phenogrid ajax calls to grab the unmatched phenotype labels. 
    Since it runs against the results from simsearch to get the unmatched phenotypes and only id 
    found in the returned data set.

Could we get the label from the input object, for example

    label = phenotype_list.filter( function(i) { return i.id == unmatched_id; });
yuanzhou commented 9 years ago

@kshefchek I had a fresh installation of monarch-app this morning, and I could get all the labels from the phenotype_list.json.

capture

Since all phenotypes in the phenotype_list are used as the input of phenogrid, there should be no need to send extra ajax calls to grab unmatched phenotype labels.

BUT when you run phenogrid as a standalone widget, not inside monarch-app, we will still need an API to return all the unmatched labels. Because in this case, the input phenotype list only contains phenotype IDs, we only get the labels after a simsearch for those MATCHED phenotypes.

yuanzhou commented 9 years ago

@kshefchek @harryhoch I just talked to @davism84, and he confirmed my thoughts. So the real issues are:

1. When running phenogrid inside monarch-app, phenotype_list.json provided by monarch-app's disease page is used as the phenogrid data input. For those unmatched (after a simsearch) phenotypes, even though they have labels from the original phenotype_list.json, we will still need to create some functionality to traverse the labels for those unmatched. No need to send out extra ajax calls in this case.

2. When running phenogrid outside monarch-app, the users can provide any/random phenotype list that only have the IDs (since they won't be able to know all the labels) as the phenogrid data input. After a simsearch with sending out all the phenotype IDs, we get all the matched info. Unmatched phenotypes are still returned back with IDs. This screenshot shows that we have 14 phenotype provided by the user, and simsearch results contain all the 14 IDs in expanded a, and the similarity info in expanded b.

capture

So there are two possible workarounds:

a) Phenogrid sends out all those unmatched IDs in one ajax call to monarch-app, and gets all the corresponding labels back. We'll need to make sure either send this ajax call in the very beginning so once the unmatched checkbox is checked, the results can show immediately. Or do it by the time the checkbox is clicked, and display a loading image.

b) Can we modify simsearch API to add all the labels in the returned a section? This way we avoid using any extra ajax calls. And since simsearch can add labels to matched phenotypes, it should be straightforward to to the same to unmatched phenotypes.

kshefchek commented 9 years ago

I think the eventual plan is to have these returned by owlsim. But this would be an owlsim feature, could you make a ticket in the owlsim repo for this feature? https://github.com/monarch-initiative/owlsim-v3

yuanzhou commented 9 years ago

@kshefchek already added this issue in the owlsim repo, thanks for the suggestion!

yuanzhou commented 9 years ago

@harryhoch @kshefchek just to follow up with this issue, I didn't hear anything from the owlsim-v3 repo(https://github.com/monarch-initiative/owlsim-v3/issues/17).

kshefchek commented 9 years ago

I think it will be some time until this can be implemented in owlsim. Is it possible to take different approaches based on the stand alone and monarch-app environments?

kshefchek commented 9 years ago

@yuanzhou, randomly thought of this, but you could use the scigraph neighbors service to get labels for a list of phenotype ids. Just set the depth to 0, for example:

http://geoffrey.crbs.ucsd.edu:9000/scigraph/graph/neighbors?id=DOID:4&id=HP:0000118&depth=0

It's not what the service is intended for but it works just as well.

jmcmurry commented 9 years ago

@yuanzhou could you see if this unblocks you, please?

yuanzhou commented 9 years ago

@kshefchek sorry Kent that I missed your reply couple weeks ago. Just noticed this after @jmcmurry mentioned me. What you've suggested with the scigraph neighbors service seems to be a better solution in terms of HTTP round trips. At least I can get all the unmatched phenotype labels through one ajax call. Doesn't hurt if the returned JSON has other data. Is that possible that we wrap this scigraph api into a monarch-app api? The reason I'm asking this is because in phenogrid, we have a serverURL config. It uses the beta.monarchinitiative.org as a global config, otherwise I'll just hardcode that scigraph URL in the code.

yuanzhou commented 9 years ago

@harryhoch I think Kent's suggestion with scigraph API is better than what we have now. Either we can have this wrapped as a monarch-app api or not, I'll use this for the unmatched phenotypes next week.

@jmcmurry I think I should be able to close this issue early next week.

kshefchek commented 9 years ago

We could wrap this into the monarch api, also see #1012 as an option.

jmcmurry commented 9 years ago

great, thanks Zhou

jmcmurry commented 9 years ago

@kshefchek and @yuanzhou please advise what needs to be done to close the ticket. Thanks

yuanzhou commented 9 years ago

@jmcmurry I think as long as #1012 get addressed, we can close both.