change a column within a DESeq results object
0
0
Entering edit mode
Matt • 0
@b0a618e7
Last seen 18 months ago
United States

Error : Error in .testForValidKeys(x, keys, keytype, fks) :

None of the keys entered are valid keys for 'MGI'. Please use the keys method to see a listing of valid arguments.

#Gene ID using AnnotationDBi

counts_Ji = read.table("Raw_count_ControlvsLPS.txt",header=T)

counts_Ji = as.data.frame(Analysis_LPSvsSYN_allgene) #already df

counts_Ji = mapIds(org.Mm.eg.db, keys=rownames(counts_Ji), keytype = "MGI", column=c("SYMBOL"))

keytypes(org.Mm.eg.db)



sessionInfo( )

```R version 4.1.3 (2022-03-10)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 19042)



Matrix products: default



locale:

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  

[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                         

[5] LC_TIME=English_United States.1252   



attached base packages:

[1] stats4    stats     graphics  grDevices utils     datasets  methods   base    



other attached packages:

[1] ReportingTools_2.34.0       knitr_1.39                  EnhancedVolcano_1.12.0      ggrepel_0.9.1             

 [5] gplots_3.1.3                ggplot2_3.3.6               dplyr_1.0.9                 pheatmap_1.0.12           

 [9] DESeq2_1.34.0               SummarizedExperiment_1.24.0 MatrixGenerics_1.6.0        matrixStats_0.62.0        

[13] org.Mm.eg.db_3.14.0         AnnotationForge_1.36.0      ensembldb_2.18.4            AnnotationFilter_1.18.0   

[17] GenomicFeatures_1.46.5      AnnotationDbi_1.56.2        Biobase_2.54.0              GenomicRanges_1.46.1      

[21] GenomeInfoDb_1.30.1         IRanges_2.28.0              S4Vectors_0.32.4            AnnotationHub_3.2.2       

[25] BiocFileCache_2.2.1         dbplyr_2.2.0                BiocGenerics_0.40.0       



loaded via a namespace (and not attached):

  [1] utf8_1.2.2                    R.utils_2.11.0                tidyselect_1.1.2            

  [4] RSQLite_2.2.14                htmlwidgets_1.5.4             grid_4.1.3                  

  [7] BiocParallel_1.28.3           munsell_0.5.0                 withr_2.5.0                 

 [10] colorspace_2.0-3              Category_2.60.0               filelock_1.0.2              

 [13] OrganismDbi_1.36.0            ggalt_0.4.0                   rstudioapi_0.13             

 [16] Rttf2pt1_1.3.10               labeling_0.4.2                GenomeInfoDbData_1.2.7      

 [19] hwriter_1.3.2.1               bit64_4.0.5                   farver_2.1.0                

 [22] vctrs_0.4.1                   generics_0.1.2                xfun_0.31                   

 [25] biovizBase_1.42.0             R6_2.5.1                      ggbeeswarm_0.6.0            

 [28] locfit_1.5-9.5                bitops_1.0-7                  cachem_1.0.6                

 [31] reshape_0.8.9                 DelayedArray_0.20.0           assertthat_0.2.1            

 [34] promises_1.2.0.1              BiocIO_1.4.0                  scales_1.2.0                

 [37] nnet_7.3-17                   beeswarm_0.4.0                gtable_0.3.0                

 [40] ash_1.0-15                    ggbio_1.42.0                  rlang_1.0.2                 

 [43] genefilter_1.76.0             splines_4.1.3                 rtracklayer_1.54.0          

 [46] extrafontdb_1.0               lazyeval_0.2.2                dichromat_2.0-0.1           

 [49] checkmate_2.1.0               BiocManager_1.30.18           yaml_2.3.5                  

 [52] reshape2_1.4.4                backports_1.4.1               httpuv_1.6.5                

 [55] Hmisc_4.7-0                   RBGL_1.70.0                   extrafont_0.18              

 [58] tools_4.1.3                   ellipsis_0.3.2                RColorBrewer_1.1-3          

 [61] Rcpp_1.0.8.3                  plyr_1.8.7                    base64enc_0.1-3             

 [64] progress_1.2.2                zlibbioc_1.40.0               purrr_0.3.4                 

 [67] RCurl_1.98-1.6                prettyunits_1.1.1             rpart_4.1.16                

 [70] cluster_2.1.2                 magrittr_2.0.3                data.table_1.14.2           

 [73] ProtGenerics_1.26.0           hms_1.1.1                     mime_0.12                   

 [76] xtable_1.8-4                  XML_3.99-0.9                  jpeg_0.1-9                  

 [79] gridExtra_2.3                 compiler_4.1.3                biomaRt_2.50.3              

 [82] tibble_3.1.7                  maps_3.4.0                    KernSmooth_2.23-20          

 [85] crayon_1.5.1                  R.oo_1.24.0                   htmltools_0.5.2             

 [88] GOstats_2.60.0                later_1.3.0                   Formula_1.2-4               

 [91] geneplotter_1.72.0            DBI_1.1.2                     proj4_1.0-11                

 [94] MASS_7.3-55                   rappdirs_0.3.3                Matrix_1.4-0                

 [97] cli_3.3.0                     R.methodsS3_1.8.1             parallel_4.1.3              

[100] pkgconfig_2.0.3               GenomicAlignments_1.30.0      foreign_0.8-82              

[103] xml2_1.3.3                    annotate_1.72.0               vipor_0.4.5                 

[106] XVector_0.34.0                stringr_1.4.0                 VariantAnnotation_1.40.0    

[109] digest_0.6.29                 graph_1.72.0                  Biostrings_2.62.0           

[112] htmlTable_2.4.0               edgeR_3.36.0                  GSEABase_1.56.0             

[115] restfulr_0.0.13               curl_4.3.2                    shiny_1.7.1                 

[118] Rsamtools_2.10.0              gtools_3.9.2.1                rjson_0.2.21                

[121] lifecycle_1.0.1               PFAM.db_3.14.0                limma_3.50.3                

[124] BSgenome_1.62.0               fansi_1.0.3                   pillar_1.7.0                

[127] lattice_0.20-45               GGally_2.1.2                  ggrastr_1.0.1               

[130] KEGGREST_1.34.0               fastmap_1.1.0                 httr_1.4.3                  

[133] survival_3.2-13               GO.db_3.14.0                  interactiveDisplayBase_1.32.0

[136] glue_1.6.2                    png_0.1-7                     BiocVersion_3.14.0          

[139] bit_4.0.4                     Rgraphviz_2.38.0              stringi_1.7.6               

[142] blob_1.2.3                    latticeExtra_0.6-29           caTools_1.18.2              

[145] memoise_2.0.1
EnhancedVolcano • 869 views
ADD COMMENT
0
Entering edit mode

Could you elaborate a bit more the problem ? The title of the post does not fit with the code provided

ADD REPLY
0
Entering edit mode

Yes I am sorry I must have accidentally forgot to change the title. I am trying to get the gene symbols based on ENSEMBL ID using AnnotationDbi. However it says the keytype I am using is not valid. Which is not true. I have used the listkey function and copied the output I want (ENSEMBL) yet I get there error which is above. You will notice I also tried to use keytype "MGI" which is also invalid.

ADD REPLY
0
Entering edit mode

Few remarks:

** keytypes will allow you to check what you can query org.Mm.eg.db with. ENSEMBL (3rd keytype) is to be used when having ENSEMBL IDs, and SYMBOL the column to retrieve gene symbols.

** Note that org.Mm.eg.db contains annotation info that is NCBI-based. So if you have used ENSEMBL/GENCODE-based FASTA and GTF files used for mapping your sequence reads, I would recommend to rather use ENSEMBL-based (EnsDb) annotations (by doing so you thus 'stay' in the same eco-system).

> ensids <- c("ENSMUSG00000000001", "ENSMUSG00000000003", "ENSMUSG00000000028",
+             "ENSMUSG00000000031", "ENSMUSG00000000037", "ENSMUSG00000000049")
> 
> # using org.Mm.eg.db (= based on NCBI gene IDs)
> library(org.Mm.eg.db)
> keytypes(org.Mm.eg.db)
 [1] "ACCNUM"       "ALIAS"        "ENSEMBL"      "ENSEMBLPROT" 
 [5] "ENSEMBLTRANS" "ENTREZID"     "ENZYME"       "EVIDENCE"    
 [9] "EVIDENCEALL"  "GENENAME"     "GENETYPE"     "GO"          
[13] "GOALL"        "IPI"          "MGI"          "ONTOLOGY"    
[17] "ONTOLOGYALL"  "PATH"         "PFAM"         "PMID"        
[21] "PROSITE"      "REFSEQ"       "SYMBOL"       "UNIPROT"     
> 
> mapIds(org.Mm.eg.db, keys=ensids, keytype = "ENSEMBL", column=c("SYMBOL"))
'select()' returned 1:1 mapping between keys and columns
ENSMUSG00000000001 ENSMUSG00000000003 ENSMUSG00000000028 ENSMUSG00000000031 
           "Gnai3"             "Pbsn"            "Cdc45"              "H19" 
ENSMUSG00000000037 ENSMUSG00000000049 
           "Scml2"             "Apoh" 
> 
> 
> # using EnsDb.Mmusculus.v106 (= based on ENSEMBL IDs)
> library(EnsDb.Mmusculus.v106)
> AnnotationDbi:::select(EnsDb.Mmusculus.v106, keys = ensids, keytype = "GENEID",
+     columns = c("SYMBOL") )
              GENEID SYMBOL
1 ENSMUSG00000000001  Gnai3
2 ENSMUSG00000000003   Pbsn
3 ENSMUSG00000000028  Cdc45
4 ENSMUSG00000000031    H19
5 ENSMUSG00000000037  Scml2
6 ENSMUSG00000000049   Apoh
>

If you would like to use the EnsDb, have a look at this post, and the ones linked to in that post. ENSEMBL to gene symbol

ADD REPLY

Login before adding your answer.

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