wkumler / squallms

Repository for the Bioconductor squallms R package
Other
3 stars 0 forks source link

Error in extractChromMetrics #13

Open pablovgd opened 1 week ago

pablovgd commented 1 week ago

Dear William,

I was messing around with squallms and stumbled on this error which I'm not able to fix easily. I've used squallms this way before without errors. Any idea what might be going on? Thanks in advance!

Cheers, Pablo

Error in `summarise()`:
ℹ In argument: `beta_vals = list(qscoreCalculator(rt, int))`.
ℹ In group 4128: `feature = "FT0052"` and `filename = "230626s380_QC1_29.mzXML"`.
Caused by error in `cor()`:
! incompatible dimensions
Backtrace:
  1. squallms::extractChromMetrics(feat_peak_info_subset, ms1_data = msdata$MS1)
 17. squallms:::qscoreCalculator(rt, int)
 18. stats::cor(perf_peak, int)
Error in summarise(., peak_mz = weighted.mean(mz, int), peak_rt = median(rt),  : 

ℹ In group 4128: `feature = "FT0052"` and `filename = "230626s380_QC1_29.mzXML"`.
Caused by error in `cor()`:
! incompatible dimensions

I followed the steps in the vignette .rmd:

feat_peak_info <- makeXcmsObjFlat(result) %>%
    select(feature, starts_with("mz"), starts_with("rt"), filename, filepath)
feat_peak_info %>%
    head() %>%
    mutate(filepath = paste0(substr(filepath, 1, 13), "~")) %>%
    knitr::kable(caption = "Output from makeXcmsObjFlat.")
feat_peak_info_subset <- feat_peak_info %>%
    filter(grepl("QC", filename))
msdata <- grabMSdata(unique(feat_peak_info_subset$filepath), verbosity = 0)
shape_metrics <- extractChromMetrics(feat_peak_info_subset, ms1_data = msdata$MS1)
wkumler commented 1 week ago

Phew, good question. I'm not sure what would actually be causing this but I know it's because somehow the retention time and intensity vectors are different lengths (the same error shows up when you do cor(1:2, 1:3). Some debugging info might be necessary and if you're willing to test some things then I might be able to push a bug fix or help you get around it.