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

Error in getCirclize with pre-existing colname "ident" in metadata #453

Closed
noigek opened this issue Dec 8, 2024 · 1 comment
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@noigek
Copy link

noigek commented Dec 8, 2024

Hi @ncborcherding,

thanks a lot for developing this nice collection of tools to analyze scTCR data! I came across an issue with getCirclize() recently, that might be of interest to you for future adjustments. When there is a pre-existing column "ident" in the metadata of an object, getCirclize() throws the following error: Error in group_by(): Can't transform a data frame with duplicate names. This can occur when e.g. running getCirclize() multiple times on the same object or when converting a seurat object to sce and back.

I think .grabMeta causes this error as it creates a new colum "ident" when fetching the metadata. Please find a reproducible example below. My work-around was to simply remove the pre-existing column "ident", but maybe a different colname in .grabMeta could prevent such issues in the future.

Thanks and all the best!

library(Seurat)
library(scRepertoire)

combined <- combineTCR(contig_list, samples = c("P17B", "P17L", "P18B", "P18L", 
                                    "P19B","P19L", "P20B", "P20L"))

scRep_example <- get(data("scRep_example"))
scRep_example <- combineExpression(combined, 
                                   scRep_example)

table(colnames([email protected]) %in% c("ident"))
circles <- getCirclize(scRep_example, 
                       group.by = "seurat_clusters") #works fine

################################################################

combined <- combineTCR(contig_list, samples = c("P17B", "P17L", "P18B", "P18L", 
                                    "P19B","P19L", "P20B", "P20L"))

scRep_example <- get(data("scRep_example"))
scRep_example <- combineExpression(combined, 
                                   scRep_example)
scRep_example <- as.SingleCellExperiment(scRep_example)
scRep_example <- as.Seurat(scRep_example)

table(colnames([email protected]) %in% c("ident"))
circles <- getCirclize(scRep_example,  
                       group.by = "seurat_clusters") # error in group_by()

sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8
[4] LC_NUMERIC=C LC_TIME=German_Germany.utf8

time zone: Europe/Berlin
tzcode source: internal

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

other attached packages:
[1] scRepertoire_2.2.1 ggplot2_3.5.1 Seurat_5.1.0 SeuratObject_5.0.2 sp_2.1-4

loaded via a namespace (and not attached):
[1] cubature_2.1.1 RcppAnnoy_0.0.22 splines_4.4.1
[4] later_1.3.2 tibble_3.2.1 polyclip_1.10-7
[7] fastDummies_1.7.4 lifecycle_1.0.4 globals_0.16.3
[10] lattice_0.22-6 MASS_7.3-61 magrittr_2.0.3
[13] sass_0.4.9 rmarkdown_2.28 plotly_4.10.4
[16] jquerylib_0.1.4 yaml_2.3.10 httpuv_1.6.15
[19] sctransform_0.4.1 spam_2.11-0 spatstat.sparse_3.1-0
[22] reticulate_1.39.0 cowplot_1.1.3 pbapply_1.7-2
[25] RColorBrewer_1.1-3 abind_1.4-8 zlibbioc_1.50.0
[28] Rtsne_0.17 GenomicRanges_1.56.2 purrr_1.0.2
[31] ggraph_2.2.1 BiocGenerics_0.50.0 hash_2.2.6.3
[34] tweenr_2.0.3 evmix_2.12 GenomeInfoDbData_1.2.12
[37] IRanges_2.38.1 S4Vectors_0.42.1 ggrepel_0.9.6
[40] irlba_2.3.5.1 listenv_0.9.1 spatstat.utils_3.1-0
[43] iNEXT_3.0.1 MatrixModels_0.5-3 goftest_1.2-3
[46] RSpectra_0.16-2 spatstat.random_3.3-2 fitdistrplus_1.2-1
[49] parallelly_1.38.0 leiden_0.4.3.1 codetools_0.2-20
[52] DelayedArray_0.30.1 ggforce_0.4.2 tidyselect_1.2.1
[55] UCSC.utils_1.0.0 farver_2.1.2 viridis_0.6.5
[58] matrixStats_1.4.1 stats4_4.4.1 spatstat.explore_3.3-2
[61] jsonlite_1.8.9 tidygraph_1.3.1 progressr_0.14.0
[64] ggridges_0.5.6 ggalluvial_0.12.5 survival_3.7-0
[67] tools_4.4.1 stringdist_0.9.12 ica_1.0-3
[70] Rcpp_1.0.13 glue_1.8.0 gridExtra_2.3
[73] SparseArray_1.4.8 xfun_0.48 MatrixGenerics_1.16.0
[76] GenomeInfoDb_1.40.1 dplyr_1.1.4 withr_3.0.1
[79] fastmap_1.2.0 fansi_1.0.6 SparseM_1.84-2
[82] digest_0.6.37 R6_2.5.1 mime_0.12
[85] colorspace_2.1-1 scattermore_1.2 tensor_1.5
[88] spatstat.data_3.1-2 utf8_1.2.4 tidyr_1.3.1
[91] generics_0.1.3 data.table_1.16.2 graphlayouts_1.2.0
[94] httr_1.4.7 htmlwidgets_1.6.4 S4Arrays_1.4.1
[97] uwot_0.2.2 pkgconfig_2.0.3 gtable_0.3.5
[100] lmtest_0.9-40 SingleCellExperiment_1.26.0 XVector_0.44.0
[103] htmltools_0.5.8.1 dotCall64_1.2 scales_1.3.0
[106] Biobase_2.64.0 png_0.1-8 spatstat.univar_3.0-1
[109] ggdendro_0.2.0 knitr_1.48 rstudioapi_0.17.0
[112] reshape2_1.4.4 rjson_0.2.23 nlme_3.1-166
[115] zoo_1.8-12 cachem_1.1.0 stringr_1.5.1
[118] KernSmooth_2.23-24 parallel_4.4.1 miniUI_0.1.1.1
[121] pillar_1.9.0 grid_4.4.1 vctrs_0.6.5
[124] RANN_2.6.2 VGAM_1.1-12 promises_1.3.0
[127] xtable_1.8-4 cluster_2.1.6 evaluate_1.0.1
[130] truncdist_1.0-2 cli_3.6.3 compiler_4.4.1
[133] rlang_1.1.4 crayon_1.5.3 future.apply_1.11.2
[136] plyr_1.8.9 stringi_1.8.4 viridisLite_0.4.2
[139] deldir_2.0-4 assertthat_0.2.1 munsell_0.5.1
[142] gsl_2.1-8 lazyeval_0.2.2 spatstat.geom_3.3-3
[145] quantreg_5.98 Matrix_1.7-0 RcppHNSW_0.6.0
[148] patchwork_1.3.0 future_1.34.0 shiny_1.9.1
[151] SummarizedExperiment_1.34.0 evd_2.3-7.1 ROCR_1.0-11
[154] igraph_2.1.1 memoise_2.0.1 bslib_0.8.0

@ncborcherding ncborcherding added bug Something isn't working good first issue Good for newcomers labels Dec 10, 2024
ncborcherding added a commit that referenced this issue Dec 10, 2024
@ncborcherding
Copy link
Owner

Hey @noigek,

Thank you for the rundown of the issue and a great reproducible example. I am marking this as a good first issue for users because of the way you structured the issue!

The issue here is that whatever column name added will always run into a user that may have that as a preexisting column. What I have done instead is implement a message if ident column is in the meta data anytime .grabMeta().

I have added it to the dev branch and will get it more thoroughly tested before going into the main branch and biocondcutor.

Thanks again,
Nick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants