OpenMS
Loading...
Searching...
No Matches
SpectrumAccessOnDisc Class Reference

OpenSwath::ISpectrumAccess on an on-disc experiment (e.g. OnDiscThermoRawExperiment or OnDiscMSExperiment). More...

#include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/SpectrumAccessOnDisc.h>

Inheritance diagram for SpectrumAccessOnDisc:
ISpectrumAccess

Classes

struct  View
 

Public Member Functions

 SpectrumAccessOnDisc (std::shared_ptr< IMSExperimentRandomAccess > experiment)
 Expose all spectra of experiment.
 
 SpectrumAccessOnDisc (std::shared_ptr< IMSExperimentRandomAccess > experiment, std::vector< Size > indices)
 Expose only the spectra of experiment with the given indices.
 
 SpectrumAccessOnDisc (const SpectrumAccessOnDisc &rhs)
 Copy constructor; clones the experiment (new file handle) and shares the index and subset.
 
 ~SpectrumAccessOnDisc () override
 Destructor.
 
std::shared_ptr< OpenSwath::ISpectrumAccess > lightClone () const override
 A copy that can be used from another thread (see the copy constructor)
 
OpenSwath::SpectrumPtr getSpectrumById (int id) override
 Peaks and data arrays of visible spectrum id (float and integer arrays, named after the array)
 
OpenSwath::SpectrumMeta getSpectrumMetaById (int id) const override
 Retention time and MS level of visible spectrum id.
 
std::vector< std::size_t > getSpectraByRT (double RT, double deltaRT) const override
 Visible spectra with RT in [RT - deltaRT, RT + deltaRT].
 
size_t getNrSpectra () const override
 Number of visible spectra.
 
OpenSwath::ChromatogramPtr getChromatogramById (int id) override
 Chromatogram id of the experiment.
 
size_t getNrChromatograms () const override
 Number of chromatograms of the experiment.
 
std::string getChromatogramNativeID (int id) const override
 Native ID of chromatogram id.
 
Size getExperimentIndex (int id) const
 Index in the experiment of visible spectrum id.
 
const IMSExperimentRandomAccess & getExperiment () const
 The experiment this accessor reads from.
 
- Public Member Functions inherited from ISpectrumAccess
virtual ~ISpectrumAccess ()
 Destructor.
 
SpectrumPtr getSpectrumById (int id, double drift_start, double drift_end)
 Return pointer to a spectrum at the given id, the spectrum will be filtered by drift time.
 
SpectrumSequence getMultipleSpectra (double RT, int nr_spectra_to_fetch)
 
SpectrumSequence getMultipleSpectra (double RT, int nr_spectra_to_fetch, double drift_start, double drift_end)
 

Private Attributes

std::shared_ptr< IMSExperimentRandomAccess > experiment_
 
std::shared_ptr< const View > view_
 

Additional Inherited Members

- Static Public Member Functions inherited from ISpectrumAccess
static SpectrumPtr filterByDrift (const SpectrumPtr &input, double drift_start, double drift_end)
 filters a spectrum by drift time, spectrum pointer returned is a copy
 

Detailed Description

OpenSwath::ISpectrumAccess on an on-disc experiment (e.g. OnDiscThermoRawExperiment or OnDiscMSExperiment).

Spectra are read from the file on request (IMSExperimentRandomAccess::getSpectrumPeaks()), nothing is cached. The accessor can expose a subset of the spectra, e.g. those of one SWATH window, so that several views share one opened file and its index (as SpectrumAccessSqMass does). The visible spectra are ordered by retention time (ties keep the order of the experiment); id i refers to the i-th visible spectrum.

Chromatograms are those of the experiment (the subset applies to spectra only).

Note
lightClone() and the copy constructor clone the experiment (IMSExperimentRandomAccess::clone()), i.e. open a new handle on the file, and share the index and the subset. Clones can be used concurrently from different threads; a single instance must not.
auto experiment = std::make_shared<OnDiscThermoRawExperiment>();
experiment->openFile("run.raw");
std::vector<Size> window; // spectra of one SWATH window
// ...
OpenSwath::SpectrumAccessPtr sptr = std::make_shared<SpectrumAccessOnDisc>(experiment, window);
std::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:146

Class Documentation

◆ OpenMS::SpectrumAccessOnDisc::View

struct OpenMS::SpectrumAccessOnDisc::View
Class Members
vector< Size > indices experiment index of each visible spectrum
vector< double > rts and its retention time (ascending)

Constructor & Destructor Documentation

◆ SpectrumAccessOnDisc() [1/3]

SpectrumAccessOnDisc ( std::shared_ptr< IMSExperimentRandomAccess >  experiment)
explicit

Expose all spectra of experiment.

Parameters
[in]experimentThe opened experiment; this accessor uses it, clones open new handles.

◆ SpectrumAccessOnDisc() [2/3]

SpectrumAccessOnDisc ( std::shared_ptr< IMSExperimentRandomAccess >  experiment,
std::vector< Size >  indices 
)

Expose only the spectra of experiment with the given indices.

Parameters
[in]experimentThe opened experiment; this accessor uses it, clones open new handles.
[in]indicesSpectrum indices of experiment; they are ordered by retention time.
Exceptions
Exception::IndexOverflowif an index is out of range

◆ SpectrumAccessOnDisc() [3/3]

Copy constructor; clones the experiment (new file handle) and shares the index and subset.

◆ ~SpectrumAccessOnDisc()

~SpectrumAccessOnDisc ( )
override

Destructor.

Member Function Documentation

◆ getChromatogramById()

OpenSwath::ChromatogramPtr getChromatogramById ( int  id)
overridevirtual

Chromatogram id of the experiment.

Implements ISpectrumAccess.

◆ getChromatogramNativeID()

std::string getChromatogramNativeID ( int  id) const
overridevirtual

Native ID of chromatogram id.

Implements ISpectrumAccess.

◆ getExperiment()

const IMSExperimentRandomAccess & getExperiment ( ) const

The experiment this accessor reads from.

◆ getExperimentIndex()

Size getExperimentIndex ( int  id) const

Index in the experiment of visible spectrum id.

◆ getNrChromatograms()

size_t getNrChromatograms ( ) const
overridevirtual

Number of chromatograms of the experiment.

Implements ISpectrumAccess.

◆ getNrSpectra()

size_t getNrSpectra ( ) const
overridevirtual

Number of visible spectra.

Implements ISpectrumAccess.

◆ getSpectraByRT()

std::vector< std::size_t > getSpectraByRT ( double  RT,
double  deltaRT 
) const
overridevirtual

Visible spectra with RT in [RT - deltaRT, RT + deltaRT].

Returns the first visible spectrum with RT >= RT - deltaRT and all following ones up to RT + deltaRT, as SpectrumAccessOpenMS does (so deltaRT = 0 gives the first spectrum at or after RT).

Implements ISpectrumAccess.

◆ getSpectrumById()

OpenSwath::SpectrumPtr getSpectrumById ( int  id)
overridevirtual

Peaks and data arrays of visible spectrum id (float and integer arrays, named after the array)

Implements ISpectrumAccess.

◆ getSpectrumMetaById()

OpenSwath::SpectrumMeta getSpectrumMetaById ( int  id) const
overridevirtual

Retention time and MS level of visible spectrum id.

Implements ISpectrumAccess.

◆ lightClone()

std::shared_ptr< OpenSwath::ISpectrumAccess > lightClone ( ) const
overridevirtual

A copy that can be used from another thread (see the copy constructor)

Implements ISpectrumAccess.

Member Data Documentation

◆ experiment_

std::shared_ptr<IMSExperimentRandomAccess> experiment_
private

◆ view_

std::shared_ptr<const View> view_
private