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

Representation of 1D spectrum settings. More...

#include <OpenMS/METADATA/SpectrumSettings.h>

Inheritance diagram for SpectrumSettings:
[legend]
Collaboration diagram for SpectrumSettings:
[legend]

Public Types

enum  SpectrumType { UNKNOWN , CENTROID , PROFILE , SIZE_OF_SPECTRUMTYPE }
 Spectrum peak type. More...
 

Public Member Functions

 SpectrumSettings ()=default
 Constructor.
 
 SpectrumSettings (const SpectrumSettings &)=default
 Copy constructor.
 
 SpectrumSettings (SpectrumSettings &&) noexcept=default
 Move constructor.
 
 ~SpectrumSettings () noexcept=default
 Destructor.
 
SpectrumSettingsoperator= (const SpectrumSettings &)=default
 
SpectrumSettingsoperator= (SpectrumSettings &&) &=default
 Move assignment operator.
 
bool operator== (const SpectrumSettings &rhs) const
 Equality operator.
 
bool operator!= (const SpectrumSettings &rhs) const
 Equality operator.
 
void unify (const SpectrumSettings &rhs)
 merge another spectrum setting into this one (data is usually appended, except for spectrum type which needs to be unambiguous to be kept)
 
SpectrumType getType () const
 returns the spectrum type (centroided (PEAKS) or profile data (RAW))
 
void setType (SpectrumType type)
 sets the spectrum type
 
void setIMFormat (const IMFormat &im_type)
 sets the IMFormat of the spectrum
 
IMFormat getIMFormat () const
 returns the IMFormat of the spectrum if set. Otherwise UNKNOWN (default).
 
const StringgetNativeID () const
 returns the native identifier for the spectrum, used by the acquisition software.
 
void setNativeID (const String &native_id)
 sets the native identifier for the spectrum, used by the acquisition software.
 
const StringgetComment () const
 returns the free-text comment
 
void setComment (const String &comment)
 sets the free-text comment
 
const InstrumentSettingsgetInstrumentSettings () const
 returns a const reference to the instrument settings of the current spectrum
 
InstrumentSettingsgetInstrumentSettings ()
 returns a mutable reference to the instrument settings of the current spectrum
 
void setInstrumentSettings (const InstrumentSettings &instrument_settings)
 sets the instrument settings of the current spectrum
 
const AcquisitionInfogetAcquisitionInfo () const
 returns a const reference to the acquisition info
 
AcquisitionInfogetAcquisitionInfo ()
 returns a mutable reference to the acquisition info
 
void setAcquisitionInfo (const AcquisitionInfo &acquisition_info)
 sets the acquisition info
 
const SourceFilegetSourceFile () const
 returns a const reference to the source file
 
SourceFilegetSourceFile ()
 returns a mutable reference to the source file
 
void setSourceFile (const SourceFile &source_file)
 sets the source file
 
const std::vector< Precursor > & getPrecursors () const
 returns a const reference to the precursors
 
std::vector< Precursor > & getPrecursors ()
 returns a mutable reference to the precursors
 
void setPrecursors (const std::vector< Precursor > &precursors)
 sets the precursors
 
const std::vector< Product > & getProducts () const
 returns a const reference to the products
 
std::vector< Product > & getProducts ()
 returns a mutable reference to the products
 
void setProducts (const std::vector< Product > &products)
 sets the products
 
void setDataProcessing (const std::vector< DataProcessingPtr > &data_processing)
 sets the description of the applied processing
 
std::vector< DataProcessingPtr > & getDataProcessing ()
 returns a mutable reference to the description of the applied processing
 
const std::vector< std::shared_ptr< const DataProcessing > > getDataProcessing () const
 returns a const reference to the description of the applied processing
 
- Public Member Functions inherited from MetaInfoInterface
 MetaInfoInterface ()=default
 Constructor.
 
 MetaInfoInterface (const MetaInfoInterface &rhs)
 Copy constructor.
 
 MetaInfoInterface (MetaInfoInterface &&) noexcept
 Move constructor.
 
 ~MetaInfoInterface ()
 Destructor.
 
MetaInfoInterfaceoperator= (const MetaInfoInterface &rhs)
 Assignment operator.
 
MetaInfoInterfaceoperator= (MetaInfoInterface &&) noexcept
 Move assignment operator.
 
void swap (MetaInfoInterface &rhs)
 Swap contents.
 
bool operator== (const MetaInfoInterface &rhs) const
 Equality operator.
 
bool operator!= (const MetaInfoInterface &rhs) const
 Equality operator.
 
const DataValuegetMetaValue (const String &name) const
 Returns the value corresponding to a string, or DataValue::EMPTY if not found.
 
DataValue getMetaValue (const String &name, const DataValue &default_value) const
 Returns the value corresponding to a string, or a default value (e.g.: DataValue::EMPTY) if not found

 
const DataValuegetMetaValue (UInt index) const
 Returns the value corresponding to the index, or DataValue::EMPTY if not found.
 
DataValue getMetaValue (UInt index, const DataValue &default_value) const
 Returns the value corresponding to the index, or a default value (e.g.: DataValue::EMPTY) if not found

 
bool metaValueExists (const String &name) const
 Returns whether an entry with the given name exists.
 
bool metaValueExists (UInt index) const
 Returns whether an entry with the given index exists.
 
void setMetaValue (const String &name, const DataValue &value)
 Sets the DataValue corresponding to a name.
 
void setMetaValue (UInt index, const DataValue &value)
 Sets the DataValue corresponding to an index.
 
void removeMetaValue (const String &name)
 Removes the DataValue corresponding to name if it exists.
 
void removeMetaValue (UInt index)
 Removes the DataValue corresponding to index if it exists.
 
void addMetaValues (const MetaInfoInterface &from)
 
void getKeys (std::vector< String > &keys) const
 Fills the given vector with a list of all keys for which a value is set.
 
void getKeys (std::vector< UInt > &keys) const
 Fills the given vector with a list of all keys for which a value is set.
 
bool isMetaEmpty () const
 Returns if the MetaInfo is empty.
 
void clearMetaInfo ()
 Removes all meta values.
 

Static Public Member Functions

static StringList getAllNamesOfSpectrumType ()
 returns all spectrum type names known to OpenMS
 
static const std::string & spectrumTypeToString (SpectrumType type)
 
static SpectrumType toSpectrumType (const std::string &name)
 
- Static Public Member Functions inherited from MetaInfoInterface
static MetaInfoRegistrymetaRegistry ()
 Returns a reference to the MetaInfoRegistry.
 

Static Public Attributes

static const std::string NamesOfSpectrumType [SIZE_OF_SPECTRUMTYPE]
 Names of spectrum types.
 

Protected Attributes

SpectrumType type_ = UNKNOWN
 
IMFormat im_type_ = IMFormat::UNKNOWN
 
String native_id_
 
String comment_
 
InstrumentSettings instrument_settings_
 
SourceFile source_file_
 
AcquisitionInfo acquisition_info_
 
std::vector< Precursorprecursors_
 
std::vector< Productproducts_
 
std::vector< DataProcessingPtrdata_processing_
 
- Protected Attributes inherited from MetaInfoInterface
MetaInfometa_ = nullptr
 Pointer to the MetaInfo object.
 

Additional Inherited Members

- Protected Member Functions inherited from MetaInfoInterface
void createIfNotExists_ ()
 Creates the MetaInfo object if it does not exist.
 

Detailed Description

Representation of 1D spectrum settings.

It contains the metadata about spectrum specific instrument settings, acquisition settings, description of the meta values used in the peaks and precursor info.

Precursor info should only be used if this spectrum is a tandem-MS spectrum. The precursor spectrum is the first spectrum before this spectrum, that has a lower MS-level than the current spectrum.

Member Enumeration Documentation

◆ SpectrumType

Spectrum peak type.

Enumerator
UNKNOWN 

Unknown spectrum type.

CENTROID 

centroid data or stick data

PROFILE 

profile data

SIZE_OF_SPECTRUMTYPE 

Constructor & Destructor Documentation

◆ SpectrumSettings() [1/3]

SpectrumSettings ( )
default

Constructor.

◆ SpectrumSettings() [2/3]

SpectrumSettings ( const SpectrumSettings )
default

Copy constructor.

◆ SpectrumSettings() [3/3]

SpectrumSettings ( SpectrumSettings &&  )
defaultnoexcept

Move constructor.

◆ ~SpectrumSettings()

~SpectrumSettings ( )
defaultnoexcept

Destructor.

Member Function Documentation

◆ getAcquisitionInfo() [1/2]

AcquisitionInfo & getAcquisitionInfo ( )

returns a mutable reference to the acquisition info

◆ getAcquisitionInfo() [2/2]

const AcquisitionInfo & getAcquisitionInfo ( ) const

returns a const reference to the acquisition info

Referenced by ChromatogramExtractor::return_chromatogram().

◆ getAllNamesOfSpectrumType()

static StringList getAllNamesOfSpectrumType ( )
static

returns all spectrum type names known to OpenMS

◆ getComment()

const String & getComment ( ) const

returns the free-text comment

◆ getDataProcessing() [1/2]

std::vector< DataProcessingPtr > & getDataProcessing ( )

returns a mutable reference to the description of the applied processing

Referenced by ChromatogramExtractor::return_chromatogram().

◆ getDataProcessing() [2/2]

const std::vector< std::shared_ptr< const DataProcessing > > getDataProcessing ( ) const

returns a const reference to the description of the applied processing

◆ getIMFormat()

IMFormat getIMFormat ( ) const

returns the IMFormat of the spectrum if set. Otherwise UNKNOWN (default).

Note: If UNKNOWN, use IMFormat::determineIMFormat to determine the IMFormat based on the data.

Returns
IMFormat of the spectrum

◆ getInstrumentSettings() [1/2]

InstrumentSettings & getInstrumentSettings ( )

returns a mutable reference to the instrument settings of the current spectrum

◆ getInstrumentSettings() [2/2]

const InstrumentSettings & getInstrumentSettings ( ) const

◆ getNativeID()

const String & getNativeID ( ) const

◆ getPrecursors() [1/2]

std::vector< Precursor > & getPrecursors ( )

returns a mutable reference to the precursors

◆ getPrecursors() [2/2]

◆ getProducts() [1/2]

std::vector< Product > & getProducts ( )

returns a mutable reference to the products

◆ getProducts() [2/2]

const std::vector< Product > & getProducts ( ) const

returns a const reference to the products

◆ getSourceFile() [1/2]

SourceFile & getSourceFile ( )

returns a mutable reference to the source file

◆ getSourceFile() [2/2]

const SourceFile & getSourceFile ( ) const

returns a const reference to the source file

Referenced by ChromatogramExtractor::return_chromatogram().

◆ getType()

SpectrumType getType ( ) const

returns the spectrum type (centroided (PEAKS) or profile data (RAW))

◆ operator!=()

bool operator!= ( const SpectrumSettings rhs) const

Equality operator.

◆ operator=() [1/2]

SpectrumSettings & operator= ( const SpectrumSettings )
default

◆ operator=() [2/2]

SpectrumSettings & operator= ( SpectrumSettings &&  ) &
default

Move assignment operator.

◆ operator==()

bool operator== ( const SpectrumSettings rhs) const

Equality operator.

◆ setAcquisitionInfo()

void setAcquisitionInfo ( const AcquisitionInfo acquisition_info)

sets the acquisition info

Referenced by XMassFile::load().

◆ setComment()

void setComment ( const String comment)

sets the free-text comment

Referenced by XMassFile::load().

◆ setDataProcessing()

void setDataProcessing ( const std::vector< DataProcessingPtr > &  data_processing)

sets the description of the applied processing

Referenced by XMassFile::load().

◆ setIMFormat()

void setIMFormat ( const IMFormat im_type)

sets the IMFormat of the spectrum

Parameters
[in]im_type

◆ setInstrumentSettings()

void setInstrumentSettings ( const InstrumentSettings instrument_settings)

sets the instrument settings of the current spectrum

Referenced by XMassFile::load().

◆ setNativeID()

void setNativeID ( const String native_id)

sets the native identifier for the spectrum, used by the acquisition software.

Referenced by MascotGenericFile::getNextSpectrum_(), MS2File::load(), DTA2DFile::load(), XMassFile::load(), and SpectraMerger::mergeSpectra_().

◆ setPrecursors()

void setPrecursors ( const std::vector< Precursor > &  precursors)

◆ setProducts()

void setProducts ( const std::vector< Product > &  products)

sets the products

◆ setSourceFile()

void setSourceFile ( const SourceFile source_file)

sets the source file

Referenced by XMassFile::load().

◆ setType()

void setType ( SpectrumType  type)

◆ spectrumTypeToString()

static const std::string & spectrumTypeToString ( SpectrumType  type)
static

Convert a SpectrumType enum to String

Exceptions
Exception::InvalidValueif type is SIZE_OF_SPECTRUMTYPE

◆ toSpectrumType()

static SpectrumType toSpectrumType ( const std::string &  name)
static

Convert an entry in NamesOfSpectrumType[] to SpectrumType enum

Exceptions
Exception::InvalidValueif name is not contained in NamesOfSpectrumType[]

◆ unify()

void unify ( const SpectrumSettings rhs)

merge another spectrum setting into this one (data is usually appended, except for spectrum type which needs to be unambiguous to be kept)

Referenced by SpectraMerger::mergeSpectra_().

Member Data Documentation

◆ acquisition_info_

AcquisitionInfo acquisition_info_
protected

◆ comment_

String comment_
protected

◆ data_processing_

std::vector< DataProcessingPtr > data_processing_
protected

◆ im_type_

IMFormat im_type_ = IMFormat::UNKNOWN
protected

◆ instrument_settings_

InstrumentSettings instrument_settings_
protected

◆ NamesOfSpectrumType

const std::string NamesOfSpectrumType[SIZE_OF_SPECTRUMTYPE]
static

Names of spectrum types.

◆ native_id_

String native_id_
protected

◆ precursors_

std::vector<Precursor> precursors_
protected

◆ products_

std::vector<Product> products_
protected

◆ source_file_

SourceFile source_file_
protected

◆ type_

SpectrumType type_ = UNKNOWN
protected