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

Issue combining single-cell experiment object and combined.BCR screpertoire object despite matching barcodes. #473

Closed
monikaramos opened this issue Feb 4, 2025 · 4 comments
Labels
more info needed Waiting on more information

Comments

@monikaramos
Copy link

Hi there,
I am trying to overlay the BCR analysis results onto my single-cell object and am following this vignette: https://www.borch.dev/uploads/screpertoire/articles/attaching_sc . Unfortunately, I am encountering the following error when trying to combine my single cell experiment object and screpertoire combined.bcr object:

sce <- combineExpression(combined.BCR,
sce,
cloneCall="gene",
group.by = NULL,
proportion = TRUE)

ERROR message:
Error in [.data.frame(full_data, , combined_col_names) :
undefined columns selected

I have ensured that my barcodes match their naming convention in the sce and combined.bcr object as evidenced here:
SCE object:
Image
combined.BCR object:
Image

Can you please help me identify the cause of this error?

Thank you.

@ncborcherding
Copy link
Member

@monikaramos

Could you do me a favor and please make a reproducible example for this issue so I can ID the issue?

Also with the example, please make sure to include the output of sessionInfo().

Thanks a lot,
Nick

@ncborcherding ncborcherding added the more info needed Waiting on more information label Feb 4, 2025
@monikaramos
Copy link
Author

May I please have your email to send a link to the .rds files (they're small) I am combining with the code I posted above?

Here is my sessionInfo() output:

sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
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.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.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: America/Los_Angeles
tzcode source: internal

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

other attached packages:
[1] RColorBrewer_1.1-3 ggthemes_5.1.0 scRepertoire_2.0.7 SeuratWrappers_0.3.5 lubridate_1.9.4
[6] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2 readr_2.1.5
[11] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.1 tidyverse_2.0.0 patchwork_1.3.0
[16] Seurat_5.2.1 SeuratObject_5.0.2 sp_2.2-0

loaded via a namespace (and not attached):
[1] cubature_2.1.1 RcppAnnoy_0.0.22 splines_4.4.0
[4] later_1.4.1 R.oo_1.27.0 polyclip_1.10-7
[7] fastDummies_1.7.5 lifecycle_1.0.4 globals_0.16.3
[10] lattice_0.22-6 MASS_7.3-64 magrittr_2.0.3
[13] plotly_4.10.4 rmarkdown_2.29 yaml_2.3.10
[16] remotes_2.5.0 httpuv_1.6.15 sctransform_0.4.1
[19] spam_2.11-1 spatstat.sparse_3.1-0 reticulate_1.40.0
[22] cowplot_1.1.3 pbapply_1.7-2 pkgload_1.4.0
[25] abind_1.4-8 zlibbioc_1.50.0 Rtsne_0.17
[28] GenomicRanges_1.56.2 R.utils_2.12.3 ggraph_2.2.1
[31] BiocGenerics_0.50.0 hash_2.2.6.3 tweenr_2.0.3
[34] evmix_2.12 GenomeInfoDbData_1.2.12 IRanges_2.38.1
[37] S4Vectors_0.42.1 ggrepel_0.9.6 irlba_2.3.5.1
[40] listenv_0.9.1 spatstat.utils_3.1-2 iNEXT_3.0.1
[43] MatrixModels_0.5-3 goftest_1.2-3 RSpectra_0.16-2
[46] spatstat.random_3.3-2 fitdistrplus_1.2-2 parallelly_1.42.0
[49] leiden_0.4.3.1 codetools_0.2-20 DelayedArray_0.30.1
[52] ggforce_0.4.2 tidyselect_1.2.1 UCSC.utils_1.0.0
[55] farver_2.1.2 viridis_0.6.5 matrixStats_1.5.0
[58] stats4_4.4.0 spatstat.explore_3.3-4 jsonlite_1.8.9
[61] tidygraph_1.3.1 progressr_0.15.1 ggalluvial_0.12.5
[64] ggridges_0.5.6 survival_3.8-3 tools_4.4.0
[67] stringdist_0.9.15 ica_1.0-3 Rcpp_1.0.14
[70] glue_1.8.0 gridExtra_2.3 SparseArray_1.4.8
[73] xfun_0.50 MatrixGenerics_1.16.0 GenomeInfoDb_1.40.1
[76] withr_3.0.2 BiocManager_1.30.25 fastmap_1.2.0
[79] fansi_1.0.6 SparseM_1.84-2 digest_0.6.37
[82] rsvd_1.0.5 timechange_0.3.0 R6_2.5.1
[85] mime_0.12 colorspace_2.1-1 scattermore_1.2
[88] tensor_1.5 spatstat.data_3.1-4 R.methodsS3_1.8.2
[91] utf8_1.2.4 generics_0.1.3 data.table_1.16.4
[94] graphlayouts_1.2.2 httr_1.4.7 htmlwidgets_1.6.4
[97] S4Arrays_1.4.1 uwot_0.2.2 pkgconfig_2.0.3
[100] gtable_0.3.6 lmtest_0.9-40 SingleCellExperiment_1.26.0
[103] XVector_0.44.0 htmltools_0.5.8.1 dotCall64_1.2
[106] scales_1.3.0 Biobase_2.64.0 png_0.1-8
[109] spatstat.univar_3.1-1 ggdendro_0.2.0 knitr_1.49
[112] rstudioapi_0.17.1 rjson_0.2.23 tzdb_0.4.0
[115] reshape2_1.4.4 nlme_3.1-167 cachem_1.1.0
[118] zoo_1.8-12 KernSmooth_2.23-26 parallel_4.4.0
[121] miniUI_0.1.1.1 vipor_0.4.7 ggrastr_1.0.2
[124] pillar_1.10.1 grid_4.4.0 vctrs_0.6.5
[127] RANN_2.6.2 VGAM_1.1-12 promises_1.3.2
[130] xtable_1.8-4 cluster_2.1.8 beeswarm_0.4.0
[133] evaluate_1.0.3 truncdist_1.0-2 cli_3.6.3
[136] compiler_4.4.0 rlang_1.1.5 crayon_1.5.3
[139] future.apply_1.11.3 labeling_0.4.3 plyr_1.8.9
[142] ggbeeswarm_0.7.2 stringi_1.8.4 viridisLite_0.4.2
[145] deldir_2.0-4 assertthat_0.2.1 gsl_2.1-8
[148] munsell_0.5.1 lazyeval_0.2.2 spatstat.geom_3.3-5
[151] quantreg_6.00 Matrix_1.7-2 RcppHNSW_0.6.0
[154] hms_1.1.3 future_1.34.0 shiny_1.10.0
[157] SummarizedExperiment_1.34.0 evd_2.3-7.1 ROCR_1.0-11
[160] memoise_2.0.1 igraph_2.1.4

@ncborcherding
Copy link
Member

Hey @monikaramos

Thanks for the follow up - my email is ncborch @ gmail . com. I am out today with a sick kid, so I will follow up later this week. Apologies for the delay.

Nick

@ncborcherding
Copy link
Member

ncborcherding commented Feb 6, 2025

Hey @monikaramos

Thank you so much for the follow up and sending the data along - it save me a tone of time.

What is going on here is that your sce file already has the columns associated with scRepertoire in the colData() - which causes the error because there are no new columns to add. These columns are associated with all NA values for some reason too.

sce <- readRDS("~/Downloads/screpertoire-selected/sce.fortroubleshoot.rds")
head(colData(sce)[,13:18], 5)

DataFrame with 5 rows and 6 columns
CTgene CTnt

Primary_Tumor_LVMMR_AAACCTGCAAGAAAGG-1 NA NA
Primary_Tumor_LVMMR_AAACCTGCAGCTGTGC-1 NA NA
Primary_Tumor_LVMMR_AAACCTGGTCGGCACT-1 NA NA
Primary_Tumor_LVMMR_AAACCTGTCAAACCAC-1 NA NA
Primary_Tumor_LVMMR_AAACCTGTCTGAGTGT-1 NA NA
CTaa CTstrict

Primary_Tumor_LVMMR_AAACCTGCAAGAAAGG-1 NA NA
Primary_Tumor_LVMMR_AAACCTGCAGCTGTGC-1 NA NA
Primary_Tumor_LVMMR_AAACCTGGTCGGCACT-1 NA NA
Primary_Tumor_LVMMR_AAACCTGTCAAACCAC-1 NA NA
Primary_Tumor_LVMMR_AAACCTGTCTGAGTGT-1 NA NA
clonalProportion clonalFrequency

Primary_Tumor_LVMMR_AAACCTGCAAGAAAGG-1 NA NA
Primary_Tumor_LVMMR_AAACCTGCAGCTGTGC-1 NA NA
Primary_Tumor_LVMMR_AAACCTGGTCGGCACT-1 NA NA
Primary_Tumor_LVMMR_AAACCTGTCAAACCAC-1 NA NA
Primary_Tumor_LVMMR_AAACCTGTCTGAGTGT-1 NA NA

If you just subtract the scRepertoire-associated columns, you should be able to use combineExpression() with no isssue:

colData(sce) <- colData(sce)[,1:12]
sce <- combineExpression(combined.BCR,
                         sce,
                         cloneCall="gene",
                         group.by = NULL,
                         proportion = TRUE)

Hope that helps and thanks again!

Nick

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