Metabolomics Society Forum

Software => R => Topic started by: genefisher on August 11, 2019, 02:14:48 AM

Title: Looking for help: Dimensions of profile matrices do not match !
Post by: genefisher on August 11, 2019, 02:14:48 AM
Hey Everyone,

I met very strange problem, I can not fix by myself now. I am urgently looking for help.

I divided my samples(650 samples) into two sub groups named mock and treatment and then put them into one folder to run XCMS.

When I run mock(325 samples) independently, the XC MS runs well and it works fine for me.

When I run treatment(325 samples) independently, the the XC MS also .runs well.

However, when I run mock and treatment samples(650 samples) together, the XC MS shows error as follows:

Control0h_L1-50_BD7_01_38715  Create profile matrix with method 'bin' and step 0.1 ... OK
Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-51_BE7_01_38716  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-52_BF7_01_38717  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-53_BG7_01_38718  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-54_BH7_01_38719  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-55_BA8_01_38720  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-56_BB8_01_38721  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-57_BC8_01_38722  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-58_BD8_01_38723  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-59_BE8_01_38724  Create profile matrix with method 'bin' and step 0.1 ... OK
Control0h_L1-6_BG1_01_38666  Create profile matrix with method 'bin' and step 0.1 ... OK
Found gaps: cut scantime-vector at  1399.01 seconds
Control0h_L1-60_BF8_01_38725  Create profile matrix with method 'bin' and step 0.1 ... OK
Error in .local(object, ...) :
  Dimensions of profile matrices do not match !
> xset3 <- group(xset2, method="density", mzwid=0.01, sleep=0.001,
+                minfrac=0.1, minsamp=1, bw=5)
Error in group(xset2, method = "density", mzwid = 0.01, sleep = 0.001,  :
  object 'xset2' not found
> xset4 <- fillPeaks(xset3)
Error in fillPeaks(xset3) : object 'xset3' not found
> an <- xsAnnotate(xset4)
Error in xsAnnotate(xset4) : object 'xset4' not found
> anF <- groupFWHM(an, perfwhm = 0.6)
Error in groupFWHM(an, perfwhm = 0.6) : object 'an' not found
> anI <- findIsotopes(anF, mzabs=0.01)
Error in findIsotopes(anF, mzabs = 0.01) : object 'anF' not found
> anIC <- groupCorr(anI, cor_eic_th=0.75)
Error in groupCorr(anI, cor_eic_th = 0.75) : object 'anI' not found
> anFA <- findAdducts(anIC, polarity="positive")
Error in findAdducts(anIC, polarity = "positive") :
  object 'anIC' not found
> write.csv(getPeaklist(anFA), file="data.csv")
Error in getPeaklist(anFA) : object 'anFA' not found



Many thanks for you inadvance!

Have a nice weekend.
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: Jan Stanstrup on August 11, 2019, 06:02:06 AM
Using orbiwarp? Try the loess retcor instead.

https://github.com/sneumann/xcms/issues/194
https://github.com/rietho/IPO/issues/43
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: genefisher on August 11, 2019, 06:07:34 AM
Many thanks for your reply, Jan.
Yes, I use orbiwarp, I use both of rector and orbiwarp to try it, but it does`s works.
Here is my R script, could you please help me to check what is the probelm?
library (xcms)
library (CAMERA)
xset <- xcmsSet(method="centWave", ppm=20, snthresh=10, peakwidth=c(5,18))
xset1 <- group(xset, method="density", minfrac=0.1, minsamp=1, bw=10,
mzwid=0.01, sleep=0.001)
#xset2 <- retcor(xset1, family= "s", plottype= "m", missing=1, extra=1,
span=1)
xset2<-retcor(xset1,method="obiwarp",profStep=0.1,plottype="deviation")
xset3 <- group(xset2, method="density", mzwid=0.01, sleep=0.001,
minfrac=0.1, minsamp=1, bw=5)
xset4 <- fillPeaks(xset3)
an <- xsAnnotate(xset4)
anF <- groupFWHM(an, perfwhm = 0.6)
anI <- findIsotopes(anF, mzabs=0.01)
anIC <- groupCorr(anI, cor_eic_th=0.75)
anFA <- findAdducts(anIC, polarity="positive")
write.csv(getPeaklist(anFA), file="data.csv")

Many thanks
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: Jan Stanstrup on August 11, 2019, 06:41:54 AM
Hi Gene,

Do you mean that you get the same error when you do


Code: [Select]
xset2 <- retcor(xset1, family= "s", plottype= "m", missing=1, extra=1, 
span=1)
as when you do

Code: [Select]
xset2<-retcor(xset1,method="obiwarp",profStep=0.1,plottype="deviation")
?
That would be very unusual I think.
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: genefisher on August 11, 2019, 07:03:27 AM
Thank you, Jan.

Yes, I have try both:
xset2 <- retcor(xset1, family= "s", plottype= "m", missing=1, extra=1,
span=1)
xset2<-retcor(xset1,method="obiwarp",profStep=0.1,plottype="deviation")

The XC MS shows the same error.
Error in .local(object, ...) :
  Dimensions of profile matrices do not match !
Do I need to change some parameters to try it?

Many thanks
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: genefisher on August 11, 2019, 11:17:56 AM
I use density method to analyze the data, It shows error:

> xset1 <- group(xset, method="density", minfrac=0.1, minsamp=1, bw=10,
+                mzwid=0.01, sleep=0.001)
Processing 263643 mz slices ... OK
> xset2 <- retcor(xset1, family= "s", plottype= "m", missing=1, extra=1,
+                 span=1)
Error in do_adjustRtime_peakGroups(peaks = peakmat, peakIndex = object@groupidx,  :
  No peak groups found in the data for the provided settings
> xset3 <- group(xset2, method="density", mzwid=0.01, sleep=0.001,
+                minfrac=0.1, minsamp=1, bw=5)
Error in group(xset2, method = "density", mzwid = 0.01, sleep = 0.001,  :
  object 'xset2' not found
> xset4 <- fillPeaks(xset3)
Error in fillPeaks(xset3) : object 'xset3' not found
> an <- xsAnnotate(xset4)
Error in xsAnnotate(xset4) : object 'xset4' not found
> anF <- groupFWHM(an, perfwhm = 0.6)
Error in groupFWHM(an, perfwhm = 0.6) : object 'an' not found
> anI <- findIsotopes(anF, mzabs=0.01)
Error in findIsotopes(anF, mzabs = 0.01) : object 'anF' not found
> anIC <- groupCorr(anI, cor_eic_th=0.75)
Error in groupCorr(anI, cor_eic_th = 0.75) : object 'anI' not found
> anFA <- findAdducts(anIC, polarity="positive")
Error in findAdducts(anIC, polarity = "positive") :
  object 'anIC' not found
> write.csv(getPeaklist(anFA), file="data.csv")
Error in getPeaklist(anFA) : object 'anFA' not found
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: Jan Stanstrup on August 11, 2019, 02:19:40 PM
Sounds like it is saying you didn't get any groups from the group function. If you just write
Code: [Select]
xset1
in the console it should tell you if there are any groups.
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: genefisher on August 12, 2019, 01:44:19 AM
Hi Jan,

When I type xset1, it shows as follow:

An "xcmsSet" object with 1356 samples

Time range: 2.1-1502.6 seconds (0-25 minutes)
Mass range: 81.5189-1399.7288 m/z
Peaks: 4316671 (about 3183 per sample)
Peak Groups: 5144
Sample classes: Mixed

Feature detection:
 o Peak picking performed on MS1.
Profile settings: method = bin
                  step = 0.1

Memory usage: 410 MB

Do you know what the problem is?

Many thanks
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: Jan Stanstrup on August 12, 2019, 05:04:51 AM
It shows that indeed grouping did make groups. So I guess retcor must mean that non of those groups adhere to the missing and extra requirements. Try increasing those. You have a lot of samples. So you are requiring that for a peak to be used for the correction model all samples, except 1, has found the peak. And that groups where, in any 1 sample, more than one peak was merged in a peak group, cannot be used either.

try something like this as a starting point:

Code: [Select]
missing  = 200
extra   = 100

If you are including very sparse samples, like artificial mixtures or blanks, you might need to go even higher.
span =1 is also very strict but should not affect the error.
Title: Re: Looking for help: Dimensions of profile matrices do not match !
Post by: genefisher on August 22, 2019, 11:41:44 AM
Hi Jan,

I just came back in the lab. I use your suggestions to run again. It works very well now.

Many thanks for your help! :)