OpenMS  2.8.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
OSWData Class Reference

Holds all or partial information from an OSW file. More...

#include <OpenMS/DATASTRUCTURES/OSWData.h>

Collaboration diagram for OSWData:
[legend]

Public Member Functions

void addTransition (const OSWTransition &tr)
 Adds a transition; do this before adding Proteins. More...
 
void addTransition (OSWTransition &&tr)
 
void addProtein (OSWProtein &&prot)
 
const std::vector< OSWProtein > & getProteins () const
 
void setProtein (const Size index, OSWProtein &&protein)
 
Size transitionCount () const
 get the total number of transitions (chromatograms) More...
 
const OSWTransitiongetTransition (const UInt32 id) const
 obtain a certain transition meta information with id (this matches the ID of a chromatogram in an sqMass file). More...
 
const std::map< UInt32, OSWTransition > & getTransitions () const
 get all transitions mapped by their ID (UInt32) More...
 
void setSqlSourceFile (const String &filename)
 
const StringgetSqlSourceFile () const
 
void setRunID (const UInt64 run_id)
 
UInt64 getRunID () const
 
void clear ()
 forget all data More...
 
void clearProteins ()
 only forget protein data More...
 
void buildNativeIDResolver (const MSExperiment &chrom_traces)
 Create an internal mapping from the nativeIDs of all chromatograms (extracted by OpenSwathWorkflow (e.g. as sqMass file)) to their index (.getChromatograms[index]) More...
 
UInt fromNativeID (int transition_id) const
 

Protected Member Functions

void checkTransitions_ (const OSWProtein &prot) const
 

Private Attributes

std::map< UInt32, OSWTransitiontransitions_
 
std::vector< OSWProteinproteins_
 
String source_file_
 remember from which sql OSW file this data is loaded (to lazy load more data) More...
 
UInt64 run_id_
 the ID of this run from the SQL RUN table More...
 
std::map< UInt32, UInt32transID_to_index_
 map a Transition.ID (==native_id) to a chromatogram index in the sqMass experiment which contains the raw data More...
 

Detailed Description

Holds all or partial information from an OSW file.

First, fill in all transitions and only then add proteins (which reference transitions via their transition-ids deep down). References will be checked and enforced (exception otherwise – see addProtein()).

Member Function Documentation

◆ addProtein()

void addProtein ( OSWProtein &&  prot)

Adds a protein, which has all its subcomponents already populated All transition references internally are checked to make sure they are valid. You can add stub proteins, by omitting their peptide references.

Exceptions
Exception::Precondition()if transition IDs within protein are unknown

◆ addTransition() [1/2]

void addTransition ( const OSWTransition tr)
inline

Adds a transition; do this before adding Proteins.

References OSWTransition::getID().

◆ addTransition() [2/2]

void addTransition ( OSWTransition &&  tr)
inline

◆ buildNativeIDResolver()

void buildNativeIDResolver ( const MSExperiment chrom_traces)

Create an internal mapping from the nativeIDs of all chromatograms (extracted by OpenSwathWorkflow (e.g. as sqMass file)) to their index (.getChromatograms[index])

The mapping is stored internally and can be used to translate transition.ids (which are native_ids) to a chromatogram index of the external sqMass file.

The mapping can be queried using fromNativeID(int transition.id).

Make sure that the other OSW data is loaded (at least via OSWFile::readMinimal()) before building this mapping here.

Parameters
chrom_tracesThe external sqMass file, which we build the mapping on
Exceptions
Exception::MissingInformationif any nativeID is not known internally
Exception::Preconditionif the run_ids do not match

◆ checkTransitions_()

void checkTransitions_ ( const OSWProtein prot) const
protected

All transition references are checked against transitions_ to make sure they are valid.

Exceptions
Exception::Precondition()if transition IDs within protein are unknown

◆ clear()

void clear ( )

forget all data

◆ clearProteins()

void clearProteins ( )

only forget protein data

◆ fromNativeID()

UInt fromNativeID ( int  transition_id) const

resolve a transition.id (=nativeID) to a simple chromatogram index (.getChromatograms[index]) of the corresponding sqMass file Requires prior call to buildNativeIDResolver(), throws Exception::InvalidValue otherwise (or when nativeID is not known)

◆ getProteins()

const std::vector<OSWProtein>& getProteins ( ) const
inline

constant accessor to proteins. There is no mutable access to prevent accidental violation of invariants (i.e. no matching transitions)

◆ getRunID()

UInt64 getRunID ( ) const
inline

◆ getSqlSourceFile()

const String& getSqlSourceFile ( ) const
inline

◆ getTransition()

const OSWTransition& getTransition ( const UInt32  id) const
inline

obtain a certain transition meta information with id (this matches the ID of a chromatogram in an sqMass file).

◆ getTransitions()

const std::map<UInt32, OSWTransition>& getTransitions ( ) const
inline

get all transitions mapped by their ID (UInt32)

◆ setProtein()

void setProtein ( const Size  index,
OSWProtein &&  protein 
)
inline

Replace existing protein at position @index Note: this is NOT the protein ID, but the index into the internal protein vector. See getProteins()

Parameters
indexA valid index into the getProteins() vector
proteinThe protein to replace the existing one
Exceptions
Exception::Precondition()if transition IDs within protein are unknown

◆ setRunID()

void setRunID ( const UInt64  run_id)
inline

◆ setSqlSourceFile()

void setSqlSourceFile ( const String filename)
inline

◆ transitionCount()

Size transitionCount ( ) const
inline

get the total number of transitions (chromatograms)

Member Data Documentation

◆ proteins_

std::vector<OSWProtein> proteins_
private

◆ run_id_

UInt64 run_id_
private

the ID of this run from the SQL RUN table

◆ source_file_

String source_file_
private

remember from which sql OSW file this data is loaded (to lazy load more data)

◆ transID_to_index_

std::map<UInt32, UInt32> transID_to_index_
private

map a Transition.ID (==native_id) to a chromatogram index in the sqMass experiment which contains the raw data

◆ transitions_

std::map<UInt32, OSWTransition> transitions_
private