xcms
xcms copied to clipboard
XCMS/ Dimensions of profile matrices do not match !
Hi, Can someone help me? I am an amateur in coding. I am facing error in xsg2 part (below) says: Dimensions of profile matrices do not match ! Among samples, there is one with a higher number of features, when I remove that one, then the code works. How can I solve it while keeping that sample as well? since that one is a pooled sample. Here are my codes: xset <- xcmsSet (profmethod= "binlin", method="centWave", ppm = 20, peakwidth = c(3, 15 ), snthresh = 20, prefilter = c(3,1000), polarity = "negative", mzCenterFun="wMean", integrate = 2, mzdiff = 0.05, noise = 1000) xsg <- group(xset, bw = 5 , minfrac= 0.5 ) xsg2 <- retcor(xsg, method="obiwarp", plottype="deviation")
center sample: Pooled01 Processing: Matyash01
Create profile matrix with method 'bin' and step 1 ... OK Create profile matrix with method 'bin' and step 1 ... OK
Matyash02
Create profile matrix with method 'bin' and step 1 ... OK
Pooled02
Create profile matrix with method 'bin' and step 1 ... OK
Error in .local(object, ...): Dimensions of profile matrices do not match !
Traceback:
- retcor(xsg, method = "obiwarp", gapExtend = 2.1, plottype = "deviation")
- retcor(xsg, method = "obiwarp", gapExtend = 2.1, plottype = "deviation")
- .local(object, ...)
- do.call(method, alist(object, ...))
- retcor.obiwarp(object, ...)
- retcor.obiwarp(object, ...)
- .local(object, ...)
- stop("Dimensions of profile matrices do not match !\n")
Thank you in advance
Hi, the report here is a good start. Please report your versions from sessionInfo()
and avoid cross posting in two issues #312. Code can be nicely formatted by enclosing in backticks ``` . Yours, Steffen
Hi! Looks like I've faced the same issue
Here is my code, log file and libraries' versions are in the attachment
library(xcms)
library(BiocParallel)
library(IPO)
library(CAMERA)
register(MulticoreParam(24))
# Here goes selected mzfiles
mzfiles = # Here goes vector with 122 mzXML files including various quality controls; not included for brevity
xset <- xcmsSet(
files = mzfiles,
method = "centWave",
peakwidth = c(10, 40),
ppm = 11,
noise = 0,
snthresh = 10,
mzdiff = -0.00045,
prefilter = c(3, 100),
mzCenterFun = "wMean",
integrate = 1,
fitgauss = FALSE,
verbose.columns = FALSE,
BPPARAM= MulticoreParam(workers = 24L))
xset <- retcor(
xset,
method = "obiwarp",
plottype = "none",
distFunc = "cor_opt",
profStep = 1,
center = 5,
response = 1,
gapInit = 0.928,
gapExtend = 2.592,
factorDiag = 2,
factorGap = 1,
localAlignment = 0)
xset <- group(
xset,
method = "density",
bw = 2.5,
mzwid = 0.0044,
minfrac = 1,
minsamp = 1,
max = 50)
xset <- fillPeaks(xset)
path = 'data/pigs_lipidome/xcms_rdata/'
saveRDS(xset,file = paste0(path, 'M1_M2_neg1.Rdata'))
paste('saved at', path)
an_xset = xsAnnotate(xset)
# Group after RT value of the xcms grouped peak
an_group = groupFWHM(an_xset, perfwhm = 0.6)
# Annotate Isotopes
an_iso = findIsotopes(an_group, mzabs = 0.01)
# Verify grouping
an_corr = groupCorr(an_iso, cor_eic_th = 0.75)
# Annotate Adducts
an_add = findAdducts(an_corr, polarity="negative")
peaklist = getPeaklist(an_add)
write.csv(peaklist, file = paste0(path, 'M1_M2_neg1.csv'))
paste('saved at', path)
Dear @Serfentum from the log it looks that your error is different. Also, the retcor
obiwarp implementation differs now from the implementation for the new functions (i.e. adjustRtime
with ObiwarpParam
) and, due to time restrictions, I'm unable to also maintain the old functions (friendly suggestion to switch to the new functions - I can help if you need support on that).
Another observation: using 24 parallel processes seems a little too much to me. Do you have enough memory to load and process raw MS data of 24 files in parallel? Also note that this means that you are reading from 24 files in parallel and disk I/O can become an issue here.
Thank you for the response @jorainer ) Sorry for my inattention, I've send wrong log file. Thank you for the suggestions - I think there is enough memory (450G), will try to reduce processes number Here is a right log file Oh, I see, I'll rewrite the code, thank you)
Dear @jorainer , I'm sorry for disturbing you, but could you help me? I've tried to adjust my script to modified xcms interface and I failed. I've tried this, according to that manual
library(xcms)
library(BiocParallel)
library(IPO)
library(CAMERA)
mzfiles <- ... # some mz files
data = readMSData(mzfiles, msLevel = 1)
cent_wave_parameters = CentWaveParam(
ppm = 10,
peakwidth = c(10, 40),
snthresh = 10,
prefilter = c(3, 100),
mzCenterFun = "wMean",
integrate = 1,
mzdiff = -0.001,
fitgauss = FALSE,
noise = 0,
verboseColumns = FALSE
)
print(cent_wave_parameters)
chrom_peaks = findChromPeaks(data, param = cent_wave_parameters)
print(chrom_peaks)
xdata <- adjustRtime(xdata, param = ObiwarpParam(binSize = 0.6))
Ufortunately, even findChromPeaks function gives me an error
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘findChromPeaks’ for signature ‘"MSnExp", "CentWaveParam"’
Calls: findChromPeaks -> <Anonymous>
Execution halted
What am I doing wrong? Thank you
Hi, sorry for my late reply (holidays) - please use readMSData(mzfiles, mode = "onDisk")
to read the MS data. With that it should work. xcms
does not support having all the MS data in memory (the default if you are not using the option mode = "onDisk"
).