Skip to main content
Topic: sequential addition of files to an xcms object (Read 5657 times) previous topic - next topic

sequential addition of files to an xcms object

I am interested to know whether there is a way to sequentially add files to an xcms object.  for example, I am running XCMS, I have completed feature finding on 10 files, and have the features grouped with retention time correction.  I now want to add file 11 to this xcms object.  From what I can tell, adding file 11 basically means that all the grouping and retention time correction are wiped from the xcms object to enable addition of an 11th file.  Is this accurate, or is there a way to do this that I am not thinking of?  Thanks,Corey

Re: sequential addition of files to an xcms object

Reply #1
As far as I'm aware this isn't possible. The retention time correction using the obiwarp method for example has to be reassessed with a new centre sample.
See the help file
Code: [Select]
?retcor.obiwarp
#center
#the index of the sample all others will be aligned to. If center==NULL, the sample with the most peaks is chosen as default
So the retention time deviation for each file has to be re-calculated.
Additionally for grouping the minfrac and minsamp arguments will be affected by additional samples in each group as you concatenate.
Code: [Select]
?group.density
#minfrac
#minimum fraction of samples necessary in at least one of the sample groups for it to be a valid group
#minsamp
#minimum number of samples necessary in at least one of the sample groups for it to be a valid group

It shouldn't be (computationally speaking) too much of a big deal to re-do the retention time correction and grouping each time you peak-pick an additional file(s). The most time-consuming part is definitely the xcmsSet function.

Re: sequential addition of files to an xcms object

Reply #2
You might be interested in an R package simExTargId I have been developing for real-time metabolomic experiment monitoring (with email notification) and MS/MS target identification. It makes use of xcms and CAMERA and sequentially concatenates xcmsSet objects as data is collected. It is still in development and has a few rough edges but it has been used regularly in our lab (it currently works for Agilent .d and Thermo .raw/.RAW data files).

Re: sequential addition of files to an xcms object

Reply #3
Thanks edmandsw,

I currently am using a custom script for feature grouping which simply assumes that if retention times overlap and mass windows (plus a given ppm error) overlap, the represent the same compound.  After each iteration, I apply a retention time adjustment  as well.  The tried-and-true XCMS functions are just much more well used and validated than my internal tools, so I was hoping there would be a way to utilize them that I had missed.   I will look at the package you are developing - it does look interesting! Are you aware of the skyline/panorama tool sets?  I know they are also working on vendor neutral QC monitoring.  Interested to see how yours compares.  

Corey

Re: sequential addition of files to an xcms object

Reply #4
I am interested in a similar issue.
For data analysis it would be nice to have blank samples in your dataset so that you can assess noise compared to sample values. But since there are no or few peaks, peak grouping and alignment has failed in my hands.

What would be nice to have is at least be able to add new samples and do a dump integration with fillPeaks on the new samples.
I have managed this by forcing the new files into the xcms object, faking scan times (raw/original and set the corrected RTs using the mean correction of the original set) but this is very dirty...

@johannes.rainer Any thoughts on whether something clean is feasible here?
Blog: stanstrup.github.io

Re: sequential addition of files to an xcms object

Reply #5
Just a heads up: I'm quite confident to find the time to work on this topic soon (see xcms issue https://github.com/sneumann/xcms/issues/335).

Re: sequential addition of files to an xcms object

Reply #6
The option to perform an alignment on a subset of samples (and adjust the retention times of the remaining samples to these) is now implemented in the current xcms development branch (https://github.com/sneumann/xcms). This will then be part of the official release in Bioconductor 3.9.


 

Re: sequential addition of files to an xcms object

Reply #7
Thanks Johannes, I'll definitely be checking this out.
We use data from blank+ISTD samples in our targeted metabolomics workflow extensively.