wikipathways / wikipathways.github.io

GitHub pages for GPML-Repo
https://www.wikipathways.org/
5 stars 18 forks source link

[Pathway Issue]: Frequent timeouts when using API #116

Open BeatWolf opened 9 months ago

BeatWolf commented 9 months ago

What is the issue with the pathway?

Hi, i'm trying to use the API, notably to get all pathways from a given species. When using for example: https://webservice.wikipathways.org/ui/#!/Organism_list/get_listOrganisms

With Homo sapiens, it is slow and often simply times out.

What kind of content issue is this?

Type of revision

khanspers commented 9 months ago

Hi @BeatWolf, there is an issue with the web service currently, we are working on fixing it.

khanspers commented 9 months ago

@BeatWolf : it should work now, please try again. I just tried getting all pathways from Homo sapiens (https://webservice.wikipathways.org/listPathways?organism=Homo%20sapiens), and results were returned within a few seconds.

AlexanderPico commented 9 months ago

@BeatWolf On a related note: We have a new JSON-based API we are planning to migrate to. The current (not-so-stable) one will be retired at some point in the future.

If you want to share more about how you use our API, we can provide code examples to help you migrate. For example, do you use the R, Python or Java client libraries? Do you use the Swagger UI by hand? Or do you use curl or direct http calls from your scripts?

And which methods do you use?

Here is the documentation for the new API so far: https://www.wikipathways.org/json/ Essentially, we have pre-compiled JSON responses for everything, so you can just grab the JSON you need and parse it from there.

BeatWolf commented 9 months ago

Hi, thank you for the fix.

As for the new API, indeed, although i usually only need the pathways of one organism, the URL: https://www.wikipathways.org/json/listPathways.json Has all i need and is faster than the API, so i'll just switch to that.

After that i need some information about the pathways. Mostly to map them to the correct genes. As this needs to work for multiple species and sometimes i have ensembl genes and sometimes refseq genes etc, i get the information through the sparql endpoint:

https://sparql.wikipathways.org/sparql?default-graph-uri=&query=PREFIX+wp%3A++++++%3Chttp%3A%2F%2Fvocabularies.wikipathways.org%2Fwp%23%3E%0APREFIX+rdfs%3A++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+dcterms%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0Aselect+distinct+%3Fpathway+str%28%3Flabel%29+as+%3Fname+%3Fentrez+%3FhgncId+where+%7B%0A%7B+%3FgeneProduct+a+wp%3AGeneProduct+%7D+UNION+%7B+%3FgeneProduct+a+wp%3AProtein+%7D+.+%0A%3FgeneProduct+rdfs%3Alabel+%3Flabel+.+%0A%3FgeneProduct+dcterms%3AisPartOf+%3Fpathway+.+%0A%3FgeneProduct+wp%3AbdbEntrezGene+%3Fentrez+.+%0AOptional+%7B+%3FgeneProduct+wp%3AbdbHgncSymbol+%3FhgncId+.+%7D+%0A%3Fpathway+a+wp%3APathway+.+%0A%3Fpathway+wp%3AorganismName+%22Arabidopsis+thaliana%22+.+%0A%7D%0ALIMIT+50000%0AOFFSET+0&format=application%2Fsparql-results%2Bjson&timeout=0&debug=on

I think i could maybe get the same information through https://www.wikipathways.org/json/findPathwaysByXref.json and https://www.wikipathways.org/json/findPathwaysByText.json But i think thats trickier. I would like to have for every node/gene mentioned to get as much information as i can, to then map it to the current gene model. I do not think anything like that is possible currently with the new API?