ncborcherding / scRepertoire

A toolkit for single-cell immune profiling
https://www.borch.dev/uploads/screpertoire/
MIT License
306 stars 52 forks source link

compareClonotypes not plotting geom_stratum() #217

Closed david-priest closed 1 year ago

david-priest commented 1 year ago

Hi there,

Thanks for your great package and support.

When I tried to run compareClonotypes(), it did not plot the geom_stratum(). However if I changed it to geom_stratum(stat = "alluvium"), it worked.

Best, David

ncborcherding commented 1 year ago

Hey David,

Thanks for reaching out -

Would you mind letting me know the version you are using? Also would you mind giving me the full call for the compareClonotypes() with the additional layer? That might help!

Nick

david-priest commented 1 year ago

Hi Nick,

Below is sessionInfo().

Here is the call:

p <- compareClonotypes(combined, 
                  numbers = 10, 
                  samples = c("sample1", "sample2"), 
                  cloneCall="strict", 
                  graph = "alluvial",
                  exportTable = F)

p

Did you see any effect of updating the geom_stratum() in the function to include stat = "alluvium"?

Thanks, David


Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] scRepertoire_1.8.0 ggplot2_3.4.0      dplyr_1.1.0        cowplot_1.1.1      hdf5r_1.3.8        patchwork_1.1.2    Matrix_1.5-3       Seurat_4.3.0       SeuratObject_4.1.3 sp_1.6-0          

loaded via a namespace (and not attached):
  [1] SparseM_1.81                scattermore_0.8             evmix_2.12                  tidyr_1.3.0                 bit64_4.0.5                 knitr_1.42                  irlba_2.3.5.1               multcomp_1.4-20            
  [9] DelayedArray_0.24.0         data.table_1.14.6           RCurl_1.98-1.10             doParallel_1.0.17           generics_0.1.3              flowCore_2.10.0             BiocGenerics_0.44.0         ScaledMatrix_1.6.0         
 [17] TH.data_1.1-1               VGAM_1.1-7                  RANN_2.6.1                  future_1.30.0               bit_4.0.5                   spatstat.data_3.0-0         httpuv_1.6.8                SummarizedExperiment_1.28.0
 [25] viridis_0.6.2               xfun_0.36                   evaluate_0.20               promises_1.2.0.1            fansi_1.0.4                 readxl_1.4.1                igraph_1.3.5                DBI_1.1.3                  
 [33] CATALYST_1.22.0             htmlwidgets_1.6.1           powerTCR_1.18.0             spatstat.geom_3.0-5         stringdist_0.9.10           stats4_4.2.2                purrr_1.0.1                 ellipsis_0.3.2             
 [41] ggnewscale_0.4.8            ggpubr_0.5.0                backports_1.4.1             cytolib_2.10.0              permute_0.9-7               deldir_1.0-6                sparseMatrixStats_1.10.0    MatrixGenerics_1.10.0      
 [49] vctrs_0.5.2                 SingleCellExperiment_1.20.0 ggalluvial_0.12.3           Biobase_2.58.0              ROCR_1.0-11                 abind_1.4-5                 withr_2.5.0                 ggforce_0.4.1              
 [57] progressr_0.13.0            sctransform_0.3.5           vegan_2.6-4                 goftest_1.2-3               cluster_2.1.4               gsl_2.1-8                   lazyeval_0.2.2              crayon_1.5.2               
 [65] drc_3.0-1                   spatstat.explore_3.0-6      labeling_0.4.2              pkgconfig_2.0.3             tweenr_2.0.2                GenomeInfoDb_1.34.7         nlme_3.1-161                vipor_0.4.5                
 [73] rlang_1.0.6                 globals_0.16.2              lifecycle_1.0.3             miniUI_0.1.1.1              sandwich_3.0-2              rsvd_1.0.5                  ggrastr_1.0.1               cellranger_1.1.0           
 [81] polyclip_1.10-4             matrixStats_0.63.0          lmtest_0.9-40               carData_3.0-5               zoo_1.8-11                  beeswarm_0.4.0              ggridges_0.5.4              GlobalOptions_0.1.2        
 [89] png_0.1-8                   viridisLite_0.4.1           rjson_0.2.21                bitops_1.0-7                ConsensusClusterPlus_1.62.0 KernSmooth_2.23-20          DelayedMatrixStats_1.20.0   shape_1.4.6                
 [97] stringr_1.5.0               parallelly_1.34.0           spatstat.random_3.1-3       rstatix_0.7.1               S4Vectors_0.36.1            ggsignif_0.6.4              beachmat_2.14.0             scales_1.2.1               
[105] magrittr_2.0.3              plyr_1.8.8                  ica_1.0-3                   zlibbioc_1.44.0             compiler_4.2.2              RColorBrewer_1.1-3          plotrix_3.8-2               clue_0.3-63                
[113] fitdistrplus_1.1-8          cli_3.6.0                   XVector_0.38.0              listenv_0.9.0               pbapply_1.7-0               FlowSOM_2.6.0               mgcv_1.8-41                 MASS_7.3-58.2              
[121] tidyselect_1.2.0            stringi_1.7.12              RProtoBufLib_2.10.0         yaml_2.3.7                  BiocSingular_1.14.0         ggrepel_0.9.2               tools_4.2.2                 future.apply_1.10.0        
[129] parallel_4.2.2              circlize_0.4.15             rstudioapi_0.14             foreach_1.5.2               gridExtra_2.3               cubature_2.0.4.6            farver_2.1.1                Rtsne_0.16                 
[137] ggraph_2.1.0                rgeos_0.6-1                 digest_0.6.31               shiny_1.7.4                 Rcpp_1.0.10                 GenomicRanges_1.50.2        car_3.1-1                   broom_1.0.3                
[145] scuttle_1.8.4               later_1.3.0                 RcppAnnoy_0.0.20            httr_1.4.4                  ComplexHeatmap_2.14.0       colorspace_2.1-0            XML_3.99-0.13               tensor_1.5                 
[153] reticulate_1.28             IRanges_2.32.0              splines_4.2.2               uwot_0.1.14                 spatstat.utils_3.0-1        scater_1.26.1               graphlayouts_0.8.4          plotly_4.10.1              
[161] xtable_1.8-4                jsonlite_1.8.4              truncdist_1.0-2             tidygraph_1.2.2             R6_2.5.1                    pillar_1.8.1                htmltools_0.5.4             mime_0.12                  
[169] nnls_1.4                    glue_1.6.2                  fastmap_1.1.0               BiocParallel_1.32.5         BiocNeighbors_1.16.0        codetools_0.2-18            mvtnorm_1.1-3               utf8_1.2.2                 
[177] lattice_0.20-45             spatstat.sparse_3.0-0       tibble_3.1.8                evd_2.3-6.1                 ggbeeswarm_0.7.1            leiden_0.4.3                colorRamps_2.3.1            gtools_3.9.4               
[185] survival_3.5-0              rmarkdown_2.20              munsell_0.5.0               GetoptLong_1.0.5            GenomeInfoDbData_1.2.9      iterators_1.0.14            reshape2_1.4.4              gtable_0.3.1 ```
ncborcherding commented 1 year ago

Hey David,

I am a little confused here - below is the exact code from the version of scRepertoire you are running. The stat = "alluvium" is actually referring to the geom_flow() and should have no affect on geom_stratum().

plot <- ggplot(Con.df, aes(x = Sample, fill = Clonotypes, group = Clonotypes,
                    stratum = Clonotypes, alluvium = Clonotypes, 
                    y = Proportion, label = Clonotypes)) +
                theme_classic() +
                theme(axis.title.x = element_blank())
    if (graph == "alluvial") {
        plot = plot +  geom_stratum() + geom_flow(stat = "alluvium")
    }

Using the vignette data - I get the same exact output from the normal call compareClonotypes() and compareClonotypes() + geom_stratum(stat = "alluvium")

image

compareClonotypes(combined, 
                  numbers = 10, 
                  samples = c("PX_P", "PX_T"), 
                   cloneCall="aa", 
                   graph = "alluvial") + 
   geom_stratum(stat = "alluvium")

image

compareClonotypes(combined, 
                   numbers = 10, 
                   samples = c("PX_P", "PX_T"), 
                   cloneCall="aa", 
                   graph = "alluvial") 

So I have not identified your issue with compareClonotype(). I know your data is anonymized but could you send me a cropped image of what you are talking about with the two versions of compareClonotype() calls?

Thanks, Nick

david-priest commented 1 year ago

Hi Nick,

Thanks again for your help. I've attached a screenshot. Note that I'm also getting this issue with alluvialClonotypes(), however going into the function and editing it to geom_stratum(stat = "alluvium"), did not change the result. I suspect it may be an issue with my setup or with ggalluvial() (arm64 architecture?).

compare clonotypes

ncborcherding commented 1 year ago

Hey David,

I still have not been able to replicate this issue. I did see a similar error message recently posted on the rstudio community page - which was fixed by updating available R packages.

Nick

david-priest commented 1 year ago

Hi Nick,

Ok thanks for your help. Hopefully problem will resolve itself with updates to Rstudio etc.

David