Learn R Programming

MineICA (version 1.12.0)

writeGenes: Description of features using package biomaRt.

Description

This function annotates IDs (typically gene IDs) provided by the user and returns an html file with their description.

Usage

writeGenes(data, filename = NULL, mart = useMart(biomart = "ensembl", dataset = "hsapiens_gene_ensembl"), typeId = "hgnc_symbol", typeRetrieved = NULL, sortBy = NULL, sortAbs = TRUE, colAnnot = NULL, decreasing = TRUE, highlight = NULL, caption = "")

Arguments

data
Either a data.frame whose rownames or one of its columns contain the IDs to be annotated, or a vector of IDs.
filename
The name of the HTML file where gene annotations are written.
mart
Output of function useMart from package biomaRt.
typeId
The type of IDs available in data, in the biomaRt way (type listFilters(mart) to choose one).
typeRetrieved
The descriptors uses to annotate the features of data (type listAttributes(mart) to choose one or several).
sortBy
Name of a column of data used to order the output.
sortAbs
If TRUE absolute value of column sortBy is used to order the output.
colAnnot
The column containing the IDs to be annotated, if NULL or missing and argument data is a data.frame, then rownames of data must contain the IDs.
decreasing
If TRUE, the output is sorted by decreasing values of the sortBy column
highlight
IDs to be displayed in colour red in the returned table
caption
A title for the HTML table

Value

This function returns a data.frame which contains annotations of the input data.

Details

"hgnc_symbol", "ensembl_gene_id", "description", "chromosome_name", "start_position", "end_position", "band", and "strand", are automatically added to the list of fields available in argument typeRetrieved queried on biomaRt. The web-links to www.genecards.org and www.proteinatlas.org are automatically added in the columns of the output respectively corresponding to hgnc_symbol and ensembl_gene_id.

See Also

getBM, listFilters, listAttributes, useMart

Examples

Run this code
if (interactive()) {
## define the database to be used
mart <- useMart(biomart="ensembl", dataset="hsapiens_gene_ensembl")

### Describe:
## a set of hgnc symbols with default descriptions (typeRetrieved=NULL)
genes <- c("TOP2A","E2F3","E2F1","CDK1","CDC20","MKI67")
writeGenes(data=genes, filename="foo", mart=mart, typeId = "hgnc_symbol")

## a data.frame indexed by hngc symbols, sort output according to column "values", add a title to the HTML output
datagenes <- data.frame(values=rnorm(6),row.names = genes)
writeGenes(data=datagenes, filename="foo", sortBy = "values", caption = "Description of some proliferation genes.")

## a set of Entrez Gene IDs with default descriptions
genes <- c("7153","1871","1869","983","991","4288")
writeGenes(data=genes, filename="foo", mart=mart, typeId = "entrezgene")
}
## Not run: 
# ## add the GO category the genes belong to
# ## search in listAttributes(mart)[,1] which filter correspond to the Gene Ontology -> "go_id"
# writeGenes(data=genes, filename="foo", mart=mart, typeId = "entrezgene", typeRetrieved = "go_id")
# ## End(Not run)

Run the code above in your browser using DataLab