How can I retrieve the gene names of my count matrix?
1
0
Entering edit mode
@johnsonn573-14932
Last seen 6.2 years ago

I'm using the code below to create a matrix of counts. The resulting matrix has 25221 rows and I'm wondering how I can retrieve the gene names for each row. 

source("https://bioconductor.org/biocLite.R")

biocLite("TxDb.Hsapiens.UCSC.hg38.knownGene")
library("TxDb.Hsapiens.UCSC.hg38.knownGene")
biocLite("GenomicFeatures")
library("GenomicFeatures")
biocLite("Rsamtools",suppressUpdates=TRUE,suppressAutoUpdate=TRUE)
library("Rsamtools")

filenames=list.files()
bamfiles <- BamFileList(filenames, yieldSize=2000000)

txdb=TxDb.Hsapiens.UCSC.hg38.knownGene
ebg <- exonsBy(txdb, by="gene")
se <- summarizeOverlaps(features=ebg, reads=bamfiles,
                        mode="Union",
                        singleEnd=TRUE,
                        ignore.strand=TRUE)

counts=assay(se)

 

 

> head(rownames(counts))

[1] "1" "10" "100" "1000" "10000" "100008587"

rnaseq summarizeoverlaps count matrix • 1.9k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 27 minutes ago
United States
library(org.Hs.eg.db)
geneNames <- mapIds(org.Hs.eg.db, rownames(counts), "SYMBOL","ENTREZID")

 

ADD COMMENT

Login before adding your answer.

Traffic: 718 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