PROconsortium / PRoteinOntology

Other
12 stars 3 forks source link

REST API Synonym Values #317

Closed seankim658 closed 5 months ago

seankim658 commented 5 months ago

The REST API doesn't seem to be returning any synonym data for the /pros/{proId} endpoint. I've tried hitting the endpoint for a few different ID values and the return data always has an empty list for the synonym key. If I search the same ID through the ontology link (http://purl.obolibrary.org/obo/{proId}) I can see the synonym values.

nataled commented 5 months ago

Hi Sean,

Thanks for bringing this to our attention. @hongzhanhuang @chenchuming can you look into this?

nataled commented 5 months ago

Hello Sean,

Did you use the "showSynonym=true” option for the API? If not, that's likely the issue.

seankim658 commented 5 months ago

Ah, that seems to be what I was missing, thank you.

It might be useful to add that to the documentation page here. The showSynonym parameter isn't listed as one of the possible supported parameters and it (at least for me) was slightly confusing that the API will still return a synonyms key that has an empty value when the default is false for the showSynonym parameter.

For example, the example call on the documentation swagger page will return this:

[
  {
    "id": "PR:Q9R244",
    "name": "short transient receptor potential channel 2 (mouse)",
    "termDef": "A short transient receptor potential cation channel TRPC2 that is encoded in the genome of mouse.",
    "category": "organism-gene",
    "parent": [
      "PR:000001725",
      "PR:000029032"
    ],
    "synonym": "[]"
  }
]

All of the other parameters that are set to false such as showAnnotation, showChild, etc are not returned at all when set to false. Synonym appears to be the only field that still has a return key when the parameter is set to false and it returns an empty array, which I can see being confusing for users.

Thank you again for the prompt response and just disregard if I'm missing some reason for this.

nataled commented 5 months ago

Good ideas, thanks!

nataled commented 5 months ago

Update: it seems that the documentation does indeed include information on synonyms. For example, if you: go to https://lod.proconsortium.org/api.html (see *below) click on "PRO TERMs" click on "GET" in "GET /pros/{proIds} Return PRO terms by IDs"

You'll see that all options (Parameters) are listed in the page, where "showSynonym" default is "true" The request url can be found after clicking on “Execute”.

Perhaps you expected the information somewhere else?

*this is the correct URL for the API. You were using something different. That being said, that 'different' page (server starts with 'beadle') has been updated from the main site. I verified all is well by using the example given on the API page (is that what you were calling the 'documentation swagger page'?) and found no issues.

We're trying to figure out how you got that beadle server link. We need to make sure it isn't lurking on one of our PRO pages somewhere. Can you let me know?

seankim658 commented 5 months ago

Ah, okay that is definitely the issue. The page I was using (beadle link) does not have the synonym parameter listed and has the issues as I described previously. The correct page you sent resolves the issues I mentioned previously with the documentation and return data (on showSynonym=false it doesn't erroneously include the synonym key in the return page).

I found the page through googling "protein ontology api" and it was the first link that came up on Google for me:

image

nataled commented 5 months ago

Thanks for the pointer. Not really sure how to prevent that other than perhaps a forwarding URL.

seankim658 commented 5 months ago

On first glance, the beadle link is missing a couple parameters from its documentation for the /pros/{pdoIds}:

These are in the link you sent me but they are not present in the beadle link I was using.