-
Notifications
You must be signed in to change notification settings - Fork 2
Peak Group Identification
Feature finding is performed by the pickTransitionGroup() method (invoked by scoreAllChromatograms_) which is found in the MRMTransitionGroupPicker module.
Peak picking is performed by the pickChromatogram function which takes a chromatogram as input and returns a smoothed version of the chromatogram as well as any peaks (defined by an apex and left and right bounds). found in the chromatogram. computes all peaks. This function is found in the PeakPickerMRM module. Peak picking is only performed for transitions labelled as detecting.
The S/N ratio represents the ratio between the target intensity and the background noise. In this case, S/N is computed for each point by using the point's intensity as its signal and dividing this by the estimated noise, which is computed using a median histogram apporach.
If the signal_to_noise parameter is set > 0, then a SignalToNoiseEstimatorMedian<MSChromatogram> S/N will be computed using the computeSTN_() which computes S/N using a sliding window approach.
- Compute the
max_intensity. Any intensities above themax_intensitywill be added to the last histogram bin. This depends on the mode set.-
AUTOMAXBYSTDEV(default)- Guassian Estimator on raw data
-
max_intensity=mean+sqrt(variance+auto_max_stdev_Factor_
-
AUTOMAXBYPERCENT=max_intensityis the intensity at a certain percentile -
MANUAL=max_intensityis set manually
-
- For each datapoint in the chromatogram
- Collect a range of data points around it (dependent on
win_len). - Noise = median of the intensities in the current window OR
noise_for_empty_windowif there is not a sufficient number of points in the window< min_required_elements - Divide target's intensity by the computed noise
- Collect a range of data points around it (dependent on
Smoothing is done directly in the pickChromatogram. The default is to smooth using SGolay.
-
SGolay (using filter(chromatogram) ) - enabled using
-PeakPickerMRM::use_gauss false -
Gaussian (using filter(chromatogram)) - enabled by setting
PeakPickerMRM::use_gauss True - Crawdad - enabled by setting
-PeakPickerMRM::methodtocrawdad- If smoothing is done with crawdad, all peak picking is done with the pickChromatogramCrawdad_() function
C. Find peak seeds (apex) in the chromatogram (pick_())
Peak picking seeds is done using the pick_() method in PeakPickerHiRes. Although this method also computes the peak boundaries, this output is not used by OpenSwath since OpenSwath has its own peak boundary detection methods discussed below. Thus, we will not discuss peak boundary detection here.
A peak maximum is defined a point which:
- Has a greater intensity intensity than its left and right neighbour
- Oscillation is not occuring
- Oscillation is defined as
- Left peak neighbour is less than the point to its left
- Right neighbour is less than the point on its right
- These left-by-2 and right-by-2 points are greater than the s/n cutoff
- Oscillation is defined as
- Is above the S/N cutoff
- Left and right neighbours are above the S/N cutoff
Notes
- This function fethces RT values using the getMZ() method
- S/N cutoff is specified by
PeakPickerMRM:signal_to_noise
D. Compute Peak Boundaries (pickChromatogram_)
-
It seems as though the peak boundaries from above are not saved just the peak maximum and the maximum intensities
-
However above only the retention time is recorded, so use findClosestPeak in order to find the index of the maximum retention time.
-
Extend the peak to the left and the right
- Peak is extended as long as
- point to be appended is of lower intensity than the previous point OR the peak is smaller than the minimum peak width specified with
peak_width- by default there is no minimum peak width
- point to be appended is of lower intensity than the previous point OR the peak is smaller than the minimum peak width specified with
- Peak is extended as long as
-
Here record the index of the left_bound and the index of the right_bound
Overlaps are removed by the removeOverlappingPeaks_() function (invoked by pickChromatogram_()). Overlaps are only removed if PeakPickerMRM::remove_overlapping_peaks is true.
Overlapping peaks are defined as the current peak left bounds is greater than the next peak's right bounds. If peaks are overlapping, adjust the borders so that they are not overlapping anymore.
For each peak boundaries, sum the signals across intensity this is done in the integratePeaks_ method (invoked by pickChromatogram_()).
For each peak in the chromatogram save the peak left boundary, peak right boundary and the integrated intensity.
In order to prepare for the creation of an MRMFeature first the top peak in the transition group is determined.
The top peak can be determined in 2 ways, specified by the -TransitionGroupPicker::boundary_selection_method argument. The default is largest. The functions below are invoked by pickTransitionGroup().
-
largest- Use the (transition, peak) combination with the highest intensity as the referecne peak findLargestPeak() -
widest- Use the (transition, peak) combination with the widest chromatogram as the reference peak (findWidestPeakIndices)
3. Create MRM Feature (createMRMFeature())
This is done using the createMRMFeature() method which takes in the transition_group, chromatograms and the (transition,peak) index of the "best" peak and returns an MRMFeature.
Features will continue to be created as long as:
- Peaks remain
- Did not exceed the maximum number of reported features (specified by
TransitionGroupPicker::stop_after_feature) - Intensity / total XIC is grater than threshold (specified by
TransitionGroupPicker::??)- do not really get this because intensity and total xic are then same?
A. Determining the transition group boundaries (recalculatePeakBorders_())
Peak boundaries are recomputed using the recalculatePeakBorders_() function. This only occurs if -TransitionGroupPicker::use_consensus and TransitionGroupPicker::recalculate_peaks are set to true.
The function proceeds as follows:
- For each chromatogram iterate through all peaks and find the peak with the maximum intensity with its apex in range of "best left" and "best right"
- This will result in 0 or 1 peak being chosen per transition
- If no peaks were found (i do not know why this would be because should be able to find the original peak that defined the best left and right) return the empty list
- Compute the standard deviation of the right/left borders.
- If the standard deviation is acceptable (less than
TransitionGroupPicker::recalculate_peaks_max_z) set the right/left boundary to the "pseudo median"
If the peak apex fell out of range during correction, set the apex at the center of the left and right
If TransitionGroupPicker::use_consensus is true remove overlapping features using remove_overlapping_features(). This method remvoes features which are between the left and right boundaries and determines the left and right boundaries.
If TransitionGroupPicker::use_consensus is false determine the left and right boundaries using
pickApex(). This method looks at each chromatogram, and chooses the chose the peak whose apex is closest to the consensus apex. If no peak is found in the chromatogram, use the consensus boundaries.
If TransitionGroupPicker::compute_peak_quality is true, compute the peak quality using computeQuality. If quality computing is enabled and below the TransitionGroupPicker::minimal_quality threshold, an empty feature is returned.
This step performs actually computes the feature, ensuring all chromatograms are on the same common grid. Linear resampling of transition chromatograms is done using the pickFragmentChromatograms() method and linear resampling of precursor chromatograms is done using pickPrecursorChromatograms(). Both methods follow a similar workflow so a generalized workflow is discussed below. Before invoking the main methods prepareMasterContainer_() is called to initiate a specturm container that will store the features.
pickFragmentChromatograms() iterates through all transitions in the peak group and performs the following:
- If
TransitionGroupPicker::use_consensusisfalsetake the left and right edge of the transition - If the transition is labelled as
detectingsum up all the intensities in the chromatogram - If
TransitionGroupPicker::compute_total_miistruetake the sum of the mutual information for all detecting transitions (using computeAndAppendRank() and rankedMutualInformation() functions). - Resample the chromatogram (either the
smoothedororiginaldepending on theTransitionGroupPicker::peak_integrationargument) (using resampleChromatogram)- Determine the "start" and "end" RT of the chromatogram (with a little buffer room)
- Call LinearResamplerAlign::raster()
- Remove chromatograms without a single peak
- Compute the cross correlation scores for the collected intensities
- Determine the chromatogram with the minimum shape score and the maximum coelution score
- Integrate the Peak (integratePeak())
- Integration method is determined by
PeakIntegrator::integration_typewhich is by default the sum of intensities
- Integration method is determined by
- Perform background subtraction
- Background subtraction subtracts a set amount from the intensity
-
TransitionGroupPicker::background_subtractioncan be:-
none(default) - No background subtraction is performed -
original$$ \frac{i_Li_R}{2}*N $$- Where
-
iLis the intensity at left bounds -
iRis the intensity of the right bounds -
Nis the number of poins in the chromatogram
-
- Where
-
exact- Use the estimateBackground method
-
- Save transition data in a Feature
- Quality = 0
- m/z - m/z of the precursor fragment
- RT - peak consensus
- ConvexHull2D
- Hull points Intensity integrator calculation?
- total_mi (if
TransitionGroupPicker::compute_total_miistrue)
Some peak group level data is computed as well including:
- total_intensity - sum of intensities for all quantifying transitions
- total_peak_apices - sum of apices for all quatifying transitions
Note: for backwards compatibility peak shape metrics are computed (calculatePeakShapeMetrics)
This metadata is written out at the end of the createMRMTransition function. Metadata saved here includes:
| MRMFeature Name | .osw Name | Description |
|---|---|---|
PeptideRef |
??? |
Transition group id associated with this MRMTransition |
leftWidth |
FEATURE.?? |
Left boundary of the peak group |
rightWidth |
FEATURE.?? |
Right boundary of the peak group |
total_xic |
FEATURE.?? |
sum of the integrated intensity for all transitions |
total_mi |
FEATURE.?? |
Total MI score of the feature |
peak_apices_sum |
FEATURE.?? |
sum of all quantifying transition peak apices |
This is done directly in the [pickTransitionGroup()] method. For each feature ensure that there are no "completly duplicate" transitions. If there are, discard them.