format_BM_from_XML: Translate XML Query to R Code

View source: R/format_BM_from_XML.R

format_BM_from_XMLR Documentation

Translate XML Query to R Code

Description

Take a text object returned from the XML formatted output at https://parasite.wormbase.org/biomart and return a function call to biomaRt::getBM with the filter names, values, and requested output fields.

Usage

format_BM_from_XML(xmltext, printCode = TRUE)

Arguments

xmltext

XML text copied from https://parasite.wormbase.org/biomart

printCode

TRUE/FALSE Print the R code to the console in addition to returning the call.

Value

A 'call' object that can be run with runWithMart().

See Also

getBM, runWithMart

Examples

# A query that extracts all C. elegans long noncoding RNAs.
query = format_BM_from_XML('<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Query>
<Query  virtualSchemaName = "parasite_mart" formatter = "TSV" header = "0" uniqueRows = "0" count = "" datasetConfigVersion = "0.6" >
  <Dataset name = "wbps_gene" interface = "default" >
     <Filter name = "biotype" value = "lincRNA"/>
     <Filter name = "species_id_1010" value = "caelegprjna13758"/>
     <Attribute name = "wbps_gene_id" />
  </Dataset>
</Query>')

mart = getParamart()
lincs = runWithMart(query, mart)
head(lincs)

meekrob/ParasiteXML documentation built on March 11, 2023, 10:53 a.m.