Open ChristopherMancuso opened 11 months ago
Hi @ChristopherMancuso thanks for dropping this off!
I'll start off by apologizing about the state of our documentation, it should really mention that monarch-py is currently intended to be used with a local instance of our Solr Docker container running.
For immediate usage, if you have monarch-py and docker installed, you can use the following CLI commands to get that started:
monarch solr download
monarch solr start
monarch solr status
Once you have a local Solr instance running, the code you posted above using SolrImplementation()
should work as expected.
Long term, we'd like to have a way for monarch-py to call the official Monarch API so that users don't need to go through these steps.
To approach this, we should:
@kevinschaper may also have some input here
Hi @ChristopherMancuso,
Confusingly, api.monarchinitiative.org is still our older API, and as @glass-ships mentioned, monarch-py is used within our api, and we haven't yet updated it so that it will pull data from the public API.
From the new API, you should be able to use a get request to pick up phenotype associations for a given phenotype with a query like
http://api-v3.monarchinitiative.org/v3/api/association?predicate=biolink%3Ahas_phenotype&object=HP%3A0000492&limit=20&offset=0
We don't have taxon filtering on the v3 api endpoint yet, though, currently for this request (an HPO term) the only responses would be for human data.
Additionally, to wrap it up in some python:
response = requests.get("http://api-v3.monarchinitiative.org/v3/api/association?predicate=biolink%3Ahas_phenotype&object=HP%3A0000492&limit=20&offset=0").json()
print(response)
Oh, also, here's the new API docs:
https://api-v3.monarchinitiative.org/v3/docs
It would be super helpful for us if you can file specific issues for anything that the API doesn't yet support that you need, and we'll try to get them in as soon as we can. The old API was pretty comprehensive, and we took some guesses about what would be most important to support initially, but feedback on what we missed will be super helpful.
Hi @kevinschaper and @glass-ships, thanks for the quick reply! I think what you are both saying for next steps to try/do makes sense to me. I'll give the above suggestions a try in the next day or so and leave some feedback on this thread or create a new issue as needed. I really appreciate the help with this!
I tried to tried to break up some issues as best I could and post them as tickets. I see @kevinschaper you answered one already. One question that maybe is just for this ticket still is, what is the relationship between biolink and monarch? They seemed heavily intertwined but I can't figure out how they fit together. Is that important to know when testing out the API V3 features?
For moving forward I will stick with api V3 as opposed to monarch-py. I work on mostly HPC systems and getting docker containers installed is usually completely prohibited on some clusters or at a minimum pretty complicated to do on others.
Thanks again for the quick follow up on these questions, I really appreciate it!
So, Monarch uses things like the Biolink Model and KGX. which are developed by biolink, during the creation and curation of our knowledge graph (our data model is relatively biolink compliant).
To that end, a familiarity with the biolink model may be helpful in interpreting results, but in terms of just using the Monarch API, you should be fine with minimal understanding.
The public API is powered by monarch-py in the backend, so it may also be handy to reference the documentation for that and its responses: https://monarch-app.monarchinitiative.org/Data-Model/
An especially confusing aspect is that we're retiring the "Biolink API" as we're moving our graph into a data model called the Biolink Model. Monarch is involved in building and refining the Biolink Model (and associated tooling), though, many of the use cases have been driven by the NCATS Translator project, so the model extends well beyond what we bring together in our graph.
I looked through Biolink and KGX. It is pretty cool how so much information is being shared across different projects!
Hi,
I am trying to access the monarch-py api and I'm running into some problems. For context, the end goal is that I would like to query monarch with a phenotype term and get back a list of all genes annotated to that term, with the annotations propagated up the ontology, with annotations from more specific terms being added to more general ancestor terms. Currently, I'm using annotations from https://archive.monarchinitiative.org/latest/tsv/gene_associations/ but these annotations don't appear to be propagated.
To get propagated gene annotations we were told to use the API. However, I can't get the monarch-py package to work, which is where I was taken when I clicked on the API link in the Monarch about page. I installed it on the CU HPC ALPINE via
pip install monarch-py
.The first issue is that the api documentation for the Basic Example - As a Module contained a spelling error and I have posted about that in a separate issue on the monarch-app repo.
After fixing the above to be able to import correctly, the basic function still won't work. The code I used is
with the following error
I noticed on the Monarch help page that the API was down but API-V3 is working. Is monarch-py using the original API and not V3?
I also tried to use the python requests library directly using
I have recently made posts via other apis and via python's requests package, so I don't think it just in general that not working for me.
Any help in getting the propagated annotations for phenotype terms would be much approached!