Using biomaRt to find the nearest upstream/ downstream gene from an Ensembl ID
1
0
Entering edit mode
9.6 years ago

I have a bunch of Ensembl Transcript IDs (ENST....) and I'd like to know their nearest upstream and downstream genes. I've used the getBM function but I've not found the attributes I'm looking for. Can anyone suggest any other ways to do this? Or if I've missed a way to do this in biomaRt?

Thanks

biomaRt ensembl • 4.4k views
ADD COMMENT
4
Entering edit mode
9.6 years ago
Neilfws 49k

biomaRt is not the best tool for this query; there is no attribute that will directly return the information you want.

One approach would be to retrieve the chromosome, transcript start, transcript end and strand of the ENST ID, then use the chromosomal_region filter to query for genes. For example:

library(biomaRt)
mart.hs <- useMart("ensembl", "hsapiens_gene_ensembl")

enst <- getBM(attributes = c("ensembl_transcript_id", "chromosome_name", "transcript_start", "transcript_end", "strand"), filters = "ensembl_transcript_id", values = "ENST00000520959", mart = mart.hs)

# query for gene IDs 50 kbp upstream
region <- paste(enst$chromosome_name, enst$transcript_start - 50000, enst$transcript_start, enst$strand, sep = ":")

getBM(attributes = "ensembl_gene_id", filters = "chromosomal_region", values = region, mart = mart.hs)

  ensembl_gene_id
1 ENSG00000104613
2 ENSG00000175445

In this case ENSG00000175445 is the gene for the ENST and ENSG00000104613 is upstream.

But there are better tools for this purpose; search this site or look at the similar posts on the right of this page, especially Find Nearest Gene Upstream Using Mysql And Perl Program.

ADD COMMENT
0
Entering edit mode

That's the style of solution I was leaning to. Good to know I hadn't missed any simple attributes!

Quite an elegant solution even though not designed for the purpose, thanks!

ADD REPLY

Login before adding your answer.

Traffic: 2077 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6