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

plot(srn),Error in rep(rtime(z), lns) : invalid 'times' argument #24

Open
YUANMENG-1 opened this issue Jun 5, 2024 · 6 comments
Open

Comments

@YUANMENG-1
Copy link

YUANMENG-1 commented Jun 5, 2024

Sorry to bother!

I encountered an issue while filtering the "mse" object. There seems to be a problem with the retention times (rt). However, I have verified that the rt range I used for filtering exists within the data.Maybe other problem with the "rtime()"function?

srn <- mse |>
filterRt(rt = c(620, 640)) |>
filterMzRange(mz = c(100.300,100.330))
Filter spectra
Filter spectra

This was succeed,but error when plot

plot(srn)
Error in rep(rtime(z), lns) : invalid 'times' argument

srn
Object of class MsExperiment
Spectra: MS1 (177) MS2 (1650)
Experiment data: 5 sample(s)
Sample data links:

  • spectra: 5 sample(s) to 1827 element(s)
@jorainer
Copy link
Owner

jorainer commented Jun 6, 2024

thanks for reporting! I will check that.

@jorainer
Copy link
Owner

jorainer commented Jun 7, 2024

Can you please provide the version of the packages you were using? Ideally, the output of calling sessionInfo().

@jorainer
Copy link
Owner

jorainer commented Jun 7, 2024

This bug was fixed in xcms, but this fixed but did not make it into the current release version of xcms. I included now the fix also into the release version and it should become available in version 4.2.2 within a couple of days. As a workaround, you can filter the data set first to MS1 data:

srn <- mse |>
    filterMsLevel(1L) |>
    filterRt(rt = c(620, 640)) |>
    filterMzRange(mz = c(100.300,100.330))

plot(srn)

@YUANMENG-1
Copy link
Author

Can you please provide the version of the packages you were using? Ideally, the output of calling sessionInfo().

sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-apple-darwin20
Running under: macOS Sonoma 14.4

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-x86_64/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: Asia/Shanghai
tzcode source: internal

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

other attached packages:
[1] dplyr_1.1.4 Spectra_1.14.1 ProtGenerics_1.36.0
[4] QFeatures_1.14.1 MultiAssayExperiment_1.30.2 SummarizedExperiment_1.34.0
[7] Biobase_2.64.0 GenomicRanges_1.56.0 GenomeInfoDb_1.40.1
[10] IRanges_2.38.0 S4Vectors_0.42.0 BiocGenerics_0.50.0
[13] MatrixGenerics_1.16.0 matrixStats_1.3.0 MsFeatures_1.12.0
[16] RColorBrewer_1.1-3 xcms_4.2.1 BiocParallel_1.38.0

loaded via a namespace (and not attached):
[1] tidyselect_1.2.1 lazyeval_0.2.2 MassSpecWavelet_1.70.0
[4] digest_0.6.35 XML_3.99-0.16.1 lifecycle_1.0.4
[7] cluster_2.1.6 statmod_1.5.0 magrittr_2.0.3
[10] compiler_4.4.0 progress_1.2.3 rlang_1.1.4
[13] tools_4.4.0 igraph_2.0.3 utf8_1.2.4
[16] prettyunits_1.2.0 S4Arrays_1.4.1 DelayedArray_0.30.1
[19] plyr_1.8.9 abind_1.4-5 purrr_1.0.2
[22] grid_4.4.0 preprocessCore_1.66.0 fansi_1.0.6
[25] colorspace_2.1-0 ggplot2_3.5.1 iterators_1.0.14
[28] scales_1.3.0 MASS_7.3-60.2 cli_3.6.2
[31] mzR_2.38.0 crayon_1.5.2 generics_0.1.3
[34] rstudioapi_0.16.0 httr_1.4.7 reshape2_1.4.4
[37] ncdf4_1.22 DBI_1.2.3 affy_1.82.0
[40] stringr_1.5.1 zlibbioc_1.50.0 parallel_4.4.0
[43] impute_1.78.0 AnnotationFilter_1.28.0 BiocManager_1.30.23
[46] XVector_0.44.0 vsn_3.72.0 vctrs_0.6.5
[49] Matrix_1.7-0 jsonlite_1.8.8 hms_1.1.3
[52] MsExperiment_1.6.0 MALDIquant_1.22.2 clue_0.3-65
[55] foreach_1.5.2 limma_3.60.2 tidyr_1.3.1
[58] affyio_1.74.0 glue_1.7.0 MSnbase_2.30.1
[61] codetools_0.2-20 stringi_1.8.4 gtable_0.3.5
[64] UCSC.utils_1.0.0 mzID_1.42.0 munsell_0.5.1
[67] tibble_3.2.1 pillar_1.9.0 pcaMethods_1.96.0
[70] GenomeInfoDbData_1.2.12 R6_2.5.1 doParallel_1.0.17
[73] lattice_0.22-6 MetaboCoreUtils_1.12.0 Rcpp_1.0.12
[76] PSMatch_1.8.0 SparseArray_1.4.8 MsCoreUtils_1.16.0
[79] fs_1.6.4 pkgconfig_2.0.3

@YUANMENG-1
Copy link
Author

This bug was fixed in xcms, but this fixed but did not make it into the current release version of xcms. I included now the fix also into the release version and it should become available in version 4.2.2 within a couple of days. As a workaround, you can filter the data set first to MS1 data:

srn <- mse |>
    filterMsLevel(1L) |>
    filterRt(rt = c(620, 640)) |>
    filterMzRange(mz = c(100.300,100.330))

plot(srn)

I met the followings:
srn <- mse |>

  • filterMsLevel(1L) |>
    
  • filterRt(rt = c(620, 640)) |>
    
  • filterMzRange(mz = c(100.300,100.330))
    

Filter spectra
Filter spectra
Filter spectra
Error in validObject(object) :
invalid class “Spectra” object: slots in class definition but not in object: "processingChunkSize"

@jorainer
Copy link
Owner

OK, so, I guess you saved the mse variable and then updated the Spectra package. True, with the recent version we added a new property/slot to the Spectra object, that your saved/restored object does not have. You should be able to fix this with:

mse@spectra <- updateObject(mse@spectra)

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

No branches or pull requests

2 participants