Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[bioontology-support] API Example Code in R

Scott Keating sjk3001 at med.cornell.edu
Fri Mar 10 14:01:01 PST 2017


Jennifer,


This was extremely helpful, thank you for your support!


Scott

________________________________
From: Jennifer Leigh Vendetti <vendetti at stanford.edu>
Sent: Friday, March 10, 2017 3:54:03 PM
To: Scott Keating
Cc: support at bioontology.org
Subject: Re: [bioontology-support] API Example Code in R

Hi again Scott,

Turns out there is someone in the dept. here that knows R, and sent this comment about your code:

"The problem is in his code. He creates an array of sentences initially, and then loops through this array and tries to annotate one sentence at a time. The problem is that when he invokes the postForm function,  he is passing the whole array (variable ‘text’) instead of one sentence (variable ‘curr_sentence’)."

result <- postForm(url,
                   "text"=text,
                   "apikey"=apikey,



Hope that helps.

Jennifer


On Mar 10, 2017, at 12:29 PM, Jennifer Leigh Vendetti <vendetti at stanford.edu<mailto:vendetti at stanford.edu>> wrote:

Hello Scott,


On Mar 10, 2017, at 10:39 AM, Scott Keating <sjk3001 at med.cornell.edu<mailto:sjk3001 at med.cornell.edu>> wrote:

I am trying to get the annotator to work using the R programming system. The API Documentation found here<https://urldefense.proofpoint.com/v2/url?u=http-3A__data.bioontology.org_documentation&d=DwMGaQ&c=lb62iw4YL4RFalcE2hQUQealT9-RXrryqt9KZX2qu2s&r=gNSeUu4B_kecJsXWJxhIzW1F-KFZO3wQZ16xKyHx9nw&m=x9oje2vYkYT4xsUaATQtN0bF_VKE7n9dyL1FkPYcfA0&s=lInWSxEYVUD9md29j_Vps4-_tPZKM9bi_Px5_kCEkw0&e=> states that sample code can be found in other languages. Do you happen to have example code written in R that I might be able to use as a reference?


This is our GitHub repository that contains sample code in various languages:

https://github.com/ncbo/ncbo_rest_sample_code<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ncbo_ncbo-5Frest-5Fsample-5Fcode&d=DwMGaQ&c=lb62iw4YL4RFalcE2hQUQealT9-RXrryqt9KZX2qu2s&r=gNSeUu4B_kecJsXWJxhIzW1F-KFZO3wQZ16xKyHx9nw&m=x9oje2vYkYT4xsUaATQtN0bF_VKE7n9dyL1FkPYcfA0&s=UWS-Kw0k1eyYv376nZ8i94w_rBy6KooGpgsNLAPDSGQ&e=>

We didn’t provide anything in R (I don’t know of anyone on our current development team that knows R).  There is however, a link in the README.md file that points to an R project authored by Cristian R. Munteanu:

https://github.com/muntisa/RNCBO<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_muntisa_RNCBO&d=DwMGaQ&c=lb62iw4YL4RFalcE2hQUQealT9-RXrryqt9KZX2qu2s&r=gNSeUu4B_kecJsXWJxhIzW1F-KFZO3wQZ16xKyHx9nw&m=x9oje2vYkYT4xsUaATQtN0bF_VKE7n9dyL1FkPYcfA0&s=8ZfDwUgG4FnTBjP0042OMzUn5tvpiGTwTbnZS4BTnm0&e=>

It looks like he’s interacting with the Recommender instead of the Annotator, but I imagine the code may be of use to you.  There is also an old page on our wiki with some example Annotator code written in R:

https://www.bioontology.org/wiki/index.php/Annotator_R_Client<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.bioontology.org_wiki_index.php_Annotator-5FR-5FClient&d=DwMGaQ&c=lb62iw4YL4RFalcE2hQUQealT9-RXrryqt9KZX2qu2s&r=gNSeUu4B_kecJsXWJxhIzW1F-KFZO3wQZ16xKyHx9nw&m=x9oje2vYkYT4xsUaATQtN0bF_VKE7n9dyL1FkPYcfA0&s=fjB6G8yHvPMaFXTLERS6Q0XOQrLEr6m9UivNdIirm4E&e=>

The caveat here being that the page is roughly 4 years old, and I can see that it’s using an older version of our REST API.  So, this one may not turn out to be that useful.


I am attempting to annotate patient electronic health record data for symptoms of adverse drug events using the diabetes ontology. When I run my code it states “Error: Bad Request”, which I assume has something to do with my API key, which I have verified as correct and properly linked to my account. Any pointers?


You mentioned that you think there’s a problem with your API key.  Just curious - did you try to execute a simple curl request outside of your program to verify that your API key is working, e.g.:

curl http://data.bioontology.org/ontologies/BRO?apikey=“your_api_key_here<https://urldefense.proofpoint.com/v2/url?u=http-3A__data.bioontology.org_ontologies_BRO-3Fapikey-3D-25E2-2580-259Cyour-5Fapi-5Fkey-5Fhere&d=DwMGaQ&c=lb62iw4YL4RFalcE2hQUQealT9-RXrryqt9KZX2qu2s&r=gNSeUu4B_kecJsXWJxhIzW1F-KFZO3wQZ16xKyHx9nw&m=x9oje2vYkYT4xsUaATQtN0bF_VKE7n9dyL1FkPYcfA0&s=W5RVY8F1pt-6TogBdCgwMEC65PRUXCw3nTN_AN9bvCw&e=>”

Kind regards,
Jennifer


_______________________________________________
bioontology-support mailing list
bioontology-support at lists.stanford.edu<mailto:bioontology-support at lists.stanford.edu>
https://mailman.stanford.edu/mailman/listinfo/bioontology-support

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20170310/d5c63657/attachment.html>


More information about the bioontology-support mailing list