OpenMS  2.4.0
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
MzTabFile Class Reference

File adapter for MzTab files. More...

#include <OpenMS/FORMAT/MzTabFile.h>

Public Types

typedef std::map< std::pair< String, String >, std::vector< PeptideHit > > MapAccPepType
 

Public Member Functions

 MzTabFile ()
 Default constructor. More...
 
 ~MzTabFile ()
 Destructor. More...
 
void store (const String &filename, const MzTab &mz_tab) const
 
void storeProteinReliabilityColumn (bool store)
 
void storePeptideReliabilityColumn (bool store)
 
void storePSMReliabilityColumn (bool store)
 
void storeSmallMoleculeReliabilityColumn (bool store)
 
void storeProteinUriColumn (bool store)
 
void storePeptideUriColumn (bool store)
 
void storePSMUriColumn (bool store)
 
void storeSmallMoleculeUriColumn (bool store)
 
void storeProteinGoTerms (bool store)
 
void load (const String &filename, MzTab &mz_tab)
 

Protected Member Functions

void generateMzTabMetaDataSection_ (const MzTabMetaData &map, StringList &sl) const
 
void generateMzTabProteinSection_ (const MzTabProteinSectionRows &rows, StringList &sl, const std::vector< String > &optional_columns) const
 
String generateMzTabProteinHeader_ (const MzTabProteinSectionRow &reference_row, const Size n_best_search_engine_scores, const std::vector< String > &optional_columns) const
 
String generateMzTabProteinSectionRow_ (const MzTabProteinSectionRow &row, const std::vector< String > &optional_columns) const
 
void generateMzTabPeptideSection_ (const MzTabPeptideSectionRows &rows, StringList &sl, const std::vector< String > &optional_columns) const
 
String generateMzTabPeptideHeader_ (Size search_ms_runs, Size n_best_search_engine_scores, Size n_search_engine_score, Size assays, Size study_variables, const std::vector< String > &optional_columns) const
 
String generateMzTabPeptideSectionRow_ (const MzTabPeptideSectionRow &row, const std::vector< String > &optional_columns) const
 
void generateMzTabPSMSection_ (const MzTabPSMSectionRows &rows, StringList &sl, const std::vector< String > &optional_columns) const
 
String generateMzTabPSMHeader_ (Size n_search_engine_scores, const std::vector< String > &optional_columns) const
 
String generateMzTabPSMSectionRow_ (const MzTabPSMSectionRow &row, const std::vector< String > &optional_columns) const
 
void generateMzTabSmallMoleculeSection_ (const MzTabSmallMoleculeSectionRows &map, StringList &sl, const std::vector< String > &optional_columns) const
 
String generateMzTabSmallMoleculeHeader_ (Size search_ms_runs, Size n_best_search_engine_scores, Size n_search_engine_score, Size assays, Size study_variables, const std::vector< String > &optional_columns) const
 
String generateMzTabSmallMoleculeSectionRow_ (const MzTabSmallMoleculeSectionRow &row, const std::vector< String > &optional_columns) const
 

Static Protected Member Functions

static std::pair< int, int > extractIndexPairsFromBrackets_ (const String &s)
 
static void sortPSM_ (std::vector< PeptideIdentification >::iterator begin, std::vector< PeptideIdentification >::iterator end)
 
static void keepFirstPSM_ (std::vector< PeptideIdentification >::iterator begin, std::vector< PeptideIdentification >::iterator end)
 
static void partitionIntoRuns_ (const std::vector< PeptideIdentification > &pep_ids, const std::vector< ProteinIdentification > &pro_ids, std::map< String, std::vector< PeptideIdentification > > &map_run_to_pepids, std::map< String, std::vector< ProteinIdentification > > &map_run_to_proids)
 Extract protein and peptide identifications for each run. maps are assumed empty. More...
 
static void createProteinToPeptideLinks_ (const std::map< String, std::vector< PeptideIdentification > > &map_run_to_pepids, MapAccPepType &map_run_accession_to_pephits)
 create links from protein to peptides More...
 
static String extractProteinAccession_ (const PeptideHit &peptide_hit)
 Extracts, if possible a unique protein accession for a peptide hit in mzTab format. Otherwise NA is returned. More...
 
static String extractPeptideModifications_ (const PeptideHit &peptide_hit)
 Extracts, modifications and positions of a peptide hit in mzTab format. More...
 
static String mapSearchEngineToCvParam_ (const String &openms_search_engine_name)
 Map search engine identifier to CV, param etc. More...
 
static String mapSearchEngineScoreToCvParam_ (const String &openms_search_engine_name, double score, String score_type)
 
static String extractNumPeptides_ (const String &common_identifier, const String &protein_accession, const MapAccPepType &map_run_accession_to_peptides)
 
static String extractNumPeptidesDistinct_ (String common_identifier, String protein_accession, const MapAccPepType &map_run_accession_to_peptides)
 
static String extractNumPeptidesUnambiguous_ (String common_identifier, String protein_accession, const MapAccPepType &map_run_accession_to_peptides)
 
static std::map< String, SizeextractNumberOfSubSamples_ (const std::map< String, std::vector< ProteinIdentification > > &map_run_to_proids)
 
static void writePeptideHeader_ (SVOutStream &output, std::map< String, Size > n_sub_samples)
 
static void writeProteinHeader_ (SVOutStream &output, std::map< String, Size > n_sub_samples)
 
static void writeProteinData_ (SVOutStream &output, const ProteinIdentification &prot_id, Size run_count, String input_filename, bool has_coverage, const MapAccPepType &map_run_accession_to_peptides, const std::map< String, Size > &map_run_to_num_sub)
 

Protected Attributes

bool store_protein_reliability_
 
bool store_peptide_reliability_
 
bool store_psm_reliability_
 
bool store_smallmolecule_reliability_
 
bool store_protein_uri_
 
bool store_peptide_uri_
 
bool store_psm_uri_
 
bool store_smallmolecule_uri_
 
bool store_protein_goterms_
 

Detailed Description

File adapter for MzTab files.

Member Typedef Documentation

◆ MapAccPepType

typedef std::map<std::pair<String, String>, std::vector<PeptideHit> > MapAccPepType

Constructor & Destructor Documentation

◆ MzTabFile()

MzTabFile ( )

Default constructor.

◆ ~MzTabFile()

~MzTabFile ( )

Destructor.

Member Function Documentation

◆ createProteinToPeptideLinks_()

static void createProteinToPeptideLinks_ ( const std::map< String, std::vector< PeptideIdentification > > &  map_run_to_pepids,
MapAccPepType map_run_accession_to_pephits 
)
staticprotected

create links from protein to peptides

◆ extractIndexPairsFromBrackets_()

static std::pair<int, int> extractIndexPairsFromBrackets_ ( const String s)
staticprotected

◆ extractNumberOfSubSamples_()

static std::map<String, Size> extractNumberOfSubSamples_ ( const std::map< String, std::vector< ProteinIdentification > > &  map_run_to_proids)
staticprotected

◆ extractNumPeptides_()

static String extractNumPeptides_ ( const String common_identifier,
const String protein_accession,
const MapAccPepType map_run_accession_to_peptides 
)
staticprotected

◆ extractNumPeptidesDistinct_()

static String extractNumPeptidesDistinct_ ( String  common_identifier,
String  protein_accession,
const MapAccPepType map_run_accession_to_peptides 
)
staticprotected

◆ extractNumPeptidesUnambiguous_()

static String extractNumPeptidesUnambiguous_ ( String  common_identifier,
String  protein_accession,
const MapAccPepType map_run_accession_to_peptides 
)
staticprotected

◆ extractPeptideModifications_()

static String extractPeptideModifications_ ( const PeptideHit peptide_hit)
staticprotected

Extracts, modifications and positions of a peptide hit in mzTab format.

◆ extractProteinAccession_()

static String extractProteinAccession_ ( const PeptideHit peptide_hit)
staticprotected

Extracts, if possible a unique protein accession for a peptide hit in mzTab format. Otherwise NA is returned.

◆ generateMzTabMetaDataSection_()

void generateMzTabMetaDataSection_ ( const MzTabMetaData map,
StringList sl 
) const
protected

◆ generateMzTabPeptideHeader_()

String generateMzTabPeptideHeader_ ( Size  search_ms_runs,
Size  n_best_search_engine_scores,
Size  n_search_engine_score,
Size  assays,
Size  study_variables,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabPeptideSection_()

void generateMzTabPeptideSection_ ( const MzTabPeptideSectionRows rows,
StringList sl,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabPeptideSectionRow_()

String generateMzTabPeptideSectionRow_ ( const MzTabPeptideSectionRow row,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabProteinHeader_()

String generateMzTabProteinHeader_ ( const MzTabProteinSectionRow reference_row,
const Size  n_best_search_engine_scores,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabProteinSection_()

void generateMzTabProteinSection_ ( const MzTabProteinSectionRows rows,
StringList sl,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabProteinSectionRow_()

String generateMzTabProteinSectionRow_ ( const MzTabProteinSectionRow row,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabPSMHeader_()

String generateMzTabPSMHeader_ ( Size  n_search_engine_scores,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabPSMSection_()

void generateMzTabPSMSection_ ( const MzTabPSMSectionRows rows,
StringList sl,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabPSMSectionRow_()

String generateMzTabPSMSectionRow_ ( const MzTabPSMSectionRow row,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabSmallMoleculeHeader_()

String generateMzTabSmallMoleculeHeader_ ( Size  search_ms_runs,
Size  n_best_search_engine_scores,
Size  n_search_engine_score,
Size  assays,
Size  study_variables,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabSmallMoleculeSection_()

void generateMzTabSmallMoleculeSection_ ( const MzTabSmallMoleculeSectionRows map,
StringList sl,
const std::vector< String > &  optional_columns 
) const
protected

◆ generateMzTabSmallMoleculeSectionRow_()

String generateMzTabSmallMoleculeSectionRow_ ( const MzTabSmallMoleculeSectionRow row,
const std::vector< String > &  optional_columns 
) const
protected

◆ keepFirstPSM_()

static void keepFirstPSM_ ( std::vector< PeptideIdentification >::iterator  begin,
std::vector< PeptideIdentification >::iterator  end 
)
staticprotected

◆ load()

void load ( const String filename,
MzTab mz_tab 
)

◆ mapSearchEngineScoreToCvParam_()

static String mapSearchEngineScoreToCvParam_ ( const String openms_search_engine_name,
double  score,
String  score_type 
)
staticprotected

◆ mapSearchEngineToCvParam_()

static String mapSearchEngineToCvParam_ ( const String openms_search_engine_name)
staticprotected

Map search engine identifier to CV, param etc.

◆ partitionIntoRuns_()

static void partitionIntoRuns_ ( const std::vector< PeptideIdentification > &  pep_ids,
const std::vector< ProteinIdentification > &  pro_ids,
std::map< String, std::vector< PeptideIdentification > > &  map_run_to_pepids,
std::map< String, std::vector< ProteinIdentification > > &  map_run_to_proids 
)
staticprotected

Extract protein and peptide identifications for each run. maps are assumed empty.

◆ sortPSM_()

static void sortPSM_ ( std::vector< PeptideIdentification >::iterator  begin,
std::vector< PeptideIdentification >::iterator  end 
)
staticprotected

◆ store()

void store ( const String filename,
const MzTab mz_tab 
) const

◆ storePeptideReliabilityColumn()

void storePeptideReliabilityColumn ( bool  store)

◆ storePeptideUriColumn()

void storePeptideUriColumn ( bool  store)

◆ storeProteinGoTerms()

void storeProteinGoTerms ( bool  store)

◆ storeProteinReliabilityColumn()

void storeProteinReliabilityColumn ( bool  store)

◆ storeProteinUriColumn()

void storeProteinUriColumn ( bool  store)

◆ storePSMReliabilityColumn()

void storePSMReliabilityColumn ( bool  store)

◆ storePSMUriColumn()

void storePSMUriColumn ( bool  store)

◆ storeSmallMoleculeReliabilityColumn()

void storeSmallMoleculeReliabilityColumn ( bool  store)

◆ storeSmallMoleculeUriColumn()

void storeSmallMoleculeUriColumn ( bool  store)

◆ writePeptideHeader_()

static void writePeptideHeader_ ( SVOutStream output,
std::map< String, Size n_sub_samples 
)
staticprotected

◆ writeProteinData_()

static void writeProteinData_ ( SVOutStream output,
const ProteinIdentification prot_id,
Size  run_count,
String  input_filename,
bool  has_coverage,
const MapAccPepType map_run_accession_to_peptides,
const std::map< String, Size > &  map_run_to_num_sub 
)
staticprotected

◆ writeProteinHeader_()

static void writeProteinHeader_ ( SVOutStream output,
std::map< String, Size n_sub_samples 
)
staticprotected

Member Data Documentation

◆ store_peptide_reliability_

bool store_peptide_reliability_
protected

◆ store_peptide_uri_

bool store_peptide_uri_
protected

◆ store_protein_goterms_

bool store_protein_goterms_
protected

◆ store_protein_reliability_

bool store_protein_reliability_
protected

◆ store_protein_uri_

bool store_protein_uri_
protected

◆ store_psm_reliability_

bool store_psm_reliability_
protected

◆ store_psm_uri_

bool store_psm_uri_
protected

◆ store_smallmolecule_reliability_

bool store_smallmolecule_reliability_
protected

◆ store_smallmolecule_uri_

bool store_smallmolecule_uri_
protected