R: Retrieves information from the BioMart database
getBM
R Documentation
Retrieves information from the BioMart database
Description
This function is the main biomaRt query function. Given a set of filters and corresponding values, it retrieves the user specified attributes from the BioMart database one is connected to.
Attributes you want to retrieve. A possible list of attributes can be retrieved using the function listAttributes.
filters
Filters (one or more) that should be used in the query. A possible list of filters can be retrieved using the function listFilters.
values
Values of the filter, e.g. vector of affy IDs. If multiple filters are specified then the argument should be a list of vectors of which the position of each vector corresponds to the position of the filters in the filters argument.
mart
object of class Mart, created with the useMart function.
curl
An optional 'CURLHandle' object, that can be used to speed up getBM when used in a loop.
checkFilters
Sometimes attributes where a value needs to be specified, for example upstream_flank with value 20 for obtaining upstream sequence flank regions of length 20bp, are treated as filters in BioMarts. To enable such a query to work, one must specify the attribute as a filter and set checkFilters = FALSE for the query to work.
verbose
When using biomaRt in webservice mode and setting verbose to TRUE, the XML query to the webservice will be printed.
uniqueRows
If the result of a query contains multiple identical rows, setting this argument to TRUE (default) will result in deleting the duplicated rows in the query result at the server side.
bmHeader
Boolean to indicate if the result retrieved from the
BioMart server should include the data headers or not, defaults to FALSE. This should
only be switched on if the default behavior results in errors,
setting to on might still be able to retrieve your data in that case
Value
A data.frame. There is no implicit mapping between its rows and the function arguments (e.g. filters, values), therefore make sure to have the relevant identifier(s) returned by specifying them in attributes. See Examples.
Author(s)
Steffen Durinck
Examples
if (interactive()) {
mart <- useMart("ensembl")
datasets <- listDatasets(mart)
mart <- useDataset("hsapiens_gene_ensembl",mart)
getBM(attributes = c("affy_hg_u95av2", "hgnc_symbol", "chromosome_name", "band"),
filters = "affy_hg_u95av2",
values = c("1939_at","1503_at","1454_at"),
mart = mart)
# rows are sorted by `affy_hg_u95av2`, and in different order than the `values` argument
}
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(biomaRt)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/biomaRt/getBM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getBM
> ### Title: Retrieves information from the BioMart database
> ### Aliases: getBM
> ### Keywords: methods
>
> ### ** Examples
>
> #if (interactive()) {
> mart <- useMart("ensembl")
> datasets <- listDatasets(mart)
> mart <- useDataset("hsapiens_gene_ensembl",mart)
> getBM(attributes = c("affy_hg_u95av2", "hgnc_symbol", "chromosome_name", "band"),
+ filters = "affy_hg_u95av2",
+ values = c("1939_at","1503_at","1454_at"),
+ mart = mart)
affy_hg_u95av2 hgnc_symbol chromosome_name band
1 1503_at BRCA2 13 q13.1
2 1454_at SMAD3 15 q22.33
3 1939_at TP53 17 p13.1
> # rows are sorted by `affy_hg_u95av2`, and in different order than the `values` argument
> #}
>
>
>
>
>
> dev.off()
null device
1
>