Last active
October 28, 2017 22:16
-
-
Save grimbough/7e7a47b7a4f64915220ce35cc1ce8f39 to your computer and use it in GitHub Desktop.
Query BioMart with httr and RCurl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fullXmlQuery <- "<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE Query> | |
<Query virtualSchemaName = 'default' uniqueRows = '1' count = '0' datasetConfigVersion = '0.6' header='1' requestid= 'biomaRt'> | |
<Dataset name = 'hsapiens_gene_ensembl'> | |
<Attribute name = 'ensembl_transcript_id'/> | |
<Attribute name = 'ensembl_exon_id'/> | |
<Attribute name = 'rank'/> | |
<Attribute name = 'genomic_coding_start'/> | |
<Attribute name = 'cds_start'/> | |
<Attribute name = '5_utr_start'/> | |
</Dataset> | |
</Query>" | |
rcurl_return <- RCurl::postForm(uri = "http://www.ensembl.org:80/biomart/martservice?", | |
"query" = fullXmlQuery) | |
httr_return <- httr::content(httr::POST(url = "http://www.ensembl.org:80/biomart/martservice?", | |
body = list(query = fullXmlQuery))) | |
grep('ENST00000485971', rcurl_return) | |
grep('ENST00000485971', httr_return) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment