OpenMS  2.7.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MQEvidence Class Reference

Builds a MaxQuant Evidence.txt. More...

#include <OpenMS/QC/MQEvidenceExporter.h>

Collaboration diagram for MQEvidence:
[legend]

Public Member Functions

 MQEvidence (const OpenMS::String &path)
 Creates MQEvidence object and evidence.txt in given path. More...
 
 ~MQEvidence ()
 Closes f_stream. More...
 
bool isValid ()
 Checks if evidence.txt is writable (i.e. the path in the ctor was not empty and could be created) More...
 
void exportFeatureMap (const OpenMS::FeatureMap &feature_map, const OpenMS::ConsensusMap &cmap)
 Exports a FeatureMap to the evidence.txt. More...
 

Private Member Functions

void exportHeader_ ()
 Writes the header of evidence.txt (Names of columns) More...
 
OpenMS::Size proteinGroupID_ (const OpenMS::String &protein_accession)
 returns the MaxQuant unique evidence number of a protein accession More...
 
std::map< OpenMS::Size, OpenMS::SizemakeFeatureUIDtoConsensusMapIndex_ (const OpenMS::ConsensusMap &cmap)
 Creates map that has the information which FeatureUID is mapped to which ConsensusFeature in ConsensusMap. More...
 
bool hasValidPepID_ (const OpenMS::Feature &f, const OpenMS::Size c_feature_number, const std::multimap< OpenMS::String, std::pair< OpenMS::Size, OpenMS::Size >> &UIDs, const OpenMS::ProteinIdentification::Mapping &mp_f)
 Checks if Feature has valid PeptideIdentifications. More...
 
bool hasPeptideIdentifications_ (const OpenMS::ConsensusFeature &cf)
 Checks if ConsensusFeature has valid PeptideIdentifications. More...
 
void exportRowFromFeature_ (const OpenMS::Feature &f, const OpenMS::ConsensusMap &cmap, const OpenMS::Size c_feature_number, const OpenMS::String &raw_file, const std::multimap< OpenMS::String, std::pair< OpenMS::Size, OpenMS::Size >> &UIDs, const OpenMS::ProteinIdentification::Mapping &mp_f)
 Export one Feature as a row in MQEvidence.txt. More...
 

Private Attributes

std::fstream file_
 Stream where the data is added to create evidence.txt. More...
 
OpenMS::Size id_ = 0
 number of rows in evidence.txt to give each row a specific id More...
 
std::map< OpenMS::String, OpenMS::Sizeprotein_id_
 map that maps each accession to its distinct number in this evidence.txt More...
 
OpenMS::String filename_
 path and name of the evidence.txt More...
 

Detailed Description

Builds a MaxQuant Evidence.txt.

This class is closely related to QualityControl, it creates an evidence.txt similar to a MaxQuant evidence.txt. But not all columns of a MaxQuant file get exported. By the construction of an object, the column names of the evidence values are added to the evidence.txt. For the construction a valid path is needed (check out constructor) where the evidence.txt can be stored. To fill the output evidence.txt with data from the MS/MS run use the exportFeatureMap function, it needs a FeatureMap and the matching ConsensusMap as an input. To check if the created evidence.txt is writable use the function isValid.

Constructor & Destructor Documentation

◆ MQEvidence()

MQEvidence ( const OpenMS::String path)
explicit

Creates MQEvidence object and evidence.txt in given path.

If the path for the constructor is empty (path not valid), no evidence.txt is created. If the creation of the fstream object is successful a constant header is added to the evidence.txt If the path does not exist, it will be created

Exceptions
Exception::FileNotWritableif evidence.txt could not be created
Parameters
paththat is the path where evidence.txt has to be stored

◆ ~MQEvidence()

~MQEvidence ( )

Closes f_stream.

Member Function Documentation

◆ exportFeatureMap()

void exportFeatureMap ( const OpenMS::FeatureMap feature_map,
const OpenMS::ConsensusMap cmap 
)

Exports a FeatureMap to the evidence.txt.

Exports one row per feature from the FeatureMap to the evidence.txt file.

Exceptions
Exception::FileNotWritableif evidence.txt is not writable
Exception::MissingInformationif Feature_map has no corresponding ConsensusFeature
Parameters
feature_mapwhich contains Features to extract evidence data
cmapConsensusMap to extract evidence data if Feature has no valid PeptideIdentifications

◆ exportHeader_()

void exportHeader_ ( )
private

Writes the header of evidence.txt (Names of columns)

◆ exportRowFromFeature_()

void exportRowFromFeature_ ( const OpenMS::Feature f,
const OpenMS::ConsensusMap cmap,
const OpenMS::Size  c_feature_number,
const OpenMS::String raw_file,
const std::multimap< OpenMS::String, std::pair< OpenMS::Size, OpenMS::Size >> &  UIDs,
const OpenMS::ProteinIdentification::Mapping mp_f 
)
private

Export one Feature as a row in MQEvidence.txt.

If the feature has no PepID's or the corresponding CF has no PepIDs, no row will be exported

Parameters
fFeature to extract evidence data
cmapConsensusMap to extract evidence data if Feature has no valid PeptideIdentifications
c_feature_numberIndex of corresponding ConsensusFeature in ConsensusMap
raw_fileis specifying the raw_file the feature belongs to
UIDsUIDs of all PeptideIdentifications of the ConsensusMap
mp_fMapping between the FeatureMap and ProteinIdentifications for the UID from PeptideIdenfitication::buildUIDfromAllPepIds

◆ hasPeptideIdentifications_()

bool hasPeptideIdentifications_ ( const OpenMS::ConsensusFeature cf)
private

Checks if ConsensusFeature has valid PeptideIdentifications.

If there are no PeptideIdentifications, the functions returns false to show that something went wrong.

Parameters
cfis used to extract PeptideIdentifications
Returns
Returns true if the ConsensusFeature has any PepIDs; otherwise false

◆ hasValidPepID_()

bool hasValidPepID_ ( const OpenMS::Feature f,
const OpenMS::Size  c_feature_number,
const std::multimap< OpenMS::String, std::pair< OpenMS::Size, OpenMS::Size >> &  UIDs,
const OpenMS::ProteinIdentification::Mapping mp_f 
)
private

Checks if Feature has valid PeptideIdentifications.

If there are no PeptideIdentifications or the best hit of the Feature cannot be found in corresponding ConsensusFeature, the functions returns false to show that something went wrong.

Parameters
fFeature to extract PeptideIdentifications
c_feature_numberIndex of corresponding ConsensusFeature in ConsensusMap
UIDsUIDs of all PeptideIdentifications of the ConsensusMap
mp_fMapping between the FeatureMap and ProteinIdentifications for the UID
Returns
Returns true if the PeptideIdentifications exist and are valid

◆ isValid()

bool isValid ( )

Checks if evidence.txt is writable (i.e. the path in the ctor was not empty and could be created)

Returns
Returns true if evidence.txt is writable

◆ makeFeatureUIDtoConsensusMapIndex_()

std::map<OpenMS::Size, OpenMS::Size> makeFeatureUIDtoConsensusMapIndex_ ( const OpenMS::ConsensusMap cmap)
private

Creates map that has the information which FeatureUID is mapped to which ConsensusFeature in ConsensusMap.

Exceptions
Exception::Preconditionif FeatureHandle exists twice in ConsensusMap
Parameters
cmapConsensusMap that includes ConsensusFeatures
Returns
Returns map, the index is a FeatureID, the value is the index of the ConsensusFeature in the vector of ConsensusMap

◆ proteinGroupID_()

OpenMS::Size proteinGroupID_ ( const OpenMS::String protein_accession)
private

returns the MaxQuant unique evidence number of a protein accession

Obtains a unique, consecutive number for each distinct protein, which can be used as a protein ID in the evidence.txt (in lack of a proper proteingroup ID which maps to proteinGroups.txt)

Parameters
protein_accessionThe accession of the protein
Returns
Returns distinct number for every Protein

Member Data Documentation

◆ file_

std::fstream file_
private

Stream where the data is added to create evidence.txt.

◆ filename_

OpenMS::String filename_
private

path and name of the evidence.txt

◆ id_

OpenMS::Size id_ = 0
private

number of rows in evidence.txt to give each row a specific id

◆ protein_id_

std::map<OpenMS::String, OpenMS::Size> protein_id_
private

map that maps each accession to its distinct number in this evidence.txt