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 - nate

1
XCMS / Re: How are XCMS's retention times calculated
I have some updated information and refined questions.

The reported RT of a peak is the RT of the scan which lies halfway between the peak bounds as determined by centWave (scmin/scmax). An interesting, related point is that peaks are always defined as an even number of scans wide.  This also means that the resolution of retention time is at best the scan rate.

I would like to do my own analysis of the peaks.  But a stumbling point for me is the disparity between scmin/scmax (peak limits found by wavelets) and the rtmin/rtmax. 
Could someone help me understand how rtmin/rtmax are determined?

Scmin/scmax also return -1 in some cases - which precludes my analysis using them.
Why does this occur and do you have a suggestion for peak bounds to use in these cases? (rtmin/rtmax seem insufficient in cases as above, where the bounds are much larger than the peak)

How are lmin/lmax involved?

Thanks much,
Nathaniel
2
XCMS / How are XCMS's retention times calculated
Hi All,

I'm noticing some strange things regarding the reported RTs (xcmeSet@peaks[,"rt"]) from XCMS.  I'm using findPeaks.centWave.

My initial confusion was from the following data, a plot of the retention time difference between a M+0 peak and its isotope.  You can see the retention times come in discrete chunks rather than being continuously distributed.

[attachment=2:3bz8gt4p]discrete.png[/attachment:3bz8gt4p]

The bins appear to correspond to my scan rate which made me question how the RTs were being calculated - so I tried to figure out how this was done.  Unfortunately none of my methods reproduced the reported

[attachment=1:3bz8gt4p]a peak.png[/attachment:3bz8gt4p]
Black: xcms reported RT
Blue: Peak centroid (of all points within rtmin:rtmax and mzmin:mzmax using rawEIC)
Red: Peak maxo
Green: Half way through peak (rtmin:rtmax)


Additionally, I was surprised at how far off some the peaks were from my calculated centroid. For example this was good shaped peak where I can't figure out what the reported RT corresponds to.
[attachment=0:3bz8gt4p]rt_calc.png[/attachment:3bz8gt4p]

In summary:
1. How is the reported RT chosen - should it not be a continuous variable?
2. What do rtmin/rtmax correspond to (these are the limits of the above EICs)?

Thanks!
Ps.  I did not find the answer to these questions in the centWave paper.

[attachment deleted by admin]
3
CAMERA / Re: Peak - adduct relationships
This got several views so I got around to doing this and here is my solution.

an@derivativeIons is a list with each item corresponding to a peak from the xcmsSet peaktable.  It contains a rule-based annotation for each peak as an adduct, NL, etc.  Each of these annotations links an ion in a dataset a (Eg. M+H) to a corresponding neutral mass (M).  I was hoping to retrieve these relationships, specifically the M+H and M+Na that both predict the same mass (M), rather than the isolated peak's annotation as found in an@derivativeIons.

In case anyone else wants to do this, here is a simple search for these relationships.

First we collect all the annotations and their predicted neutral masses:

Code: [Select]
  
  an = xsAnnotate
 
  all_masses = do.call("rbind", lapply(1:length(an@pspectra), function(x) {
    neutral_masses = do.call("rbind", lapply(an@pspectra[[x]], function(y) {
      do.call("rbind", lapply(an@derivativeIons[[y]], function(z) {
        cbind(neutral = z$mass, rule = z$rule_id, peaknum=y, psg = x)
      }))
    }))
  }))
 

This looks like:

Code: [Select]
> head(all_masses)
      neutral rule peaknum psg
mass 401.3136    7    234  1
mass 670.6027    1    236  1
mass 401.3136    1    248  1
mass 670.6027  37    259  2
mass 498.3887  12    274  2
mass 451.3561    7    281  3

This is then easy to search however you like.  To find all the M-H and M+Cl's that predict the same parent mass (and are in the same psg).

Code: [Select]
  withinppm = function(m1, m2, ppm=20) {   abs(m1-m2)/m1*1E6 < 20   }

  hcl_pairs = do.call("rbind",lapply(which(all_masses[,"rule"] == 1), function(x) {
    mh = all_masses[x,,drop=F]
    a_pair = all_masses[
                      all_masses[,"psg"] == mh[,"psg"] &
                      withinppm(all_masses[,"neutral"], mh[,"neutral"]) &
                      all_masses[,"rule"] == 7,
                     
                      ,drop=F]
   
    if(nrow(a_pair) < 1) {return(NULL)}
   
    cbind(neutral=mh[,"neutral"],psg = mh[,"psg"], mh_peaknum = mh[,"peaknum"], mcl_peaknum = a_pair[,"peaknum"])
   
  }))

This looks like:

Code: [Select]
> head(hcl_pairs)
  neutral psg mh_peaknum mcl_peaknum
 401.3136  1        248        234
 882.6437  3      9228        9193
 856.5924  4      1946        1982
 886.5545  4      1981        1984
 713.4113  7      9483        9397
 443.3272  8      3144        2666

Disclaimer: This isn't an optimized way to search, but its functional and fast enough on my laptop.  I'm also not an R guru so suggestions are welcome.

Nate
4
CAMERA / Peak - adduct relationships
Hello all,

In working with CAMERA data I have been attempting to find hydrogen adducts and their corresponding sodium adducts.  I am wondering if this relationship is stored in the xsAnnotate object anywhere or if I should just repeat the search myself.

I currently find sodium adducts via rule_id as stored in an@derivativeIons.  I can then find hydrogen adducts within that psg in the same manner.  I am wondering if the information linking a specific M+H to its M+Na (or eg. M+Na to M+K) is stored anywhere?  I havent been able to find it - an@annoID$parentID isn't populated and no other an@derivativeIons fields seem applicable.

Thanks for the help,
Nate