2

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?

asdlfkjlkj
  • 2,258
  • 6
  • 20
  • 28
  • 2
    You could start by reading the [biomaRt user guide](https://bioconductor.org/packages/release/bioc/vignettes/biomaRt/inst/doc/biomaRt.html). Section 4.11 titled "Given the human gene TP53, retrieve the human chromosomal location of this gene..." answers your question. – neilfws Aug 28 '17 at 23:53

1 Answers1

5

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.

dvantwisk
  • 561
  • 3
  • 11