Deleted:Converting Ensembl to ENTREZ or GENE Symbol IDs as rowname
1
0
Entering edit mode
Manav • 0
@6c392f63
Last seen 3.1 years ago
United States

Hello, I am a beginner in using R as a tool for RNA seq analysis. I have used the edgeR package to get the differentially expressed. I am able to add the ENTREZ ID as a new column. However, I want to change the rownames of "degs" from ENSEMBL to ENTREZ ID, instead of adding it to a new column. I am attaching the whole code that I have written so far by referring to the edgeR manual. I plan to do the GO and KEGG analysis next. Any help or directions is highly appreciated. Thank you.


# Loading the data
data<- read.csv("gene_count_matrix.csv", header = T, row.names = 1L)
pheno<- read.csv("pheno_sheet.csv", header = T, row.names = 1L)

# Loading data in edgeR and normalizing it
dge<- DGEList(counts=data, group = pheno$Sample)
dge<- calcNormFactors(dge)
cpm<- cpm(dge, log=T)

# Filtering low count genes
keep<- filterByExpr(dge)
dge<- dge[keep,,keep.lib.sizes=FALSE]

# Differential Expression
design<- model.matrix(~pheno$Sample) # row names are 1,2,..8
rownames(design) =colnames(data) # change rownames
dge<- estimateDisp(dge, design)
fit<- glmQLFit(dge, design)
qlf<- glmQLFTest(fit, design)
degs<- topTags(qlf, n=Inf)
degs<- data.frame(degs[["table"]]) # Makes table of results of DGE

# Adding ENTREZ ID to degs as a new column
degs$ENTREZID<- mapIds(org.Mm.eg.db, keys = rownames(degs), keytype = "ENSEMBL", column = "ENTREZID")



sessionInfo( )
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    
system code page: 65001

attached base packages:
[1] stats4    stats     graphics  grDevices utils    
[6] datasets  methods   base     

other attached packages:
[1] org.Mm.eg.db_3.14.0  AnnotationDbi_1.56.2
[3] IRanges_2.28.0       S4Vectors_0.32.3    
[5] Biobase_2.54.0       BiocGenerics_0.40.0 
[7] edgeR_3.36.0         limma_3.50.0        

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8             compiler_4.1.2        
 [3] GenomeInfoDb_1.30.1    XVector_0.34.0        
 [5] bitops_1.0-7           tools_4.1.2           
 [7] zlibbioc_1.40.0        bit_4.0.4             
 [9] RSQLite_2.2.9          memoise_2.0.1         
[11] lattice_0.20-45        pkgconfig_2.0.3       
[13] png_0.1-7              rlang_1.0.1           
[15] DBI_1.1.2              cli_3.1.1             
[17] rstudioapi_0.13        fastmap_1.1.0         
[19] GenomeInfoDbData_1.2.7 httr_1.4.2            
[21] Biostrings_2.62.0      vctrs_0.3.8           
[23] locfit_1.5-9.4         bit64_4.0.5           
[25] grid_4.1.2             R6_2.5.1              
[27] blob_1.2.2             splines_4.1.2         
[29] KEGGREST_1.34.0        RCurl_1.98-1.5        
[31] cachem_1.0.6           crayon_1.4.2
AnnotationData • 1.3k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 938 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