Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clonalCompare does not permit chain="TRB" but rather chain="TRG" and TRA only. #308

Closed
denvercal1234GitHub opened this issue Jan 18, 2024 · 6 comments
Labels
more info needed Waiting on more information

Comments

@denvercal1234GitHub
Copy link

denvercal1234GitHub commented Jan 18, 2024

Hi, Nick,

I was wondering why clonalCompare only can plot TRA and TRG but not TRB for TCRab data?

Also, group.by plots by sample regard of whatever column name is used for this argument.

Would you mind taking a look?

Thank you again!

###### When doing TRB, error
###### When doing TRG, it worked although there is no TRG in my data
Error in str_split(dat[, cloneCall], "_", simplify = TRUE)[, x] : 
  subscript out of bounds
@ncborcherding
Copy link
Member

Hey Quang -

What version of scRepertoire are you using?

Can you make a reproducible example with the built-in data?

Thanks,
Nick

@denvercal1234GitHub
Copy link
Author

denvercal1234GitHub commented Jan 18, 2024

Will make one soon.

It is 2.0.0

Thanks Nick.

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: Europe/London
tzcode source: internal

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

other attached packages:
[1] cowplot_1.1.2      scRepertoire_2.0.0 tidyr_1.3.0        viridis_0.6.4      viridisLite_0.4.2  ggplot2_3.4.4      gridExtra_2.3     

loaded via a namespace (and not attached):
  [1] hash_2.2.6.3                    igraph_1.6.0                    graph_1.78.0                    ica_1.0-3                      
  [5] plotly_4.10.4                   rematch2_2.1.2                  SingleR_2.2.0                   scater_1.28.0                  
  [9] devtools_2.4.5                  zlibbioc_1.48.0                 tidyselect_1.2.0                bit_4.0.5                      
 [13] doParallel_1.0.17               clue_0.3-65                     lattice_0.22-5                  rjson_0.2.21                   
 [17] evmix_2.12                      blob_1.2.4                      stringr_1.5.1                   urlchecker_1.0.1               
 [21] S4Arrays_1.2.0                  parallel_4.3.1                  Biobase_2.62.0                  png_0.1-8                      
 [25] plotrix_3.8-4                   cli_3.6.2                       flowViz_1.64.0                  ProtGenerics_1.32.0            
 [29] IDPmisc_1.1.20                  CATALYST_1.24.0                 goftest_1.2-3                   BiocIO_1.10.0                  
 [33] bluster_1.10.0                  purrr_1.0.2                     BiocNeighbors_1.18.0            stringdist_0.9.12              
 [37] uwot_0.1.16                     dendextend_1.17.1               curl_5.2.0                      mime_0.12                      
 [41] evaluate_0.23                   leiden_0.4.3.1                  ComplexHeatmap_2.18.0           V8_4.4.1                       
 [45] stringi_1.8.3                   backports_1.4.1                 gsl_2.1-8                       XML_3.99-0.16                  
 [49] lubridate_1.9.3                 httpuv_1.6.13                   flexmix_2.3-19                  AnnotationDbi_1.64.1           
 [53] paletteer_1.5.0                 magrittr_2.0.3                  rappdirs_0.3.3                  splines_4.3.1                  
 [57] mclust_6.0.1                    jpeg_0.1-10                     ncdfFlow_2.46.0                 xlsx_0.6.5                     
 [61] ggraph_2.1.0                    dplyr_1.1.4                     PeacoQC_1.11.2                  DT_0.31                        
 [65] sctransform_0.4.1               ggbeeswarm_0.7.2                sessioninfo_1.2.2               HDF5Array_1.30.0               
 [69] Nebulosa_1.10.0                 ggExtra_0.10.1                  DBI_1.2.0                       withr_3.0.0                    
 [73] lmtest_0.9-40                   ggnewscale_0.4.9                clustree_0.5.1                  tidygraph_1.3.0                
 [77] rtracklayer_1.60.1              BiocManager_1.30.22             htmlwidgets_1.6.4               fs_1.6.3                       
 [81] S4Vectors_0.40.2                biomaRt_2.56.1                  SingleCellExperiment_1.24.0     ggrepel_0.9.5                  
 [85] labeling_0.4.3                  tidyHeatmap_1.10.1              SparseArray_1.2.3               cellranger_1.1.0               
 [89] MatrixGenerics_1.14.0           tidyseurat_0.8.0                reticulate_1.34.0               hexbin_1.28.3                  
 [93] zoo_1.8-12                      GGally_2.2.0                    XVector_0.42.0                  knitr_1.45                     
 [97] nnls_1.5                        drc_3.0-1                       BiocGenerics_0.48.1             timechange_0.2.0               
[101] foreach_1.5.2                   fansi_1.0.6                     dittoSeq_1.12.2                 patchwork_1.2.0                
[105] GoFKernel_2.1-1                 rhdf5_2.46.1                    data.table_1.14.10              quantreg_5.97                  
[109] R.oo_1.25.0                     RSpectra_0.16-1                 irlba_2.3.5.1                   ggrastr_1.0.2                  
[113] fastDummies_1.7.3               ellipsis_0.3.2                  SpatialExperiment_1.12.0        lazyeval_0.2.2                 
[117] yaml_2.3.8                      tidySingleCellExperiment_1.11.6 survival_3.5-7                  scattermore_1.2                
[121] usefun_0.5.0                    BiocVersion_3.18.1              crayon_1.5.2                    RcppAnnoy_0.0.21               
[125] RColorBrewer_1.1-3              progressr_0.14.0                tweenr_2.0.2                    later_1.3.2                    
[129] Rgraphviz_2.44.0                base64enc_0.1-3                 miQC_1.10.0                     ggridges_0.5.5                 
[133] codetools_0.2-19                GlobalOptions_0.1.2             profvis_0.3.8                   Seurat_5.0.1                   
[137] KEGGREST_1.42.0                 Rtsne_0.17                      shape_1.4.6                     flowGate_1.0.0                 
[141] limma_3.56.2                    Rsamtools_2.16.0                filelock_1.0.3                  cytometree_2.0.2               
[145] flowWorkspace_4.12.2            pkgconfig_2.0.3                 xml2_1.3.6                      ggpubr_0.6.0                   
[149] GenomicAlignments_1.36.0        GenomicRanges_1.54.1            IRanges_2.36.0                  evd_2.3-6.1                    
[153] iNEXT_3.0.0                     spatstat.sparse_3.0-3           xtable_1.8-4                    interp_1.1-5                   
[157] car_3.1-2                       plyr_1.8.9                      httr_1.4.7                      tools_4.3.1                    
[161] globals_0.16.2                  SeuratObject_5.0.1              pkgbuild_1.4.3                  beeswarm_0.4.0                 
[165] broom_1.0.5                     nlme_3.1-164                    dbplyr_2.4.0                    ExperimentHub_2.10.0           
[169] MatrixModels_0.5-3              digest_0.6.34                   Spectre_1.0.0                   Matrix_1.6-5                   
[173] farver_2.1.1                    AnnotationFilter_1.24.0         reshape2_1.4.4                  ks_1.14.2                      
[177] glue_1.7.0                      cachem_1.0.8                    BiocFileCache_2.10.1            polyclip_1.10-6                
[181] generics_0.1.3                  Biostrings_2.70.1               ggalluvial_0.12.5               stats4_4.3.1                   
[185] FlowSOM_2.8.0                   mvtnorm_1.2-4                   parallelly_1.36.0               ConsensusClusterPlus_1.64.0    
[189] ggtext_0.1.2                    pkgload_1.3.4                   statmod_1.5.0                   flowCore_2.12.2                
[193] RcppHNSW_0.5.0                  ScaledMatrix_1.8.1              carData_3.0-5                   pbapply_1.7-2                  
[197] randomcoloR_1.1.0.1             SummarizedExperiment_1.32.0     spam_2.10-0                     dqrng_0.3.2                    
[201] utf8_1.2.4                      SeuratWrappers_0.3.2            ontoProc_1.22.0                 graphlayouts_1.0.2             
[205] gtools_3.9.5                    readxl_1.4.3                    ggsignif_0.6.4                  scRNAseq_2.14.0                
[209] shiny_1.8.0                     GenomeInfoDbData_1.2.11         cytolib_2.12.1                  RProtoBufLib_2.12.1            
[213] rhdf5filters_1.14.1             R.utils_2.12.3                  RCurl_1.98-1.14                 memoise_2.0.1                  
[217] rmarkdown_2.25                  LaplacesDemon_16.1.6            paintmap_1.0                    pheatmap_1.0.12                
[221] R.methodsS3_1.8.2               scales_1.3.0                    future_1.33.1                   RANN_2.6.1                     
[225] spatstat.data_3.0-4             rstudioapi_0.15.0               janitor_2.2.0                   cluster_2.1.6                  
[229] spatstat.utils_3.0-4            hms_1.1.3                       fitdistrplus_1.1-11             munsell_0.5.0                  
[233] scCustomize_2.0.1               colorspace_2.1-0                ggdendro_0.1.23                 rlang_1.1.3                    
[237] GenomeInfoDb_1.38.5             pastecs_1.3.21                  DelayedMatrixStats_1.22.6       sparseMatrixStats_1.12.2       
[241] truncdist_1.0-2                 dotCall64_1.1-1                 ggforce_0.4.1                   circlize_0.4.15                
[245] scuttle_1.10.3                  xfun_0.41                       HCATonsilData_1.1.0             TH.data_1.1-2                  
[249] modeltools_0.2-23               remotes_2.4.2.1                 iterators_1.0.14                matrixStats_1.2.0              
[253] abind_1.4-5                     tibble_3.2.1                    interactiveDisplayBase_1.40.0   celldex_1.11.1                 
[257] rJava_1.0-10                    Rhdf5lib_1.24.1                 bitops_1.0-7                    promises_1.2.1                 
[261] RSQLite_2.3.4                   openxlsx_4.2.5.2                sandwich_3.1-0                  DelayedArray_0.28.0            
[265] compiler_4.3.1                  PRROC_1.3.1                     colorRamps_2.3.1                forcats_1.0.0                  
[269] prettyunits_1.2.0               writexl_1.4.2                   boot_1.3-28.1                   beachmat_2.16.0                
[273] SparseM_1.81                    formattable_0.2.1               ttservice_0.4.0                 listenv_0.9.0                  
[277] Rcpp_1.0.12                     edgeR_3.42.4                    AnnotationHub_3.10.0            BiocSingular_1.16.0            
[281] tensor_1.5                      usethis_2.2.2                   MASS_7.3-60.0.1                 progress_1.2.3                 
[285] gridtext_0.1.5                  ontologyPlot_1.6                BiocParallel_1.34.2             cubature_2.1.0                 
[289] spatstat.random_3.2-2           R6_2.5.1                        fastmap_1.1.1                   multcomp_1.4-25                
[293] rstatix_0.7.2                   vipor_0.4.7                     ensembldb_2.24.1                ROCR_1.0-11                    
[297] ggstats_0.5.1                   nnet_7.3-19                     rsvd_1.0.5                      gtable_0.3.4                   
[301] KernSmooth_2.23-22              latticeExtra_0.6-30             miniUI_0.1.1.1                  deldir_2.0-2                   
[305] htmltools_0.5.7                 bit64_4.0.5                     ggprism_1.0.4                   spatstat.explore_3.2-5         
[309] lifecycle_1.0.4                 ggcyto_1.28.1                   zip_2.3.0                       ontologyIndex_2.11             
[313] restfulr_0.0.15                 Scillus_0.5.0                   xlsxjars_0.6.1                  vctrs_0.6.5                    
[317] VGAM_1.1-9                      snakecase_0.11.1                spatstat.geom_3.2-7             scran_1.28.2                   
[321] sp_2.1-2                        SeuratData_0.2.2.9001           pracma_2.4.4                    future.apply_1.11.1            
[325] pillar_1.9.0                    magick_2.8.2                    GenomicFeatures_1.52.2          metapod_1.8.0                  
[329] locfit_1.5-9.8                  jsonlite_1.8.8                  GetoptLong_1.0.5    

@ncborcherding ncborcherding added the more info needed Waiting on more information label Jan 18, 2024
ncborcherding added a commit that referenced this issue Jan 18, 2024
Called off.the.chain twice
@ncborcherding
Copy link
Member

Hey Quang,

Nice catch - there was a duplicated chain removal - so anything in the second position was causing an error - should be fixed with the above commit.

Nick

@denvercal1234GitHub
Copy link
Author

denvercal1234GitHub commented Feb 12, 2024

Hi, @ncborcherding,

Unfortunately, the error persisted as below. Would you mind taking a look?

Thanks, Nick.

#### error with TRB 
> clonalCompare(CD8_VDJ_contig_list_combined, 
+                   top.clones = 50, 
+                   samples = NULL, 
+                   cloneCall="aa", 
+                   graph = "alluvial", group.by = "vdj_donor_ID", exportTable=F, chain="TRB") + theme(legend.position="none")

Error in str_split(dat[, cloneCall], "_", simplify = TRUE)[, x] : 
  subscript out of bounds
#### No error
clonalCompare(CD8_VDJ_contig_list_combined, 
                  top.clones = 50, 
                  samples = NULL, 
                  cloneCall="aa", 
                  graph = "alluvial", group.by = "vdj_donor_ID", exportTable=F, chain="TRA") + theme(legend.position="none")
Screenshot 2024-02-12 at 19 19 00
######### Interestingly, my data is TCRab, but it worked for TCRG; yet, it looks exactly the same as TRA.
clonalCompare(CD8_VDJ_contig_list_combined, 
                  top.clones = 50, 
                  samples = NULL, 
                  cloneCall="aa", 
                  graph = "alluvial", group.by = "vdj_donor_ID", exportTable=F, chain="TRG") + theme(legend.position="none")


Screenshot 2024-02-12 at 19 24 28

@ncborcherding
Copy link
Member

Hey Quang - this is actually subtly different issue so I have opened #312 issue.

Basically the issue here is when scRepertoire was constructed simultaneous paired chain profiling TCRA/B + IGH/L or + TRG/D was not considered. The chain handler does not filter by the family and will need to be updated.

For not the rudimentary fix is to subset by cell type, but I will be working on pushing an update between some traveling I am doing.

Thanks for the find!
Nick

@denvercal1234GitHub
Copy link
Author

Hi, Nick.

I see. But what you meant by subset by cell type? The data is only TCRab T cells. Did you mean to subset by column TRA or TRB?

> colnames(CD8_VDJ_contig_list_combined[[1]])
 [1] "barcode"            "sample"             "ID"                 "TCR1"               "cdr3_aa1"          
 [6] "cdr3_nt1"           "TCR2"               "cdr3_aa2"           "cdr3_nt2"           "CTgene"            
[11] "CTnt"               "CTaa"               "CTstrict"           "vdj_donor_ID"       "vdj_status"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed Waiting on more information
Projects
None yet
Development

No branches or pull requests

2 participants