I want to get gene location of human genome from gene symbol(example: TTN) and gene ID(example: ENSG00000155657). I want to do it using biomaRt
package of R. How can I do that?
I'm not entirely sure what you mean by gene location, but I think the following should get you started:
ensembl <- useMart("ensembl")
ensembl <- useDataset("hsapiens_gene_ensembl",mart=ensembl)
getBM(attributes=c('chromosome_name', 'start_position', 'end_position', 'strand'),
filters=c('hgnc_symbol', 'ensembl_gene_id'),
values=list('TTN', 'ENSG00000155657'),
mart=ensembl)
You can input more filters by adding additional vectors (of length two in this example) to the values
list.
You can use the function listAttributes(ensembl)
to get a data.frame containing all attributes that you can obtain from biomart.
As @neilfws has already stated, the biomaRt user guide is the right place to look for more information about biomaRt. I recommend that you ask further questions about Bioconductor R packages like biomaRt on the Bioconductor support forum.