Skip to main content
Topic: error with "scanrange" variable of xcmsSet (Read 5946 times) previous topic - next topic

error with "scanrange" variable of xcmsSet

Okay, so my long post was apparently too daunting a wall of text so I'll break this into manageable bits, first:

Over 75% of my features end up being in two "ion rainbows", the first being the injection spike and the second being the requilibration portion at the end of all my runs.  As a result I basically start all my analysis by deleting 75% or more of my “data” in these locations in the diffreport.  The obvious thing to try to compensate for this was the “scanrange” variable. But any time I try something like:

Code: [Select]
C<-xcmsSet(step=0.5, scanrange = c(40,700))

I jut get the following error:
Code: [Select]
Sample1: Error in .local(object, …) :
  unused argument(s) (scanrange = c(40, 700))

Thoughts?

Re: error with "scanrange" variable of xcmsSet

Reply #1
My guess:

When you don't set the "method" in the xcmsSet the default method "matchedFilter" is used. The MatchedFilter method does not have a scanrange parameter.
You need to set method='centWave'. That is most often the superior method anyway.
Blog: stanstrup.github.io

Re: error with "scanrange" variable of xcmsSet

Reply #2
Okay, thanks that makes sense. I'll give that a try.

One question though, is the centWave method appropriate for particularly low res mass spectrometers? One of the reasons I was just using the default matchedFilter method is that the xcms manual suggests that pretty much all of the others were for high-res instruments, and as the
Code: [Select]
step=0.5
in my entry suggests this isn't exactly a precision instrument.

Re: error with "scanrange" variable of xcmsSet

Reply #3
Okay I tried running the setup of xcmsSet with the centWave method, but I am not sure I set it up properly for our low resolution instrument.  I tried
Code: [Select]
A<-xcmsSet(method="centWave", mzdiff = -0.5, ppm=4000, scanrange=c(40,800))
based on the crude estimate that our instrument has just under 0.5 ppm accuracy and variability (across the whole data set, not on a per scan nor likely on a per chromatogram basis.)

It churned through the data set but seemed upset about the ppm value, the results of all my chromatograms looked like this as they were processed
Code: [Select]
Some Sample:
  Detecting mass traces at 4000 ppm ...
  % finished: 0 10 20 30 40 50 60 70 80 90 100 Warning: there were 125126 peak data insertion problems.
  Please try lowering the "ppm" parameter.
 
  4275 m/z ROI's.
 
  Detecting chromatographic peaks ...
  % finished: 0 10 20 30 40 50 60 70 80 90 100
  613 Peaks.
Then following my attempt to use the "group" function (which, at least superficially, seems to run without errors) the retcor function just produced
Code: [Select]
Error in .local(object, ...)  : No group information found
Suggesting that things aren't in such great condition in the resulting xcmsSet object.

Thoughts?

Re: error with "scanrange" variable of xcmsSet

Reply #4
Similarly trying to do a diffreport with the above data after grouping but skipping the retcor step produces an error
Code: [Select]
Error in .local(object, ...) : No group information found
Looks like what I am doing with centWave (or possibly) group is VERY wrong and is just making a mess.

Re: error with "scanrange" variable of xcmsSet

Reply #5
Hi,

Is it possible that you sent the wrong xcmsSet object to retcor(),
i.e. not the one that resulted from the group() ? Can I see the full code snippet ?

Can I have a traceback() information after your last error ?
can I have the sessionInfo() output ?

Yours,
Steffen
--
IPB Halle                          Mass spectrometry & Bioinformatics
Dr. Steffen Neumann         http://www.IPB-Halle.DE
Weinberg 3 06120 Halle     Tel. +49 (0) 345 5582 - 1470
sneumann(at)IPB-Halle.DE

Re: error with "scanrange" variable of xcmsSet

Reply #6
Sure it does look like it is the same object though (I am trying to do things really as simple as possible so I am just using the nice simple generic object "A" for all my xcms work)  This is in the command line, so I'll put in my commands into the code block with the ">" to start off something I typed in and follow it with the output (abridged to the first object output in the case of long repetitive outputs such as xcmsSET).

Code: [Select]
> A<-xcmsSet(method="centWave", mzdiff=-0.5, ppm=4000, scanrange = c(40,800))
Sample1:
  Detecting mass traces at 4000 ppm ...
  % finished: 10 20 30 40 50 60 70 80 90 100 Warning: There were 116247 peak data insertion problems.
  Please try lowering the "ppm" parameter.

  4085 m/z ROI's

  Detecting chromatographic peaks ...
  % finished: 10 20 30 40 50 60 70 80 90 100
  322 Peaks.
  ##ABRIDGED ...
> group(A)
163 226 288 351 413 476 538 601 663 726 788 851 913 976
> retcor(A, family="s", plottype="m", method="linear")
Error in .local(object, ...) : No group information found
> group(A, bw=c(5,20), mzwid=0.5)
225 350 475 600 725 850 975
There were 50 or more warnings (use warnings() to see the first 50)
> retcor(A, family="s", plottype="m", method="linear")
Error in .local(object, ...) : No group information found
> Reporttab<-diffreport(A, "runs", "control", "centWaveTry1", 5)
Error in .local(object, ...) : No group information found

I just tried this all again except with "ppm=400" in the xcmsSet function and got basically all the same results except it found many fewer peaks in each file and didn't warn about setting the ppm low, but I still got the exact same resulting failure from group, retcor, ect...

Re: error with "scanrange" variable of xcmsSet

Reply #7
Two things:

before and after the group(), have a look what A is,
and optimize group() parameters so that afterwards
A actually *has* groups.

Second: Use

xr <- xcmsRaw("filename.cdf") and
plotRaw(xr, mzrange=c(200,210), rtrange=c(rtmin,rtmax), log=TRUE)

to have a look at the raw data, zoom into a typical region using the mz and rtrange.
Maybe you can reduce the ppm down to 1000 ?

Yours,
Steffen
--
IPB Halle                          Mass spectrometry & Bioinformatics
Dr. Steffen Neumann         http://www.IPB-Halle.DE
Weinberg 3 06120 Halle     Tel. +49 (0) 345 5582 - 1470
sneumann(at)IPB-Halle.DE

Re: error with "scanrange" variable of xcmsSet

Reply #8
Thanks Steffen,

  While waiting for your previous response I have already in the meantime played with the ppm value via trial and error to see right where things fall apart.  No mater how low I go with the ppm value though it doesn't effect the failure to group (again this is pre-your-recommendation to mess with the group function which I will try right after posting this).  I stop getting errors around ppm=700 (though again I still can't get grouping).  In the end though the ppm variable doesn't seem to be the primary source of my problems, you are right, my (likely improper) use of "group" is probably is where my issues are coming from.

  As for your plotRaw suggestion, please forgive my ignorance, but what exactly should I be looking for in the raw data plot from plotRAW?  What is the difference between the yellow and green dots on this scatter plot?  What I am noticing is that the data comes in bands grouped around masses, and I am guessing that I want is to get a good gauge of how wide those bands are near important peaks and set the ppm function accordingly.  In doing this, looking for a nice large signal I am seeing the vast majority of the dots on the band for that signal come between 393.15 and 393.40 so that would be about 636 ppm.  Stepping through scan by scan on a GUI browser to look for the single largest change between scans on the same peak I see the worst is 393.17 to 393.30, which would be about 330 ppm.  Similarly for a second peak, the plotRaw gives a band mostly between 195.0 and 195.20, which is about 1026 ppm and stepping in the GUI the worst per scan change is 195.17 to 195.25, which would be about 410 ppm. So the 700 ppm I got via trial and error looks like a fairly reasonable number (something >450 looks about right) though again, maybe I didn’t preform the analysis you were suggesting correctly as I am a bit new to all of this.

  I'll try playing with the group function now as you suggest.  I’ll route through the xcms manual to see what might be the best way to analyze “A” for groups it may or may not contain and they quality of them, but do you have any thoughts on simple code snippets for best way to look at “A” for its groups and quality thereof? If not that is fine, I feel bad about taking so much of your time with my ignorance, and I’ll monkey around until I get anything to do something more then what is happening currently)

 

Re: error with "scanrange" variable of xcmsSet

Reply #9
Is your data centroided or in profile mode? I really don't know much about low-resolution MS data, but I could imagine that centWave runs into problems even for low-res if the data isn't centroided.

Re: error with "scanrange" variable of xcmsSet

Reply #10
Quote
Is your data centroided or in profile mode?

  Oooh, good question, I'll have to look into that.  I didn't care before because the matchfilter method I was using didn't seem to mind whatever form I had the data in and it could give me results with it, but if that is an issue for centWave I'll have a look into now.

  Thanks for the suggestion.

Re: error with "scanrange" variable of xcmsSet

Reply #11
Yes, I just confirmed the data is cetroided before being saved, so whatever the issue I am having is it must be something else.