clusterProfiler merge_result dotplot
0
1
Entering edit mode
@giovanni-calice-6415
Last seen 5 weeks ago
Italy

Hi all,

I'm trying to visualize some results of an enrichment analysis on two datasets but but I keep having the same error:

> dotplot(merge_dataset_1_and_dataset_2, showCategory = 10)
Error in `$<-.data.frame`(`*tmp*`, "Cluster", value = NA_integer_) : 
  replacement has 1 row, data has 0

The obj mergedataset1anddataset2 is the merge between the gseaResult of dataset1 and the gseaResult of dataset2 on GO MSigDB Collection:

> str(merge_dataset_1_and_dataset_2)
Formal class 'compareClusterResult' [package "clusterProfiler"] with 4 slots
  ..@ compareClusterResult:'data.frame':    11303 obs. of  12 variables:
  .. ..$ Cluster        : Factor w/ 2 levels "Dataset_1","Dataset_2": 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ ID             : chr [1:11303] "GO_CATION_TRANSMEMBRANE_TRANSPORTER_ACTIVITY" "GO_METAL_ION_TRANSMEMBRANE_TRANSPORTER_ACTIVITY" "GO_CHEMICAL_SYNAPTIC_TRANSMISSION_POSTSYNAPTIC" "GO_LEUKOCYTE_APOPTOTIC_PROCESS" ...
  .. ..$ Description    : chr [1:11303] "GO_CATION_TRANSMEMBRANE_TRANSPORTER_ACTIVITY" "GO_METAL_ION_TRANSMEMBRANE_TRANSPORTER_ACTIVITY" "GO_CHEMICAL_SYNAPTIC_TRANSMISSION_POSTSYNAPTIC" "GO_LEUKOCYTE_APOPTOTIC_PROCESS" ...
  .. ..$ setSize        : int [1:11303] 434 281 69 78 31 22 23 21 17 17 ...
  .. ..$ enrichmentScore: num [1:11303] -0.356 -0.353 -0.488 -0.47 -0.635 ...
  .. ..$ NES            : num [1:11303] -1.56 -1.49 -1.75 -1.7 -1.95 ...
  .. ..$ pvalue         : num [1:11303] 0.00113 0.00121 0.00143 0.00144 0.00163 ...
  .. ..$ p.adjust       : num [1:11303] 0.385 0.385 0.385 0.385 0.385 ...
  .. ..$ qvalues        : num [1:11303] 0.373 0.373 0.373 0.373 0.373 ...
  .. ..$ rank           : num [1:11303] 2011 1996 3447 1746 1810 ...
  .. ..$ leading_edge   : chr [1:11303] "tags=20%, list=13%, signal=18%" "tags=20%, list=13%, signal=18%" "tags=39%, list=22%, signal=30%" "tags=26%, list=11%, signal=23%" ...
  .. ..$ core_enrichment: chr [1:11303] "SLC36A2/CNNM2/SLC6A2/SLC45A4/SLC39A14/SLC11A2/SCN3B/CACNA1C/SLC13A2/SLC25A45/KCNJ13/KCNK16/ATP2A3/SLC1A3/KCNB1/"| __truncated__ "CNNM2/SLC6A2/SLC39A14/SLC11A2/SCN3B/CACNA1C/SLC13A2/KCNJ13/KCNK16/ATP2A3/SLC1A3/KCNB1/KCNAB2/KCNA3/SCNN1A/KCNMB"| __truncated__ "MECP2/ZMYND8/GLRB/CHRNA10/ADORA2A/APP/RGS4/MAPK8IP2/ADORA1/EIF4A3/SLC29A1/PPP3CA/OPRM1/P2RX2/GRIN2D/CHRNE/HCRT/"| __truncated__ "TNFRSF4/BAX/PDCD1/CD74/CXCR2/SLC46A2/NFKBID/MEF2C/ANXA1/PTCRA/HIF1A/GAS6/FOXP1/DFFA/NOC2L/MIF/EFNA1/CRKL/MERTK/CTSL" ...
  ..@ geneClusters        : list()
  ..@ fun                 : chr(0) 
  ..@ .call               : language `<undef>`()

Then I repeated processing the clusterProfiler sample code I had seen long ago and the dotplot () of this works well in my session. The structure of the merge_example seems completely similar, the only thing is that in the example the merge is between enrichResult objs:

 > str(merge_example)
Formal class 'compareClusterResult' [package "clusterProfiler"] with 4 slots
  ..@ compareClusterResult:'data.frame':    126 obs. of  10 variables:
  .. ..$ Cluster    : Factor w/ 2 levels "david","clusterProfiler": 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ ID         : chr [1:126] "GO:0006614" "GO:0006613" "GO:0045047" "GO:0072599" ...
  .. ..$ Description: chr [1:126] "SRP-dependent cotranslational protein targeting to membrane" "cotranslational protein targeting to membrane" "protein targeting to ER" "establishment of protein localization to endoplasmic reticulum" ...
  .. ..$ GeneRatio  : chr [1:126] "24/186" "24/186" "24/186" "24/186" ...
  .. ..$ BgRatio    : chr [1:126] "96/16792" "103/16792" "104/16792" "108/16792" ...
  .. ..$ pvalue     : num [1:126] 9.54e-25 5.56e-24 7.07e-24 1.80e-23 1.55e-22 ...
  .. ..$ p.adjust   : num [1:126] 3.05e-21 8.88e-21 7.53e-21 1.44e-20 9.88e-20 ...
  .. ..$ qvalue     : num [1:126] 2.29e-22 5.65e-22 5.65e-22 1.08e-21 7.43e-21 ...
  .. ..$ geneID     : chr [1:126] "ENSG00000174444/ENSG00000198242/ENSG00000188846/ENSG00000166441/ENSG00000198918/ENSG00000105193/ENSG00000148303"| __truncated__ "ENSG00000174444/ENSG00000198242/ENSG00000188846/ENSG00000166441/ENSG00000198918/ENSG00000105193/ENSG00000148303"| __truncated__ "ENSG00000174444/ENSG00000198242/ENSG00000188846/ENSG00000166441/ENSG00000198918/ENSG00000105193/ENSG00000148303"| __truncated__ "ENSG00000174444/ENSG00000198242/ENSG00000188846/ENSG00000166441/ENSG00000198918/ENSG00000105193/ENSG00000148303"| __truncated__ ...
  .. ..$ Count      : int [1:126] 24 24 24 24 28 28 24 27 24 28 ...
  ..@ geneClusters        : list()
  ..@ fun                 : chr(0) 
  ..@ .call               : language `<undef>`()
> dotplot(merge_example, showCategory = 10)

If the two structures are similar, why does the dotplot () on the merge of my analysis fail? What is wrong?

Thanks in advance, Regards Giovanni

> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.6 LTS

Matrix products: default
BLAS:   /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=it_IT.UTF-8          LC_NUMERIC=C                  LC_TIME=it_IT.UTF-8           LC_COLLATE=it_IT.UTF-8       
 [5] LC_MONETARY=it_IT.UTF-8       LC_MESSAGES=it_IT.UTF-8       LC_PAPER=it_IT.UTF-8          LC_NAME=it_IT.UTF-8          
 [9] LC_ADDRESS=it_IT.UTF-8        LC_TELEPHONE=it_IT.UTF-8      LC_MEASUREMENT=it_IT.UTF-8    LC_IDENTIFICATION=it_IT.UTF-8

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

other attached packages:
 [1] openxlsx_4.1.5          RDAVIDWebService_1.24.0 ggplot2_3.3.0           GOstats_2.52.0          Category_2.52.1        
 [6] Matrix_1.2-18           graph_1.64.0            org.Hs.eg.db_3.10.0     AnnotationDbi_1.48.0    IRanges_2.20.2         
[11] S4Vectors_0.24.4        Biobase_2.46.0          BiocGenerics_0.32.0     magrittr_1.5            dplyr_0.8.5            
[16] dbplyr_1.4.4            limma_3.42.2            DOSE_3.12.0             clusterProfiler_3.14.3 

loaded via a namespace (and not attached):
 [1] bitops_1.0-6           enrichplot_1.6.1       bit64_0.9-7            RColorBrewer_1.1-2     progress_1.2.2         httr_1.4.1            
 [7] Rgraphviz_2.30.0       tools_3.6.2            R6_2.4.1               DBI_1.1.0              colorspace_1.4-1       withr_2.2.0           
[13] tidyselect_1.1.0       gridExtra_2.3          prettyunits_1.1.1      bit_1.1-15.2           compiler_3.6.2         cli_2.0.2             
[19] xml2_1.3.2             labeling_0.3           triebeard_0.3.0        scales_1.1.1           genefilter_1.68.0      RBGL_1.62.1           
[25] ggridges_0.5.2         stringr_1.4.0          digest_0.6.25          AnnotationForge_1.28.0 pkgconfig_2.0.3        rlang_0.4.6           
[31] rstudioapi_0.11        RSQLite_2.2.0          gridGraphics_0.5-0     farver_2.0.3           jsonlite_1.6.1         BiocParallel_1.20.1   
[37] zip_2.0.4              GOSemSim_2.12.1        RCurl_1.98-1.2         ggplotify_0.0.5        GO.db_3.10.0           Rcpp_1.0.4.6          
[43] munsell_0.5.0          fansi_0.4.1            viridis_0.5.1          lifecycle_0.2.0        stringi_1.4.6          yaml_2.2.1            
[49] ggraph_2.0.3           MASS_7.3-51.6          plyr_1.8.6             qvalue_2.18.0          grid_3.6.2             blob_1.2.1            
[55] ggrepel_0.8.2          DO.db_2.9              crayon_1.3.4           lattice_0.20-41        graphlayouts_0.7.0     cowplot_1.0.0         
[61] splines_3.6.2          annotate_1.64.0        hms_0.5.3              pillar_1.4.4           fgsea_1.12.0           igraph_1.2.5          
[67] reshape2_1.4.4         fastmatch_1.1-0        XML_3.99-0.3           glue_1.4.1             data.table_1.12.8      BiocManager_1.30.10   
[73] vctrs_0.3.0            tweenr_1.0.1           urltools_1.7.3         gtable_0.3.0           purrr_0.3.4            polyclip_1.10-0       
[79] tidyr_1.1.0            assertthat_0.2.1       ggforce_0.3.1          europepmc_0.3          xtable_1.8-4           tidygraph_1.2.0       
[85] survival_3.1-12        viridisLite_0.3.0      tibble_3.0.1           rJava_0.9-12           rvcheck_0.1.8          memoise_1.1.0         
[91] ellipsis_0.3.1         GSEABase_1.48.0    
clusterProfiler • 1.3k views
ADD COMMENT
0
Entering edit mode

Did you find a solution for this? I've also run into the exact same problem using merge_result on two gseaResult objects.

ADD REPLY

Login before adding your answer.

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