This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Adding gene ID in edgeR

I am trying to add genes ID to edgeR results . Below is part of my code. Gene Ids usually comes as NA. I would like to know what could be wrong or how can I add the genes ID. All what I have is transcripts ID, so not sure if the problem is the geneid line, and how to fix? Thanks

data <- readDGE(files)
geneid <-rownames(data)
mart <- useMart("ensembl", dataset="hsapiens_gene_ensembl", host="grch37.ensembl.org", path="/biomart/martservice")
datasets <- listDatasets(mart)
mart <- useDataset("hsapiens_gene_ensembl",mart)
genes <- getBM(attributes=c('ensembl_gene_id', 'external_gene_name'),filters='ensembl_gene_id',values=geneid,mart=mart)
rownames (genes) <- genes$ensembl_gene_id
data$genes <- genes [rownames(data), ]

print (data$genes)

group <- c(rep("WT", 2), rep("Tumor", 2))
dge = DGEList(counts=data, group=group)

dge <- calcNormFactors(dge)
dge <- estimateCommonDisp(dge)
dge <- estimateTagwiseDisp(dge)
rna-seq edger genes id

Show us a few of your input gene IDs. Specifically, we need the ones getting associated with NA.

Everything is NA. This is when I print data (genes). I think the problem is how to connect between transcripts and genes? I think one step is missing but don't know what it is.

NA.49969 NA NA

I don't care what data$genes looks like, you need to post what geneid looks like.

It contains the transcripts ID, which I think is the main reason for the error. So I am missing how to go from transcripts ID to genes ID? [58349] "NR_144568.1" "NR_144569.1" "NR_144628.1" "NR_144629.1"
[58353] "NR_144632.1" "NR_144633.1" "NR_144634.1" "NR_144635.1"
[58357] "NR_144637.1" "NR_144638.1" "NR_144639.1" "NR_144640.1"
[58361] "NR_144641.1" "NR_144642.1" "NR_144643.1" "NR_144644.1"
[58365] "NR_144645.1" "NR_144646.1" "NR_144682.1" "NR_144683.1"
[58369] "NR_144684.1" "NR_144685.1" "NR_144686.1" "NR_144687.1"
[58373] "NR_144688.1" "NR_144752.1" "NR_144755.1" "NR_144756.1"
[58377] "NR_144757.1" "NR_144758.1" "NR_144759.1" "NR_144760.1"

You're searching against biomarts collection of ensembl-gene ids using NCBI transcript IDs as input. Hence the NAs.

I added genes IDs now in another way, but what I am stuck at is the thrown error: ""

Error in exactTest(dge, pair = c("WT", "Tumor")) : dispersion is NA Execution halted

    library(org.Hs.eg.db)   
    group <- c(rep("WT", 2), rep("Tumor", 2))
    dge = DGEList(counts=data, group=group)
    idfound <- dge$genes$RefSeqID %in% mappedRkeys(org.Hs.egREFSEQ)
    dge <- dge[idfound,]
    dim(dge)
    egREFSEQ <- toTable(org.Hs.egREFSEQ)
    head(egREFSEQ)
    m <- match(dge$genes$RefSeqID, egREFSEQ$accession)
    dge$genes$EntrezGene <- egREFSEQ$gene_id[m]
    egSYMBOL <- toTable(org.Hs.egSYMBOL)
    head(egSYMBOL)
    m <- match(dge$genes$EntrezGene, egSYMBOL$gene_id)
    dge$genes$Symbol <- egSYMBOL$symbol[m]
    head(dge$genes)

This is a different issue. Post a question in a separate thread. And could you please post the solution you found to your initial problem within this thread

0 answers

No answers yet.

Log in to answer this question.