Genomic coordinates of HGNC gene names

为君一笑 提交于 2019-12-24 10:14:23

问题


I want to get coordinates of human genes from my list (consisting of hgnc genes id) using GenomicFeatures and TxDb.Hsapiens.UCSC.hg19.knownGene R packages from Bioconductor.

library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb=(TxDb.Hsapiens.UCSC.hg19.knownGene)

my_genes = c("INO80","NASP","INO80D","SMARCA1")

select(txdb, keys = my_genes,
       columns=c("TXCHROM","TXSTART","TXEND","TXSTRAND"), 
       keytype="GENEID")

However, it doesn't' work because txdb doesn't take hgnc identifiers; how can it be solved? I couldn't find any appropriate keytype that will support hgnc and not sure how to match hgnc id I have and GENEID from txdb.


回答1:


Because txdb is for transcripts, and it doesn't have (hgnc) geneSymbol, but it has EntrezID.

First, we need to map geneSymbol to EntrezID.

library(org.Hs.eg.db)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)

myGeneSymbols <- select(org.Hs.eg.db,
                        keys = c("INO80","NASP","INO80D","SMARCA1"),
                        columns = c("SYMBOL","ENTREZID"),
                        keytype = "SYMBOL")
#    SYMBOL ENTREZID
# 1   INO80    54617
# 2    NASP     4678
# 3  INO80D    54891
# 4 SMARCA1     6594

Then we can subset txdb:

myGeneSymbolsTx <- select(TxDb.Hsapiens.UCSC.hg19.knownGene,
                          keys = myGeneSymbols$ENTREZID,
                          columns = c("GENEID", "TXID", "TXCHROM", "TXSTART", "TXEND"),
                          keytype = "GENEID")
#    GENEID  TXID TXCHROM   TXSTART     TXEND
# 1   54617 55599   chr15  41267988  41280172
# 2   54617 55600   chr15  41271079  41408340
# 3   54617 55601   chr15  41271079  41408340
# 4    4678  1229    chr1  46049660  46079853
# 5    4678  1230    chr1  46049660  46081143
# 6    4678  1231    chr1  46049660  46084578
# 7    4678  1232    chr1  46049660  46084578
# 8    4678  1233    chr1  46049660  46084578
# 9    4678  1234    chr1  46067733  46075197
# 10   4678  1235    chr1  46077135  46084578
# 11  54891 12593    chr2 206858445 206950906
# 12   6594 77970    chrX 128580478 128657460
# 13   6594 77971    chrX 128580478 128657460
# 14   6594 77972    chrX 128580740 128657460
# 15   6594 77973    chrX 128580740 128657460

If required, we can then add geneSymbol to the table using merge:

res <- merge(myGeneSymbols, myGeneSymbolsTx, by.x = "ENTREZID", by.y = "GENEID")
#    ENTREZID  SYMBOL  TXID TXCHROM   TXSTART     TXEND
# 1      4678    NASP  1229    chr1  46049660  46079853
# 2      4678    NASP  1230    chr1  46049660  46081143
# 3      4678    NASP  1231    chr1  46049660  46084578
# 4      4678    NASP  1232    chr1  46049660  46084578
# 5      4678    NASP  1233    chr1  46049660  46084578
# 6      4678    NASP  1234    chr1  46067733  46075197
# 7      4678    NASP  1235    chr1  46077135  46084578
# 8     54617   INO80 55599   chr15  41267988  41280172
# 9     54617   INO80 55600   chr15  41271079  41408340
# 10    54617   INO80 55601   chr15  41271079  41408340
# 11    54891  INO80D 12593    chr2 206858445 206950906
# 12     6594 SMARCA1 77970    chrX 128580478 128657460
# 13     6594 SMARCA1 77971    chrX 128580478 128657460
# 14     6594 SMARCA1 77972    chrX 128580740 128657460
# 15     6594 SMARCA1 77973    chrX 128580740 128657460



回答2:


I am not familiar with TxDb and the kind of attributes it accepts/includes.
I can offer you an alternative approach using the biomaRt package though, which accepts hgnc as well.

library(biomaRt)

my_genes = c("INO80","NASP","INO80D","SMARCA1")

m <- useMart('ensembl', dataset='hsapiens_gene_ensembl') # create a mart object
df <- getBM(mart=m, attributes=c('hgnc_symbol', 'description', 'chromosome_name',
                                 'start_position', 'end_position', 'strand',
                                 'ensembl_gene_id'),
            filters='hgnc_symbol', values=my_genes) # where df is a data.frame with all your requested info

It has a ton of attributes to choose from, which you can find out by doing a simple:

listAttributes(m) # our current dataset

For more info check ??biomaRt

Hope this helps.



来源:https://stackoverflow.com/questions/52220415/genomic-coordinates-of-hgnc-gene-names

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!