Filtering tidySummarizedExperiment by seqnames does not work as expected
1
0
Entering edit mode
7 weeks ago
Kateřina • 0

I am trying to filter tidySummarizedExperiment object based on seqnames. I am not sure though, if I am using the filtering function correctly. Either I am missing something or it can't be used to filter rowRanges (GRanges is not accesible)? And if so, is there any tidy way to do this step? I wanna keep only standard chromosomes in my final tidySummarizedObjects. I have even tried to do it the usual way, but I was getting the warning below (and couldn't figure out, how to pipe it properly).

se_ch <- standardChromosomes(data_se)
data_se |> filter(seqnames %in% se_ch) 

Error in `dplyr::filter()`:
In argument: `seqnames %in% se_ch`.
Caused by error in `match()`:
! 'match' requires vector arguments
Run `rlang::last_trace()` to see where the error occurred.

dd <- keepStandardChromosomes(data_se, pruning.mode = "coarse")
print(dd)

Warning messages:
1: Setting row names on a tibble is deprecated.
2: Setting row names on a tibble is deprecated.
3: Setting row names on a tibble is deprecated.
4: Setting row names on a tibble is deprecated.
5: Setting row names on a tibble is deprecated.
6: Setting row names on a tibble is deprecated.
7: Setting row names on a tibble is deprecated.
8: Setting row names on a tibble is deprecated.
9: Setting row names on a tibble is deprecated.
10: Setting row names on a tibble is deprecated.
11: Setting row names on a tibble is deprecated.
12: In check_se_dimnames(se) :
  tidySummarizedExperiment says: the assays in your SummarizedExperiment have row names, but they don't agree with the row names of the SummarizedExperiment object itself. It is strongly recommended to make the assays consistent, to avoid erroneous matching of features.
13: Setting row names on a tibble is deprecated.
14: Setting row names on a tibble is deprecated.

sessionInfo()

R version 4.4.2 (2024-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.1.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: Europe/Prague
tzcode source: internal

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

other attached packages:
 [1] fission_1.26.0                  lubridate_1.9.4                 forcats_1.0.0                  
 [4] stringr_1.5.1                   purrr_1.0.4                     readr_2.1.5                    
 [7] tibble_3.2.1                    tidyverse_2.0.0                 nullranges_1.12.0              
[10] plyranges_1.26.0                tidybulk_1.18.0                 tidyseurat_0.8.0               
[13] SeuratObject_5.0.2              sp_2.2-0                        tidySingleCellExperiment_1.16.0
[16] SingleCellExperiment_1.28.1     tidySummarizedExperiment_1.16.0 ttservice_0.4.1                
[19] ggplot2_3.5.1                   tidyr_1.3.1                     dplyr_1.1.4                    
[22] tidyomics_1.2.0                 SummarizedExperiment_1.36.0     Biobase_2.66.0                 
[25] GenomicRanges_1.58.0            GenomeInfoDb_1.42.3             IRanges_2.40.1                 
[28] S4Vectors_0.44.0                BiocGenerics_0.52.0             MatrixGenerics_1.18.1          
[31] matrixStats_1.5.0              

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.22         splines_4.4.2            later_1.4.1              BiocIO_1.16.0           
  [5] bitops_1.0-9             polyclip_1.10-7          preprocessCore_1.68.0    XML_3.99-0.18           
  [9] fastDummies_1.7.5        lifecycle_1.0.4          edgeR_4.4.2              vroom_1.6.5             
 [13] globals_0.16.3           lattice_0.22-6           MASS_7.3-65              magrittr_2.0.3          
 [17] limma_3.62.2             plotly_4.10.4            yaml_2.3.10              httpuv_1.6.15           
 [21] Seurat_5.2.1             sctransform_0.4.1        spam_2.11-1              spatstat.sparse_3.1-0   
 [25] reticulate_1.41.0        cowplot_1.1.3            pbapply_1.7-2            RColorBrewer_1.1-3      
 [29] abind_1.4-8              zlibbioc_1.52.0          Rtsne_0.17               RCurl_1.98-1.16         
 [33] GenomeInfoDbData_1.2.13  ggrepel_0.9.6            irlba_2.3.5.1            listenv_0.9.1           
 [37] spatstat.utils_3.1-2     goftest_1.2-3            RSpectra_0.16-2          spatstat.random_3.3-2   
 [41] fitdistrplus_1.2-2       parallelly_1.42.0        codetools_0.2-20         DelayedArray_0.32.0     
 [45] tidyselect_1.2.1         UCSC.utils_1.2.0         farver_2.1.2             spatstat.explore_3.3-4  
 [49] GenomicAlignments_1.42.0 jsonlite_1.9.1           ellipsis_0.3.2           progressr_0.15.1        
 [53] ggridges_0.5.6           survival_3.8-3           tools_4.4.2              ica_1.0-3               
 [57] Rcpp_1.0.14              glue_1.8.0               gridExtra_2.3            SparseArray_1.6.2       
 [61] withr_3.0.2              fastmap_1.2.0            fansi_1.0.6              digest_0.6.37           
 [65] timechange_0.3.0         R6_2.6.1                 mime_0.12                colorspace_2.1-1        
 [69] scattermore_1.2          tensor_1.5               spatstat.data_3.1-4      utf8_1.2.4              
 [73] generics_0.1.3           data.table_1.17.0        rtracklayer_1.66.0       InteractionSet_1.34.0   
 [77] httr_1.4.7               htmlwidgets_1.6.4        S4Arrays_1.6.0           uwot_0.2.3              
 [81] pkgconfig_2.0.3          gtable_0.3.6             lmtest_0.9-40            XVector_0.46.0          
 [85] htmltools_0.5.8.1        dotCall64_1.2            scales_1.3.0             png_0.1-8               
 [89] spatstat.univar_3.1-1    rstudioapi_0.17.1        tzdb_0.4.0               reshape2_1.4.4          
 [93] rjson_0.2.23             nlme_3.1-167             curl_6.2.1               zoo_1.8-13              
 [97] KernSmooth_2.23-26       parallel_4.4.2           miniUI_0.1.1.1           restfulr_0.0.15         
[101] pillar_1.10.1            grid_4.4.2               vctrs_0.6.5              RANN_2.6.2              
[105] promises_1.3.2           xtable_1.8-4             cluster_2.1.8            locfit_1.5-9.11         
[109] cli_3.6.4                compiler_4.4.2           Rsamtools_2.22.0         rlang_1.1.5             
[113] crayon_1.5.3             future.apply_1.11.3      plyr_1.8.9               stringi_1.8.4           
[117] viridisLite_0.4.2        deldir_2.0-4             BiocParallel_1.40.0      munsell_0.5.1           
[121] Biostrings_2.74.1        lazyeval_0.2.2           spatstat.geom_3.3-5      Matrix_1.7-2            
[125] RcppHNSW_0.6.0           hms_1.1.3                patchwork_1.3.0          bit64_4.6.0-1           
[129] future_1.34.0            statmod_1.5.0            shiny_1.10.0             ROCR_1.0-11             
[133] igraph_2.1.4             bit_4.5.0.1
tidySummarizedExperiment tidyomics plyranges GenomeInfoDb • 276 views
ADD COMMENT
0
Entering edit mode

Please make a reproducible example.

ADD REPLY

Login before adding your answer.

Traffic: 1582 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6