ProteoWizard
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
pwiz::analysis::PrecursorMaskCodec Class Reference

Implementation of the IPrecursorMaskCodec interface that is able to handle both overlapping MSX experiments. More...

#include <PrecursorMaskCodec.hpp>

Inheritance diagram for pwiz::analysis::PrecursorMaskCodec:
pwiz::analysis::IPrecursorMaskCodec

Classes

struct  DemuxBoundary
 Simple container that is useful for breaking up DemuxWindows into their edges and resolving overlap. More...
 

Public Member Functions

 PrecursorMaskCodec (msdata::SpectrumList_const_ptr slPtr, bool variableFill=false)
 Construct a PrecursorMaskCodec for interpreting overlapping and MSX experiments for demultiplexing. More...
 
virtual ~PrecursorMaskCodec ()
 
IPrecursorMaskCodec interface
Eigen::VectorXd GetMask (msdata::Spectrum_const_ptr sPtr, double weight) const override
 Generates a design matrix row describing which precursor isolation windows are present in the given spectrum. More...
 
void GetMask (msdata::Spectrum_const_ptr sPtr, DemuxTypes::MatrixType &m, size_t rowNum, double weight) const override
 Generates a design matrix row describing which precursor isolation windows are present in the given spectrum and places it into the specified row of the user-provided matrix. More...
 
void SpectrumToIndices (msdata::Spectrum_const_ptr spectrumPtr, std::vector< size_t > &indices) const override
 Identifies the precursor windows within a spectrum and returns the indices to the design matrix columns corresponding to those windows. More...
 
IsolationWindow GetIsolationWindow (size_t i) const override
 Returns the precursor window for a given index. More...
 
size_t GetNumDemuxWindows () const override
 Returns the total number of demux'd precursor windows. This is the number of possible indices returned by SpectrumToIndices(). More...
 
int GetSpectraPerCycle () const override
 Returns the number of spectra required to cover all precursor isolation windows. More...
 
int GetPrecursorsPerSpectrum () const override
 Returns the number of precursor isolations per spectrum. This is verified to be constant for all spectra. More...
 
int GetOverlapsPerCycle () const override
 Returns the number of overlap repeats per cycle. So for no overlap, this returns 1. For an overlap that splits each precursor in two, this returns 2. Etc. More...
 
size_t GetDemuxBlockSize () const override
 Returns the number of windows required to demultiplex. More...
 
msdata::ProcessingMethod GetProcessingMethod () const override
 Returns a descriptor of the processing done by this PrecursorMaskCodec. More...
 
- Public Member Functions inherited from pwiz::analysis::IPrecursorMaskCodec
virtual ~IPrecursorMaskCodec ()
 

Protected Member Functions

void ReadDemuxScheme (msdata::SpectrumList_const_ptr spectrumList)
 Interpret the experimental design of the multiplexed experiment and cache values for building the design matrix when later given spectra. More...
 
void IdentifyCycle (msdata::SpectrumList_const_ptr spectrumList, std::vector< IsolationWindow > &demuxWindows)
 Identifies the repeating scan pattern in the experiment and extracts features of the experimental design in order to interpret the intended demux scheme. More...
 
void IdentifyOverlap (std::vector< IsolationWindow > &demuxWindows)
 Identifies any overlap in a DemuxWindow set and splits any overlapping regions such that a non-overlapping DemuxWindow set is produced. More...
 

Private Member Functions

template<class T >
void GetMask (T &&arrayType, msdata::Spectrum_const_ptr sPtr, double weight) const
 Template for retrieving masks from array-like objects with [] accessors. More...
 

Private Attributes

std::vector< IsolationWindowisolationWindows_
 This is effectively the index to isolation window map for translating isolation windows to. More...
 
size_t spectraPerCycle_
 Number of spectra required to cover all precursor windows. More...
 
size_t precursorsPerSpectrum_
 Number of precursors (or isolation windows) per multiplexed spectrum. More...
 
size_t overlapsPerSpectrum_
 Number of overlap windows per multiplexed spectrum. More...
 
bool variableFill_
 Whether this data acquired with variable fill times or not. This is set by the user. More...
 
msdata::ProcessingMethod processingMethod_
 Cached processing method to return from GetProcessingMethod() More...
 

Additional Inherited Members

- Public Types inherited from pwiz::analysis::IPrecursorMaskCodec
typedef boost::shared_ptr< IPrecursorMaskCodecptr
 Shared pointer definition. More...
 
typedef boost::shared_ptr< const IPrecursorMaskCodecconst_ptr
 Constant shared pointer definition. More...
 

Detailed Description

Implementation of the IPrecursorMaskCodec interface that is able to handle both overlapping MSX experiments.

Some features that are only applicable when overlapping is used without MSX or MSX used without overlapping are not implemented in this class. Such features and optimizations are currently left to other more targeted implementations of IPrecursorMaskCodec. One missing feature is interpolation of overlap-only data to optimize weighting of nearby spectra before demultiplexing.

Definition at line 32 of file PrecursorMaskCodec.hpp.

Constructor & Destructor Documentation

◆ PrecursorMaskCodec()

pwiz::analysis::PrecursorMaskCodec::PrecursorMaskCodec ( msdata::SpectrumList_const_ptr  slPtr,
bool  variableFill = false 
)
explicit

Construct a PrecursorMaskCodec for interpreting overlapping and MSX experiments for demultiplexing.

Parameters
[in]slPtrSpectrumList to demux
[in]variableFillSet to true if fill times are allowed to vary for each scan window

◆ ~PrecursorMaskCodec()

virtual pwiz::analysis::PrecursorMaskCodec::~PrecursorMaskCodec ( )
inlinevirtual

Member Function Documentation

◆ GetMask() [1/3]

Eigen::VectorXd pwiz::analysis::PrecursorMaskCodec::GetMask ( msdata::Spectrum_const_ptr  sPtr,
double  weight 
) const
overridevirtual

Generates a design matrix row describing which precursor isolation windows are present in the given spectrum.

This row can be weighted by a given scalar.

Parameters
[in]sPtrMultiplexed spectrum from which to extract precursor windows.
[in]weightScalar value by which to weight the resulting design matrix vector. This weighting is a simple scalar multiplication of the vector.
Returns
Design matrix row describing which precursor isolation windows are present in the given spectrum.

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by pwiz::analysis::PrecursorMaskCodec::DemuxBoundary::operator==(), and ~PrecursorMaskCodec().

◆ GetMask() [2/3]

void pwiz::analysis::PrecursorMaskCodec::GetMask ( msdata::Spectrum_const_ptr  sPtr,
DemuxTypes::MatrixType m,
size_t  rowNum,
double  weight 
) const
overridevirtual

Generates a design matrix row describing which precursor isolation windows are present in the given spectrum and places it into the specified row of the user-provided matrix.

Parameters
[in]sPtrMultiplexed spectrum from which to extract precursor windows.
[out]mMatrix in which to place the design vector.
[in]rowNumRow of the matrix in which to place the design vector corresponding to the given spectrum.
[in]weightScalar value by which to weight the resulting design matrix vector. This weighting is a simple scalar multiplication of the vector.
Precondition
Out array must be same size as GetDemuxBlockSize()

Implements pwiz::analysis::IPrecursorMaskCodec.

◆ SpectrumToIndices()

void pwiz::analysis::PrecursorMaskCodec::SpectrumToIndices ( msdata::Spectrum_const_ptr  sPtr,
std::vector< size_t > &  indices 
) const
overridevirtual

Identifies the precursor windows within a spectrum and returns the indices to the design matrix columns corresponding to those windows.

Parameters
[in]sPtrMultiplexed spectrum from which to extract precursor windows.
[out]indicesIndices of the design matrix columns that correspond to the precursor windows in the given spectrum.

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ GetIsolationWindow()

IsolationWindow pwiz::analysis::PrecursorMaskCodec::GetIsolationWindow ( size_t  i) const
overridevirtual

Returns the precursor window for a given index.

Parameters
[in]iIndex of the column of the design matrix corresponding to the precursor window.
Returns
A DemuxWindow describing the m/z range of the precursor window.

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ GetNumDemuxWindows()

size_t pwiz::analysis::PrecursorMaskCodec::GetNumDemuxWindows ( ) const
overridevirtual

Returns the total number of demux'd precursor windows. This is the number of possible indices returned by SpectrumToIndices().

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ GetSpectraPerCycle()

int pwiz::analysis::PrecursorMaskCodec::GetSpectraPerCycle ( ) const
overridevirtual

Returns the number of spectra required to cover all precursor isolation windows.

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ GetPrecursorsPerSpectrum()

int pwiz::analysis::PrecursorMaskCodec::GetPrecursorsPerSpectrum ( ) const
overridevirtual

Returns the number of precursor isolations per spectrum. This is verified to be constant for all spectra.

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ GetOverlapsPerCycle()

int pwiz::analysis::PrecursorMaskCodec::GetOverlapsPerCycle ( ) const
overridevirtual

Returns the number of overlap repeats per cycle. So for no overlap, this returns 1. For an overlap that splits each precursor in two, this returns 2. Etc.

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ GetDemuxBlockSize()

size_t pwiz::analysis::PrecursorMaskCodec::GetDemuxBlockSize ( ) const
overridevirtual

Returns the number of windows required to demultiplex.

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ GetProcessingMethod()

msdata::ProcessingMethod pwiz::analysis::PrecursorMaskCodec::GetProcessingMethod ( ) const
overridevirtual

Returns a descriptor of the processing done by this PrecursorMaskCodec.

WARNING: It is important that this gives a string containing "Demultiplexing" in order for SpectrumWorkerThreads.cpp to handle demultiplexing properly.

Returns
The processing method performed by this PrecursorMaskCodec

Implements pwiz::analysis::IPrecursorMaskCodec.

Referenced by ~PrecursorMaskCodec().

◆ ReadDemuxScheme()

void pwiz::analysis::PrecursorMaskCodec::ReadDemuxScheme ( msdata::SpectrumList_const_ptr  spectrumList)
protected

Interpret the experimental design of the multiplexed experiment and cache values for building the design matrix when later given spectra.

Referenced by pwiz::analysis::PrecursorMaskCodec::DemuxBoundary::operator==().

◆ IdentifyCycle()

void pwiz::analysis::PrecursorMaskCodec::IdentifyCycle ( msdata::SpectrumList_const_ptr  spectrumList,
std::vector< IsolationWindow > &  demuxWindows 
)
protected

Identifies the repeating scan pattern in the experiment and extracts features of the experimental design in order to interpret the intended demux scheme.

Note that an alternative to this would be to have the experimental design specified by the user or written in some form in metadata.

Parameters
[in]spectrumListThe SpectrumListPtr containing the multiplexed experiment
[out]demuxWindowsThe largest set of windows that the experiment can be demultiplexed into when not accounting for overlap.
Postcondition
demuxWindows is sorted and contains no duplicate elements

Referenced by pwiz::analysis::PrecursorMaskCodec::DemuxBoundary::operator==().

◆ IdentifyOverlap()

void pwiz::analysis::PrecursorMaskCodec::IdentifyOverlap ( std::vector< IsolationWindow > &  demuxWindows)
protected

Identifies any overlap in a DemuxWindow set and splits any overlapping regions such that a non-overlapping DemuxWindow set is produced.

Parameters
[in]demuxWindowsSet of possibly overlapping DemuxWindows.
[out]demuxWindowsSet of non-overlapping DemuxWindows produced from the input demuxWindows.
Precondition
demuxWindows is sorted and has no duplicate elements.
Postcondition
demuxWindows is output as a vector of size equal to or greater than the input vector.

Referenced by pwiz::analysis::PrecursorMaskCodec::DemuxBoundary::operator==().

◆ GetMask() [3/3]

template<class T >
void pwiz::analysis::PrecursorMaskCodec::GetMask ( T &&  arrayType,
msdata::Spectrum_const_ptr  sPtr,
double  weight 
) const
private

Template for retrieving masks from array-like objects with [] accessors.

Rvalue references are used for compatibility with Eigen types. See IPrecursorMaskCodec::GetMask

Parameters
[out]arrayTypeArray-like object with [] accessor
[in]sPtrMultiplexed spectrum from which to extract precursor windows.
[in]weightScalar value by which to weight the resulting design matrix vector. This weighting is a simple scalar multiplication of the vector.

Member Data Documentation

◆ isolationWindows_

std::vector<IsolationWindow> pwiz::analysis::PrecursorMaskCodec::isolationWindows_
private

This is effectively the index to isolation window map for translating isolation windows to.

Definition at line 106 of file PrecursorMaskCodec.hpp.

◆ spectraPerCycle_

size_t pwiz::analysis::PrecursorMaskCodec::spectraPerCycle_
private

Number of spectra required to cover all precursor windows.

This is the number of spectra required to make a fully determined system of equations.

Definition at line 110 of file PrecursorMaskCodec.hpp.

◆ precursorsPerSpectrum_

size_t pwiz::analysis::PrecursorMaskCodec::precursorsPerSpectrum_
private

Number of precursors (or isolation windows) per multiplexed spectrum.

This is calculated in ReadDemuxScheme() and is assumed to be constant for all spectra. An error is thrown if this is ever observed to change.

Definition at line 114 of file PrecursorMaskCodec.hpp.

◆ overlapsPerSpectrum_

size_t pwiz::analysis::PrecursorMaskCodec::overlapsPerSpectrum_
private

Number of overlap windows per multiplexed spectrum.

E.g. having one additional round of acquisition with an overlap offset would result in two overlap regions per spectrum. Alternatively, in the case of no overlap the number of "overlap windows" is one. This is calculated in ReadDemuxScheme() and assumed to be constant for all spectra. An error is thrown if this is ever observed to change.

Definition at line 119 of file PrecursorMaskCodec.hpp.

◆ variableFill_

bool pwiz::analysis::PrecursorMaskCodec::variableFill_
private

Whether this data acquired with variable fill times or not. This is set by the user.

Definition at line 122 of file PrecursorMaskCodec.hpp.

◆ processingMethod_

msdata::ProcessingMethod pwiz::analysis::PrecursorMaskCodec::processingMethod_
private

Cached processing method to return from GetProcessingMethod()

Definition at line 125 of file PrecursorMaskCodec.hpp.


The documentation for this class was generated from the following file: