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

There's something wrong with maxo's calculations. #759

Open
dongdongdong7 opened this issue Jul 31, 2024 · 5 comments
Open

There's something wrong with maxo's calculations. #759

dongdongdong7 opened this issue Jul 31, 2024 · 5 comments

Comments

@dongdongdong7
Copy link

Hello,

I'm having some problems.

When I finished finding peaks using findChromPeaks, I wanted to extract the corresponding peaks, so I used the function chromPeakChromatograms. the code ran fine, but the results were abnormal, the maximum intensity of most of the peaks did not agree with the result of findChromPeaks (maxo). What is the reason for this?

I also change the parameter aggregationFun, like "sum", "max", in chromPeakChromatograms, but the problem persists.

@jorainer
Copy link
Collaborator

This is indeed surprising - do you have a reproducible example for me to check? ideally using some of the data files from the msdata R package (thus no need to share data).

@dongdongdong7
Copy link
Author

That's so weird, I tested the example in msdata with the same process and everything works fine.

And this is my workflow:

msdata

mzMLpath <- file.path(find.package("msdata"), "iontrap")
mzMLpath
files <- list.files(mzMLpath, recursive = TRUE, full.names = TRUE)
pd <- data.frame(sample_name = sub(basename(files), pattern = patterns,
replacement = ""),
sample_group = c("QC", "QC", "QC", "QC"),
sample_type = rep("QC", 4),
sample_inject = c(1,2,3,4),
sample_path = files,
stringsAsFactors = FALSE)
pd <- dplyr::arrange(pd, sample_inject)
data <- MsExperiment::readMsExperiment(pd$sample_path, sampleData = pd)
cwp_opt_ms1 <- xcms::CentWaveParam(snthresh = 3.893,
noise = 1,
ppm = 180,
peakwidth = c(5, 10),
prefilter = c(3, 1),
integrate = 2L)
data <- xcms::findChromPeaks(data, param = cwp_opt_ms1, chunkSize = 4L, msLevel = 1L,
BPPARAM = BiocParallel::SnowParam(workers = 4L, type = "SOCK"))
pks_table <- xcms::chromPeaks(data)
chr <- xcms::chromPeakChromatograms(data, peaks = "CP0001")
xcms::plot(chr)
max(chr[1,1]@Intensity, na.rm = TRUE) # maxo = 509481

When I use my own data, which is a Waters MSe mode acquisition, the maxo of its primary chromatogram peaks (findChromPeaks) does not coincide with the highest point of the EIC (chromPeakChromatograms).

So I'm guessing it's due to the data, but I'm not sure why. msdata and MSe data I'm using the same cwp parameter for both.

@dongdongdong7
Copy link
Author

Can I share the data with you for a test?

@dongdongdong7
Copy link
Author

I changed the ppm parameter from 180 to 20 and everything is working fine. So the ppm parameter can't be set too large? And how do I get the limit of this value?

@jorainer
Copy link
Collaborator

jorainer commented Aug 5, 2024

Generally, the ppm should not be excessively large, but in the end it should somehow fit what you expect to see in your data. For higher resolution instruments you might want to use smaller values, but still larger than e.g. ppm = 5. For our data we generally use ppm (for CentWaveParam) between 20 and 40. Maybe also have a look at the respective section in our xcmsTutorials where we describe how to guess adequate values for ppm on the actual data set.

Also, if you say you have MSe data... I assume your data file distinguishes between the MS1 and MS2 spectra (i.e. you have MS1 and MS2 spectra once you import the data) and you perform the peak detection on MS1 data.

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