Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - Ricca

1
XCMS / xcmsRow mzrange
Hi, I would use xcmxRow() to read a .CDF file but, instead of to read all the file I would only read the file in a particular m/z range. 

This is the classic approach:
Code: [Select]
a <- xcmsRaw(myCDF)

An "xcmsRaw" object with 3238 mass spectra

Time range: 329.8-1439.9 seconds (5.5-24 minutes)
Mass range: 50-549.4 m/z
Intensity range: 150-4750850

MSn data on  0  mass(es)
with  0  MSn spectra
Profile method: bin
Profile step: 1 m/z (500 grid points from 50 to 549 m/z)
>
> dim(a@env$profile)
[1]  500 3238

I tried this code to select a particular m/z range but it doesen't work as expected:

Code: [Select]
xs <- xcmsRaw(myCDF, profparam=list(mzrange=100:400))
An "xcmsRaw" object with 3238 mass spectra

Time range: 329.8-1439.9 seconds (5.5-24 minutes)
Mass range: 50-549.4 m/z
Intensity range: 150-4750850

MSn data on  0  mass(es)
with  0  MSn spectra
Profile method: bin
Profile step: 1 m/z (500 grid points from 50 to 549 m/z)
Profile parameters: mzrange = 100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400

>
> dim(a@env$profile)
[1]  500 3238

Unexpectedly the dimension of the resulting data matrix is the same.

Where do I wrong?

Is there another way to do this?

All the best
2
XCMS / QQQ MRM data
Hi, I'm working with MRM data and I would analize them using xcms. I have encountered some trouble and I'm not still able to read the data using xcms. I've searched into the forum to try to understand if xcms is able to work with MRM data or not but, I haven't found any recent discussion about that...

This is what I've done:
    1 - MRM data aquired with AB-Sciex QQQ
    2 - wiff file converted using msConvert (ProteoWizard) into mzML.

Now when I try to run xcmsRaw I obtain this:
Code: [Select]
[SpectrumList_mzML::spectrum()] Index out of bounds.

Seems that no spectral information are contained into the mzML file but, if I try to open it using seeMS from proteo wizard I see all my MRM experiment...

Have you ever experienced a problem like this??

All the best
3
XCMS / fillPeaks question
Hi to everybody, I have a question about the results od the fillPeaks() step.
Reading the description of the function I understand that it identify peak groups where that sample is not represented and it integrate the signal in the region of that peak group and create a new peak. So I belive that all the samples should have the same number of peaks, i.e. all the samples ha the same lenght. But if I take a look at the dimension of the peak slot after the fillPeak() step, all the samples have a different lenght, i.e. a different number of peaks.

Can you explain it to me? Is it a normal behaviour?

Best Regards, Riccardo
4
XCMS / Re: xcmsRaw and obiwarp
My intent is to apply the obiwarp time correction to a several GCMS samples. I can not use use a xcmsSet object to apply the time warp because, as a previous step, I do some pre-treatment/corrections to each chromatogram. 

Quote
[...]obiwarp can only be applied to pairs of samples, retcor.obiwarp calculates retention time correction as a center-star alignment, [...]

As a next step I will write some piece of code to loop the correction to all my data-set and update the retention times of each chromatogram.
5
XCMS / Re: xcmsRaw and obiwarp
The fact is that I do the feature detection using several xcmsRaw object. I would like to understand which slot should I use to perform retcor.obiwarp() 'by hand'.

Riccardo
6
XCMS / Re: xcmsRaw and obiwarp
Hi,
thanks for your suggestion. I tried retcor.obiwarp() in the R console but I get the following error:

> retcor.obiwarp()
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘retcor.obiwarp’ for signature ‘"missing"’

Any suggestion?

Best Regards,
Riccardo
7
XCMS / Re: xcmsRaw and obiwarp
Hi,
I generally use the xcmsSet approach but, in some cases, I have to perform some specific operation to the raw data so I prefear to use the xcmsRaw approach.

What about a slow answer?  ;)

 Best Regards, Riccardo
8
XCMS / xcmsRaw and obiwarp
Hi, I have several xcmsRaw object that I would like to align using the obiwarp method. Is there a way to do this without using xcmsSet?

Best Regards
Riccardo
9
CAMERA / Deconvolution of EI-GC-MS spectra
Hi, I would use CAMERA to deconvolute EI-GC-MS chromatograms, i.e.separate co-eluting peaks. So my idea is to extract all the ion traces with xcms and group it together using CAMERA-groupFWHM(). The problem is that I obtain only a low number of preudospectra with more than six ions. This is not possible for EI ionization technique.

Code: [Select]
## xcms ##
xset <- xcmsSet(files = files, nSlaves = slaves, method = 'matchedFilter',## sleep = 3,
                snthr = 1, fwhm = 10, step = .5, steps = 2, mzdiff = 0, max = 500)
xset <- group(xset, method = 'density', bw = 30, mzwid = 1, minfrac = 1, ## sleep = 3,
                max = 500)
xsetRT <- retcor(xset, method = 'loess', family = 'gaussian')
plotrt(xsetRT, leg = FALSE, densplit = TRUE)
xsetRT <- group(xsetRT, method = 'density', bw = 10, mzwid = 1, minfrac = 1, ## sleep=5,
                max = 500)
xsetFP <- fillPeaks(xsetRT)

## camera ##
xsA <- annotate(xsetFP, nSlaves = slaves, sigma = 3, perfwhm = .06, calcCaS = TRUE, mzabs = 1,
                ppm = 100, sample = c(1:3), quick = TRUE, intval = 'maxo', max_peaks = 500,)

## number of pseudospectra with more than 6 ions
data <- getPeaklist(xsC)
data$pcgroup <- as.numeric(data$pcgroup)
(a <- which(table(data$pcgroup) >= 6))
length(a)

I tried to play with the perfwhm parameter but I have't obtained significative changes.

Have you some suggestion?
10
XCMS / Re: GC-MS Metabolomics: Supervised vs. Unsupervised Approach
Paul,
I found very interesting the discussion you suggest me, but I haven't found any suggestion about the extraction of the area of the grouped spectra. I would like to group the ions in the time domain, using their retention time, and extract them so to re-construct the EI mass spectra such to separate co-eluting peaks.
How can I use the information in the xcmsSet object?

In the xcmsSet object I have:

Code: [Select]
Time range: 153.8-3039 seconds (2.6-50.6 minutes)
Mass range: 31.1-348.7638 m/z
Peaks: 25337 (about 4223 per sample)
Peak Groups: 2004
Sample classes: crtz_VOCs

Does 'Peak Groups' contains the ions grouped according with their retention time?

Riccardo

-- EDIT --

I played with the xcms parameter and I noticed better results using the matchedFilter approach instead of centWave. This because I obtain more 'realistic' EI mass spectra with more fragment. So this are the new settings I'm using:

Code: [Select]
## xcms ##
xset <- xcmsSet(files = files[1:3], nSlaves = slaves, method = 'matchedFilter',## sleep = 3,
                snthr = 1, fwhm = 10, step = .5, steps = 2, mzdiff = 0, max = 500)
xset <- group(xset, method = 'density', bw = 30, mzwid = 1, minfrac = 1, ## sleep = 3,
                max = 500)
xsetRT <- retcor(xset, method = 'loess', family = 'gaussian')
plotrt(xsetRT, leg = FALSE, densplit = TRUE)
xsetRT <- group(xsetRT, method = 'density', bw = 10, mzwid = 1, minfrac = 1, ## sleep=5,
                max = 500)
xsetFP <- fillPeaks(xsetRT)

## camera ##
xsA <- annotate(xsetFP, nSlaves = slaves, sigma = 3, perfwhm = .06, calcCaS = TRUE, mzabs = 1,
                ppm = 100, sample = c(1:3), quick = TRUE, intval = 'maxo', max_peaks = 500,)

11
XCMS / GC-MS Metabolomics: Supervised vs. Unsupervised Approach
Hi, I would like to discuss with you about the data pre-processing in a metabolomic experiment performed using GC-MS. In my experience we have two possibility: a supervised method, using a 'direct approach' to each chromatogram, for example using AMDIS for the spectral deconvolution to separate the co-eluting compounds; and an unsupervised approach using a dynamic programming method, i.e. xcms.

I'm working on the same data set using both approach but, I'm not been able to obtain comparable results. In particular using AMDIS I have extracted about 180 different compounds while, using xcms-CAMERA, I'm not been able to extract more than 35 compounds. This is the code I used:

Code: [Select]
## xcms
xset <- xcmsSet(files, nSlaves = slaves, method = 'centWave', ppm = 100, peakwidth = c(3,10),
                snthr = 3, integrate = 1, prefilter = c(3,100), noise = 0)
xsetRT <- retcor(xset,  method = 'obiwarp', profStep = 1, plottype = 'none')
plotrt(xsetRT, leg = FALSE, densplit = TRUE)
xsetRT <- group(xsetRT, method = 'density', minfrac = 0.5, bw = 30, mzwid = 0.25,
              max = 100, minsamp = 1)
xsetF <- fillPeaks(xsetRT)
## camera
xsA <- annotate(xsetF, nSlaves = slaves, perfwhm = .6, calcCaS = TRUE, mzabs = 0.1,
                ppm = 100)

Further I wrote a little code to extract only the groups with a minimum number of ions, i.e. 6 ions, because using an electron ionization source, I haven't only the molecular ion, but I have a lot of fragments.

Code: [Select]
data <- getPeaklist(xsA)
data$pcgroup <- as.numeric(data$pcgroup)
(a <- which(table(data$pcgroup) >= 6))
length(a)

My intent is to replicate the deconvolution approach of AMDIS using xcms-CAMERA.

What is your opinion??
Have you ever tryed to use xcms with GC-MS data?? Which results did you obtained??

How can I improve the code I wrote to obtain better results??
12
XCMS / Re: Warning problem after fillPeaks
Hi, using the code you suggested I obtain this:

[attachment=0:2zbklhg4]FirstScan.png[/attachment:2zbklhg4]

All the first scan is within the range in which fillPeaks works (i.e. ... Peak m/z:397.366577148438-397.368316650391, RT:364.471-378.604is out of retention time range for this sample...). So should I conclude that mass aren't present in that sample??

Best
Riccardo

[attachment deleted by admin]
13
XCMS / Re: Warning problem after fillPeaks
I sow that all chromatograms "start" at 6 minutes (360s) and the problem is relative to a time window of RT:364.471-392.215. Could it be this the problem?

Moreover the files are ok, I visually checked them.
14
XCMS / Re: Warning problem after fillPeaks
Before I start work I check all the file using a Paul Benton's function:

Code: [Select]
CheckCDFfile <- function(file, type=".mzdata"){
    cat("n")
    cat(paste("Loading File:", file, sep=""))
    xr <- xcmsRaw(file, profstep=0)
    for(i in 1:length(xr@scanindex)){
        scan <- getScan(xr, scan=i)
        if(is.unsorted(scan[,"mz"]) == TRUE){
            cat(" x ")
            newfile <- sub(type, "-Fixed.mzdata",
                          file, ignore.case=TRUE, fixed=TRUE)
            write.mzdata(xr, newfile)
            file.copy(file, sub(type, ".OLD", file, ignore.case=TRUE))
            unlink(file)
            return(1)}
        if(i == length(xr@scanindex)){
            cat(" O ")
            return(0)}}}
###
sapply(files, CheckCDFfile)

All seems to be ok.
15
XCMS / Warning problem after fillPeaks
Hi all,
I have some problems after the fillPeaks. This is the code I work with:

Code: [Select]
xset <- xcmsSet(files, method="centWave", snthresh=10, ppm=10, mzdiff=0.01,
                prefilter=c(3,500), peakwidth=c(10,60), nSlaves=4)
idx<-which(xset@peaks[,"mz"] > 100 & xset@peaks[,"mz"] < 1000)
xset@peaks<-xset@peaks[idx,]
xsetR <- retcor(xset, method="obiwarp", profStep=0.1, plottype="deviation")
xsetR <- group(xsetR, bw=5, mzwid=0.025,  minsamp=5)
xsetF <- fillPeaks(xsetR)

I have this warning message after the fillPeaks step:

There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In .local(object, ...) :
  getPeaks: Peak  m/z:397.366577148438-397.368316650391,  RT:364.471-378.604is out of retention time range for this sample (/home/cism/Documents/Controllo10.mzXML), using zero intensity value.

2: In .local(object, ...) :
  getPeaks: Peak  m/z:479.481033325195-479.483581542969,  RT:364.471-391.31is out of retention time range for this sample (/home/cism/Documents/Controllo10.mzXML), using zero intensity value.

3: In .local(object, ...) :
  getPeaks: Peak  m/z:480.484039306641-480.487976074219,  RT:364.471-392.215is out of retention time range for this sample (/home/cism/Documents/Controllo10.mzXML), using zero intensity value.

4: In .local(object, ...) :
  getPeaks: Peak  m/z:610.453125-610.457580566406,  RT:364.471-383.212is out of retention time range for this sample (/home/cism/Documents/Controllo10.mzXML), using zero intensity value.

5: In .local(object, ...) :
  getPeaks: Peak  m/z:617.063537597656-617.069519042969,  RT:364.471-376.196is out of retention time range for this sample (/home/cism/Documents/Controllo10.mzXML), using zero intensity value.

6: In .local(object, ...) :
  getPeaks: Peak  m/z:713.638122558594-713.643371582031,  RT:364.471-398.001is out of retention time range for this sample (/home/cism/Documents/Controllo10.mzXML), using zero intensity value.

7: In .local(object, ...) :
  getPeaks: Peak  m/z:798.143920898438-798.152557373047,  RT:364.471-376.5195is out of retention time range for this sample (/home/cism/Documents/Controllo10.mzXML), using zero intensity value.

......

So, I think there is a specific problem, for example, in the file called  Controllo10.mzXML, but clustering the RT differences it seems that the groups aren't too different.

Code: [Select]
minlength <- min(sapply(xsetR@rt$raw, length ))
devs <-
    sapply(1:length(xsetR@rt$corrected),
          function(x){
              (xsetR@rt$raw[[x]]-xsetR@rt$corrected[[x]])[1:minlength]})
colnames(devs) <- sampnames(xsetR)
ddevs <- dist(t(devs))
hdevs <- hclust(ddevs)
x11(); plot(hdevs)

The result of the clustering analysis is:

[attachment=1:29id13si]HCluster.png[/attachment:29id13si]

And this is the result of the retcor step:

[attachment=0:29id13si]RTDev.png[/attachment:29id13si]
 
Do you have any suggestion to try to solve this kind of problem?? Should I discard from my dataset the sample in the warning message??

Best
Riccardo

P.S. This enormous problem in the RT are due to the use of a HILIC LC column...  :evil:

[attachment deleted by admin]