With BioGroovy 1.1 we’ve added support for fetching data from a variety of RESTful webservices, including: EntrezGene, PubMed, UniProt and many others.
Fetching Data
In this example, we’ll fetch gene information from EntrezGene for 3 genes, and output the result to the console.
import org.biogroovy.io.eutils.EntrezGeneSlurper;
import org.biogroovy.models.Gene;
@Grab(group='org.biogroovy', module='biogroovy', version='1.1')
EntrezGeneSlurper slurper = new EntrezGeneSlurper();
println “Gene”
println “Symbol\tEntrezGeneID\tName”
List<Gene> geneList = slurper.fetchAll(‘675,1034,133’);
geneList.each{Gene gene ->
println “${gene.symbol}\t${gene.entrezGeneId}\t${gene.name}”
}
In the slurper.fetchAll() method call, we pass a string containing a comma-delimited list of EntrezGene IDs. This return a list of Gene objects. We iterate through the gene list and print the results out to the console.
