ncborcherding / scRepertoire

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

Error in combineTCR(contig.list, samples = "Pt17", cells = "T-AB", filterMulti = TRUE, : unused argument (cells = "T-AB") #373

Closed yueli8 closed 6 months ago

yueli8 commented 6 months ago

Hello Nike,

Thank you for developing so nice software!

  1. It works well when delete cells = "T-AB".
clones <- combineTCR(contig.list, samples = "Pt17", filterMulti = TRUE, removeNA = TRUE)  

clones <- combineTCR(contig.list, samples = "Pt17", cells = "T-AB", filterMulti = TRUE, removeNA = TRUE)
Error in combineTCR(contig.list, samples = "Pt17", cells = "T-AB", filterMulti = TRUE,  : 
  unused argument (cells = "T-AB")
  1. My features.tsv.gz file does not contain any "Antibody Capture" information, so I skipped the "Removing TCR-specific antibody" step. Is that correct? Plese see attached features.tsv.gz file.

Thank you in advance for your great help!

Best,

Yue


rm(list=ls())
library(immunarch)  
library(scRepertoire)
library(tidyverse)
library(SingleCellExperiment)
library(Seurat)
library(powerTCR)
library(Trex)
library(tensorflow)

setwd("~/sph_data/gse136394/finalize")
TIL_4095_1 <- "TIL_4095_1"
TIL_4095_2 <- "TIL_4095_2"
TIL_4095_3 <- "TIL_4095_3"
TIL_4095_4 <- "TIL_4095_4"

filelist <- c(TIL_4095_1,TIL_4095_2,TIL_4095_3,TIL_4095_4)
samples <- c("S1","S2","S3","S4")

contig_list<- lapply(filelist, read.delim)
colnames(contig_list[[1]])

# convert to "scRepertoire" style
contig.list <- loadContigs(contig_list,  format = "MiXCR")

names(contig.list)
NULL
colnames(contig.list[[1]])
[1] "barcode" "chain"   "reads"   "v_gene"  "d_gene"  "j_gene"  "c_gene"  "cdr3_nt" "cdr3"   
head((contig.list[[1]]))
barcode chain reads             v_gene                    d_gene            j_gene          c_gene
1 ACCAGTACAAGACACG   TRB  1522  TRBV5-6*00(530.9)              TRBD2*00(25) TRBJ1-2*00(375.2) TRBC1*00(232.7)
2 CAGCTGGGTAAAGTCA   TRB  1453  TRBV5-6*00(530.9)              TRBD2*00(25) TRBJ1-2*00(375.2) TRBC1*00(232.7)
3 ATCACGAAGTGAACGC   TRB  1260  TRBV5-6*00(530.9)              TRBD2*00(25) TRBJ1-2*00(375.2) TRBC1*00(232.7)
4 ACCAGTACAAGACACG   TRB  1203 TRBV10-2*00(620.2) TRBD1*00(25),TRBD2*00(25) TRBJ1-1*00(410.3) TRBC1*00(234.9)
5 CAGCTGGGTAAAGTCA   TRB  1123 TRBV10-2*00(620.2) TRBD1*00(25),TRBD2*00(25) TRBJ1-1*00(410.3) TRBC1*00(234.9)
6 ACCAGTATCAACCATG   TRA  1099   TRAV4*00(1096.4)                      <NA>  TRAJ15*00(209.8)  TRAC*00(195.6)
cdr3_nt            cdr3
1 TGTGCCAGCAGCTTGGGTGAGGGAAGAGTGGACGGCTACACCTTC CASSLGEGRVDGYTF
2 TGTGCCAGCAGCTTGGGTGAGGGAAGAGTGGACGGCTACACCTTC CASSLGEGRVDGYTF
3 TGTGCCAGCAGCTTGGGTGAGGGAAGAGTGGACGGCTACACCTTC CASSLGEGRVDGYTF
4          TGCGCCAGCAGTGACCCCGGCACTGAAGCTTTCTTT    CASSDPGTEAFF
5          TGCGCCAGCAGTGACCCCGGCACTGAAGCTTTCTTT    CASSDPGTEAFF
6 TGCCTCGTGGGTGACATGGACCAGGCAGGAACTGCTCTGATCTTT CLVGDMDQAGTALIF

Pt17<-readRDS("hms_cluster_id_test_4samples.rds")
#Filtering step
standev <- sd(log(Pt17$nFeature_RNA))*2.5 #cutting off above standard deviation of 2.5
mean <- mean(log(Pt17$nFeature_RNA))
cut <- round(exp(standev+mean))
#Pt17 <- subset(Pt17, subset = mito.genes < 10 & nFeature_RNA < cut)

#Processing RNA
DefaultAssay(Pt17) <- 'RNA'
Pt17 <- NormalizeData(Pt17) %>% 
  FindVariableFeatures() %>% 
  quietTCRgenes() %>% 
  ScaleData() %>% 
  RunPCA(verbose = FALSE)

clones <- combineTCR(contig.list, samples = "Pt17", cells = "T-AB", filterMulti = TRUE, removeNA = TRUE)
Error in combineTCR(contig.list, samples = "Pt17", cells = "T-AB", filterMulti = TRUE,  : 
  unused argument (cells = "T-AB")
clones <- combineTCR(contig.list, samples = "Pt17", filterMulti = TRUE, removeNA = TRUE)                    

> sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=zh_CN.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=zh_CN.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=zh_CN.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C       

time zone: Asia/Shanghai
tzcode source: system (glibc)

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

other attached packages:
 [1] tensorflow_2.16.0           Trex_0.99.11                powerTCR_1.20.0             scRepertoire_2.0.3          immunarch_0.9.1             dtplyr_1.3.1               
 [7] patchwork_1.2.0             lubridate_1.9.3             forcats_1.0.0               purrr_1.0.2                 readr_2.1.5                 tidyr_1.3.1                
[13] tibble_3.2.1                tidyverse_2.0.0             monocle3_1.3.1              SeuratObject_4.1.4          Seurat_4.4.0                DEsingle_1.20.0            
[19] data.table_1.15.4           BiocNeighbors_1.18.0        BiocParallel_1.34.2         clustree_0.5.1              ggraph_2.2.1                celldex_1.10.1             
[25] reshape2_1.4.4              Matrix_1.6-1.1              scran_1.28.2                scater_1.28.0               scuttle_1.10.3              SingleCellExperiment_1.22.0
[31] SummarizedExperiment_1.30.2 Biobase_2.60.0              GenomicRanges_1.52.1        GenomeInfoDb_1.36.4         IRanges_2.36.0              S4Vectors_0.40.2           
[37] BiocGenerics_0.48.1         MatrixGenerics_1.12.3       matrixStats_1.3.0           cowplot_1.1.3               ggplot2_3.5.1               stringr_1.5.1              
[43] dplyr_1.1.4                

loaded via a namespace (and not attached):
  [1] ggseqlogo_0.2                 urlchecker_1.0.1              shinythemes_1.2.0             nnet_7.3-19                   goftest_1.2-3                
  [6] gamlss_5.4-22                 Biostrings_2.68.1             vctrs_0.6.5                   spatstat.random_3.2-3         digest_0.6.35                
 [11] png_0.1-8                     shape_1.4.6.1                 tfruns_1.5.3                  ggrepel_0.9.5                 deldir_2.0-4                 
 [16] parallelly_1.37.1             permute_0.9-7                 MASS_7.3-60                   httpuv_1.6.15                 foreach_1.5.2                
 [21] withr_3.0.0                   ggpubr_0.6.0                  ellipsis_0.3.2                survival_3.6-4                memoise_2.0.1                
 [26] ggbeeswarm_0.7.2              diptest_0.77-1                MatrixModels_0.5-3            profvis_0.3.8                 zoo_1.8-12                   
 [31] GlobalOptions_0.1.2           pbapply_1.7-2                 DEoptimR_1.1-3                prabclus_2.3-3                rlist_0.4.6.2                
 [36] KEGGREST_1.40.1               promises_1.3.0                evmix_2.12                    httr_1.4.7                    rstatix_0.7.2                
 [41] hash_2.2.6.3                  globals_0.16.3                fitdistrplus_1.1-11           fpc_2.2-12                    rstudioapi_0.16.0            
 [46] miniUI_0.1.1.1                generics_0.1.3                base64enc_0.1-3               ggalluvial_0.12.5             curl_5.2.1                   
 [51] zlibbioc_1.46.0               ScaledMatrix_1.8.1            polyclip_1.10-6               quadprog_1.5-8                GenomeInfoDbData_1.2.10      
 [56] ExperimentHub_2.8.1           interactiveDisplayBase_1.38.0 xtable_1.8-4                  doParallel_1.0.17             S4Arrays_1.2.1               
 [61] BiocFileCache_2.8.0           hms_1.1.3                     irlba_2.3.5.1                 colorspace_2.1-0              filelock_1.0.3               
 [66] ROCR_1.0-11                   readxl_1.4.3                  reticulate_1.36.1             spatstat.data_3.0-4           flexmix_2.3-19               
 [71] magrittr_2.0.3                lmtest_0.9-40                 later_1.3.2                   viridis_0.6.5                 modeltools_0.2-23            
 [76] lattice_0.22-6                spatstat.geom_3.2-9           future.apply_1.11.2           robustbase_0.99-2             SparseM_1.81                 
 [81] scattermore_1.2               RcppAnnoy_0.0.22              class_7.3-22                  pillar_1.9.0                  nlme_3.1-164                 
 [86] iterators_1.0.14              compiler_4.3.0                beachmat_2.16.0               stringi_1.8.4                 tensor_1.5                   
 [91] minqa_1.2.6                   devtools_2.4.5                plyr_1.8.9                    crayon_1.5.2                  abind_1.4-5                  
 [96] ggdendro_0.2.0                locfit_1.5-9.9                sp_2.1-4                      graphlayouts_1.1.1            bit_4.0.5                    
[101] terra_1.7-71                  UpSetR_1.4.0                  sandwich_3.1-0                whisker_0.4.1                 fastmatch_1.1-4              
[106] codetools_0.2-20              BiocSingular_1.16.0           plotly_4.10.4                 mime_0.12                     splines_4.3.0                
[111] circlize_0.4.16               Rcpp_1.0.12                   quantreg_5.97                 dbplyr_2.5.0                  sparseMatrixStats_1.12.2     
[116] cellranger_1.1.0              maxLik_1.5-2.1                blob_1.2.4                    utf8_1.2.4                    BiocVersion_3.17.1           
[121] lme4_1.1-33                   fs_1.6.4                      evd_2.3-7                     listenv_0.9.1                 DelayedMatrixStats_1.22.6    
[126] pscl_1.5.9                    pkgbuild_1.4.4                gsl_2.1-8                     ggsignif_0.6.4                statmod_1.5.0                
[131] tzdb_0.4.0                    pheatmap_1.0.12               tweenr_2.0.3                  pkgconfig_2.0.3               tools_4.3.0                  
[136] cachem_1.0.8                  RSQLite_2.3.6                 viridisLite_0.4.2             DBI_1.2.2                     numDeriv_2016.8-1.1          
[141] fastmap_1.1.1                 scales_1.3.0                  grid_4.3.0                    usethis_2.2.3                 ica_1.0-3                    
[146] broom_1.0.5                   AnnotationHub_3.8.0           BiocManager_1.30.23           carData_3.0-5                 RANN_2.6.1                   
[151] farver_2.1.1                  mgcv_1.9-1                    tidygraph_1.3.1               yaml_2.3.8                    VGAM_1.1-10                  
[156] cli_3.6.2                     leiden_0.4.3.1                lifecycle_1.0.4               uwot_0.2.2                    mvtnorm_1.2-4                
[161] bluster_1.10.0                kernlab_0.9-32                sessioninfo_1.2.2             backports_1.4.1               rjson_0.2.21                 
[166] timechange_0.3.0              gtable_0.3.5                  ggridges_0.5.6                gamlss.dist_6.1-1             progressr_0.14.0             
[171] cubature_2.1.0                parallel_4.3.0                ape_5.8                       limma_3.56.2                  jsonlite_1.8.8               
[176] edgeR_3.42.4                  miscTools_0.6-28              bitops_1.0-7                  bit64_4.0.5                   Rtsne_0.17                   
[181] vegan_2.6-4                   spatstat.utils_3.0-4          bdsmatrix_1.3-7               metapod_1.8.0                 dqrng_0.3.2                  
[186] zeallot_0.1.0                 truncdist_1.0-2               lazyeval_0.2.2                shiny_1.8.1.1                 htmltools_0.5.8.1            
[191] iNEXT_3.0.1                   sctransform_0.4.1             rappdirs_0.3.3                glue_1.7.0                    factoextra_1.0.7             
[196] XVector_0.40.0                RCurl_1.98-1.14               mclust_6.1.1                  gridExtra_2.3                 keras_2.15.0                 
[201] boot_1.3-30                   igraph_2.0.3                  R6_2.5.1                      labeling_0.4.3                cluster_2.1.6                
[206] bbmle_1.0.25.1                pkgload_1.3.4                 gamlss.data_6.0-6             stringdist_0.9.12             nloptr_2.0.3                 
[211] DelayedArray_0.26.7           tidyselect_1.2.1              vipor_0.4.7                   ggforce_0.4.2                 car_3.1-2                    
[216] AnnotationDbi_1.62.2          future_1.33.2                 rsvd_1.0.5                    munsell_0.5.1                 KernSmooth_2.23-22           
[221] htmlwidgets_1.6.4             RColorBrewer_1.1-3            rlang_1.1.3                   spatstat.sparse_3.0-3         spatstat.explore_3.2-7       
[226] uuid_1.2-0                    remotes_2.5.0                 phangorn_2.11.1               fansi_1.0.6                   beeswarm_0.4.0   ```

[features.tsv.gz](https://github.com/ncborcherding/scRepertoire/files/15373127/features.tsv.gz)
ncborcherding commented 6 months ago

@yueli8

  1. Looks like the vignette has a mistake for cells = "T-AB" - that argument has been deprecated several versions ago. I will fix it when the next version is released.
  2. No you should be good to go - the example data set has the CITE ab for some TCRV genes, so I removed their effect. Similar to using quietTCRgenes() on RNA.

Nick