Access WormBase ParaSite data using R

The WormBase ParaSite BioMart fully supports the biomaRt package for R.  This enables the fast reteieval of data directly into your R scripts.

Here are some quick start instructions to embed WormBase ParaSite data into your scripts.

Install the biomaRt package:

    source("http://bioconductor.org/biocLite.R")
    biocLite("biomaRt")

Initialise biomaRt

    library(biomaRt)

Establish a connection to the WormBase ParaSite BioMart

    mart <- useMart("parasite_mart", dataset = "wbps_eg_gene", host = "parasite.wormbase.org")

List the available filters and attributes

    listFilters(mart)
    listAttributes(mart)

An example: get all the S. mansoni genes with a C. elegans orthologue

    library(biomaRt)
    mart <- useMart("parasite_mart", dataset = "wbps_eg_gene", host = "parasite.wormbase.org")
    genes <- getBM(mart = mart, 
                   filters = c("species_id_1010", "with_celegans_eg_homologue"),
                   value = list("prjea36577", TRUE),
                   attributes = c("ensembl_gene_id", "celegans_eg_gene"))
    head(genes)

Tip: to replicate a query constructed in the web browser, click the “XML” button. From here, you can see the relevant filter and attribute names required to construct the same query in biomaRt.

Advertisements