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 10:39:42 PST 2017


Hello,

I am trying to get the annotator to work using the R programming system. The API Documentation found here<http://data.bioontology.org/documentation> 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? 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?

Bellow you can find the R-code I have already established with help from various internet sources:

library(bitops)
library(RCurl)
url <- "http://data.bioontology.org/annotator"
cat(url,"\n")
resultDF <- NULL
results_list <- NULL
text <- readLines("C:/Users/SJK3001/Desktop/text.txt")
apikey <- "fbcd9b23-1a86-4e1d-9af2-ac417482bdef"

for (sentence_id in 1:length(text)) {
  curr_sentence <-
    as.character(text[sentence_id]) # current sentence to process
  cat("#", sentence_id, "from", length(text),
      ":", curr_sentence, "\n")
result <- postForm(url,
                   "text"=text,
                   "apikey"=apikey,
                   "ontologies"={"DDO"},
                   "exact_match"="false",
                   #"include" = "all"
                   "mappings"= "all",
                   "whole_word_only"="false",
                   "format"="xml")
}

Thank you for your help!

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


More information about the bioontology-support mailing list