datapplab / SBGNview

25 stars 8 forks source link

Error in changeDataId Function when Mapping Symbols to pathwayCommons #15

Open nvelden opened 1 year ago

nvelden commented 1 year ago

An error is encountered in the provided code when the changeDataId function is used to map gene data from "symbol" to "pathwayCommons". However, mapping from "symbol" to "entrez" and then to "pathwayCommons" works, so I think this is a bug.

library(SBGNview)
#> Loading required package: pathview
#> 
#> ##############################################################################
#> Pathview is an open source software package distributed under GNU General
#> Public License version 3 (GPLv3). Details of GPLv3 is available at
#> http://www.gnu.org/licenses/gpl-3.0.html. Particullary, users are required to
#> formally cite the original Pathview paper (not just mention it) in publications
#> or products. For details, do citation("pathview") within R.
#> 
#> The pathview downloads and uses KEGG data. Non-academic uses may require a KEGG
#> license agreement (details at http://www.kegg.jp/kegg/legal.html).
#> ##############################################################################
#> Loading required package: SBGNview.data
#> ##############################################################################
#> SBGNview is an open source software package distributed under GNU General
#> Public License version 3 (GPLv3). Details of GPLv3 is available at
#> http://www.gnu.org/licenses/gpl-3.0.html.
#> 
#> Users are required to formally cite the SBGNview paper and Pathview paper (not
#> just mention them) in publications or products. For details, do
#> 'citation("SBGNview"); citation("Pathview")' within R.
#> ##############################################################################

#Load data
gene.data <- gse16873.d

# Map entrez to pathwayCommons
gene.data.entrez.to.pathwayCommons <- changeDataId(gene.data,
                                  input.type = "entrez",
                                  output.type = "pathwayCommons",
                                  mol.type = "gene",
                                  sum.method = "sum")
#> 
#> hsa_ENTREZID_pathwayCommons mapping table loaded from SBGNview.data
#> Changing data IDs
#> Finished changing data IDs
head(gene.data.entrez.to.pathwayCommons, 5)
#>                                                                                       DCIS_1
#> Protein_000250be0b7ce9123ef439995f26fa1e                                           0.3209480
#> Protein_0002d93f5ea4dd15ef9852f0d2ae15cc                                           0.2479337
#> Protein_000b5881617c17b2c87c72bc3585c252                                           0.3344750
#> Protein_000be815679a2fe779da5eb31081ba20                                          -0.2698879
#> Protein_000be815679a2fe779da5eb31081ba20_Complex_855d843284bb4f558426811e0ce43095 -0.2698879
#>                                                                                        DCIS_2
#> Protein_000250be0b7ce9123ef439995f26fa1e                                          -0.32585772
#> Protein_0002d93f5ea4dd15ef9852f0d2ae15cc                                           1.03972870
#> Protein_000b5881617c17b2c87c72bc3585c252                                           0.35504432
#> Protein_000be815679a2fe779da5eb31081ba20                                           0.04336225
#> Protein_000be815679a2fe779da5eb31081ba20_Complex_855d843284bb4f558426811e0ce43095  0.04336225
#>                                                                                       DCIS_3
#> Protein_000250be0b7ce9123ef439995f26fa1e                                          -0.1627042
#> Protein_0002d93f5ea4dd15ef9852f0d2ae15cc                                           0.1227578
#> Protein_000b5881617c17b2c87c72bc3585c252                                           0.2104026
#> Protein_000be815679a2fe779da5eb31081ba20                                           0.1431029
#> Protein_000be815679a2fe779da5eb31081ba20_Complex_855d843284bb4f558426811e0ce43095  0.1431029
#>                                                                                       DCIS_4
#> Protein_000250be0b7ce9123ef439995f26fa1e                                           0.2740461
#> Protein_0002d93f5ea4dd15ef9852f0d2ae15cc                                          -0.3604340
#> Protein_000b5881617c17b2c87c72bc3585c252                                          -0.1034979
#> Protein_000be815679a2fe779da5eb31081ba20                                           0.2115067
#> Protein_000be815679a2fe779da5eb31081ba20_Complex_855d843284bb4f558426811e0ce43095  0.2115067
#>                                                                                        DCIS_5
#> Protein_000250be0b7ce9123ef439995f26fa1e                                           0.30930810
#> Protein_0002d93f5ea4dd15ef9852f0d2ae15cc                                           0.18060937
#> Protein_000b5881617c17b2c87c72bc3585c252                                           0.47849178
#> Protein_000be815679a2fe779da5eb31081ba20                                          -0.08359934
#> Protein_000be815679a2fe779da5eb31081ba20_Complex_855d843284bb4f558426811e0ce43095 -0.08359934
#>                                                                                       DCIS_6
#> Protein_000250be0b7ce9123ef439995f26fa1e                                          0.28478271
#> Protein_0002d93f5ea4dd15ef9852f0d2ae15cc                                          0.11317578
#> Protein_000b5881617c17b2c87c72bc3585c252                                          0.09148291
#> Protein_000be815679a2fe779da5eb31081ba20                                          0.11285730
#> Protein_000be815679a2fe779da5eb31081ba20_Complex_855d843284bb4f558426811e0ce43095 0.11285730

# Map entrez to symbol
gene.data.entrez.to.symbols <- changeDataId(gene.data,
                          input.type = "entrez",
                          output.type = "symbol",
                          mol.type = "gene",
                          sum.method = "sum")
#> 
#> Generating mapping using Pathview
#> 
#> ID mapping not pre-generated
#> Mapping: ENTREZID, symbol
#> 'select()' returned 1:1 mapping between keys and columns
#> [1] "Note: 136 of 11979 unique input IDs unmapped."
#> Changing data IDs
#> Finished changing data IDs
head(gene.data.entrez.to.symbols , 5)
#>              DCIS_1       DCIS_2      DCIS_3       DCIS_4      DCIS_5
#> A1CF    0.005634741 -0.007154708  0.08461335 -0.002498477 -0.02486110
#> A2M     0.063928476 -1.407243562 -0.11532037 -1.364733407 -1.17499147
#> A4GALT  0.069798856  0.035496296  0.02984971 -0.107390271 -0.08307566
#> A4GNT  -0.221460129  0.044872809  0.05547348 -0.028840867 -0.05907705
#> AAAS   -0.118385905 -0.051635875 -0.13042244 -0.161630790  0.05169151
#>             DCIS_6
#> A1CF    0.01359610
#> A2M    -0.56069215
#> A4GALT  0.09333546
#> A4GNT  -0.01005320
#> AAAS    0.03947178

# Map symbol to pathwayCommons
gene.data.symbol.to.pathwayCommons <- changeDataId(data.input.id = gene.data.symbols,
                                  input.type = "symbol",
                                  output.type = "pathwayCommons",
                                  mol.type = "gene",
                                  sum.method = "sum")
#> Error in changeDataId(data.input.id = gene.data.symbols, input.type = "symbol", : object 'gene.data.symbols' not found
head(gene.data.symbol.to.pathwayCommons, 5)
#> Error in head(gene.data.symbol.to.pathwayCommons, 5): object 'gene.data.symbol.to.pathwayCommons' not found

Created on 2023-05-23 with reprex v2.0.2


`
loaded via a namespace (and not attached):
  [1] tidyr_1.3.0            bit64_4.0.5            knitr_1.42             DelayedArray_0.24.0    rpart_4.1.19          
  [6] KEGGREST_1.38.0        RCurl_1.98-1.12        doParallel_1.0.17      generics_0.1.3         callr_3.7.3           
 [11] cowplot_1.1.1          RSQLite_2.3.1          shadowtext_0.1.2       bit_4.0.5              enrichplot_1.18.4     
 [16] webshot_0.5.4          xml2_1.3.4             httpuv_1.6.11          assertthat_0.2.1       fontawesome_0.5.1     
 [21] xfun_0.39              jquerylib_0.1.4        babelgene_22.9         evaluate_0.21          promises_1.2.0.1      
 [26] TSP_1.2-4              fansi_1.0.4            caTools_1.18.2         dendextend_1.17.1      Rgraphviz_2.42.0      
 [31] DBI_1.1.3              geneplotter_1.76.0     htmlwidgets_1.6.2      stringdist_0.9.10      purrr_1.0.1           
 [36] ellipsis_0.3.2         crosstalk_1.2.0        backports_1.4.1        annotate_1.76.0        vctrs_0.6.2           
 [41] abind_1.4-5            cachem_1.0.8           withr_2.5.0            ggforce_0.4.1          HDO.db_0.99.1         
 [46] checkmate_2.2.0        treeio_1.22.0          cluster_2.1.4          DOSE_3.24.2            ape_5.7-1             
 [51] lazyeval_0.2.2         labeling_0.4.2         edgeR_3.40.2           pkgconfig_2.0.3        tweenr_2.0.2          
 [56] seriation_1.4.2        nnet_7.3-19            rlang_1.1.1            lifecycle_1.0.3        downloader_0.4        
 [61] registry_0.5-1         dichromat_2.0-0.1      rsvg_2.4.0             polyclip_1.10-4        graph_1.76.0          
 [66] Matrix_1.5-4.1         aplot_0.1.10           org.Mmu.eg.db_3.16.0   base64enc_0.1-3        processx_3.8.1        
 [71] GlobalOptions_0.1.2    png_0.1-8              rjson_0.2.21           ca_0.71.1              bitops_1.0-7          
 [76] gson_0.1.0             KernSmooth_2.23-21     Biostrings_2.66.0      blob_1.2.4             shape_1.4.6           
 [81] qvalue_2.30.0          gridGraphics_0.5-1     ggsignif_0.6.4         scales_1.2.1           memoise_2.0.1         
 [86] magrittr_2.0.3         zlibbioc_1.44.0        compiler_4.2.1         scatterpie_0.1.9       clue_0.3-64           
 [91] KEGGgraph_1.58.3       cli_3.6.1              XVector_0.38.0         ps_1.7.5               patchwork_1.1.2       
 [96] htmlTable_2.4.1        Formula_1.2-5          MASS_7.3-60            tidyselect_1.2.0       yaml_2.3.7            
[101] GOSemSim_2.24.0        locfit_1.5-9.7         sass_0.4.6             fastmatch_1.1-3        tools_4.2.1           
[106] rstudioapi_0.14        foreach_1.5.2          foreign_0.8-84         farver_2.1.1           ggraph_2.1.0          
[111] digest_0.6.31          BiocManager_1.30.20    Rcpp_1.0.10            broom_1.0.4            later_1.3.1           
[116] org.Hs.eg.db_3.16.0    httr_1.4.6             AnnotationDbi_1.60.2   Rdpack_2.4             colorspace_2.1-0      
[121] fs_1.6.2               XML_3.99-0.14          splines_4.2.1          yulab.utils_0.0.6      tidytree_0.4.2        
[126] graphlayouts_1.0.0     renv_0.17.3            mapproj_1.2.11         ggplotify_0.1.0        xtable_1.8-4          
[131] jsonlite_1.8.4         ggtree_3.6.2           tidygraph_1.2.3        ggfun_0.0.9            R6_2.5.1              
[136] pillar_1.9.0           htmltools_0.5.5        mime_0.12              glue_1.6.2             fastmap_1.1.1         
[141] clusterProfiler_4.6.2  codetools_0.2-19       maps_3.4.1             fgsea_1.24.0           utf8_1.2.3            
[146] bslib_0.4.2            lattice_0.21-8         tibble_3.2.1           curl_5.0.0             gtools_3.9.4          
[151] clipr_0.8.0            Rttf2pt1_1.3.12        zip_2.3.0              GO.db_3.16.0           limma_3.54.2          
[156] survival_3.5-5         rmarkdown_2.21         munsell_0.5.0          GetoptLong_1.0.5       GenomeInfoDbData_1.2.9
[161] iterators_1.0.14       gtable_0.3.3           msigdbr_7.5.1          rbibutils_2.2.13  
`
raw937 commented 1 year ago

Are you still having this issue? Let me know?

This project is no longer under development here. Please check the new fork here. https://github.com/Kannapolis-Bioinformatics/SBGNview

If you have the same issues place in https://github.com/Kannapolis-Bioinformatics/SBGNview/issues.

many thanks, Rick

nvelden commented 1 year ago

I still have the same issue. The link you provided goes to pull request. I don't see an option to open an issue. Is it switched off in the repository?

raw937 commented 1 year ago

Fixed now