Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
TransitionTSVReader Class Reference

This class can convert TraML and TSV files into each other. More...

#include <OpenMS/ANALYSIS/OPENSWATH/TransitionTSVReader.h>

Inheritance diagram for TransitionTSVReader:
ProgressLogger DefaultParamHandler TransitionPQPReader

Classes

struct  TSVTransition
 Internal structure to represent a transition. More...
 

Public Member Functions

void convertTargetedExperimentToTSV (const char *filename, OpenMS::TargetedExperiment &targeted_exp)
 Write out a targeted experiment (TraML structure) into a tsv file. More...
 
void convertTSVToTargetedExperiment (const char *filename, FileTypes::Type filetype, OpenMS::TargetedExperiment &targeted_exp)
 Read in a tsv/mrm file and construct a targeted experiment (TraML structure) More...
 
void convertTSVToTargetedExperiment (const char *filename, FileTypes::Type filetype, OpenSwath::LightTargetedExperiment &targeted_exp)
 Read in a tsv file and construct a targeted experiment (Light transition structure) More...
 
void validateTargetedExperiment (OpenMS::TargetedExperiment &targeted_exp)
 Validate a TargetedExperiment (check that all ids are unique) More...
 
 TransitionTSVReader ()
 Constructor. More...
 
 ~TransitionTSVReader ()
 Destructor. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 

Protected Member Functions

void TSVToTargetedExperiment_ (std::vector< TSVTransition > &transition_list, OpenMS::TargetedExperiment &exp)
 Convert a list of TSVTransition to a TargetedExperiment. More...
 
void TSVToTargetedExperiment_ (std::vector< TSVTransition > &transition_list, OpenSwath::LightTargetedExperiment &exp)
 Convert a list of TSVTransition to a LightTargetedExperiment. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Private Member Functions

void writeTSVOutput_ (const char *filename, OpenMS::TargetedExperiment &targeted_exp)
 Write a TargetedExperiment to a file. More...
 

Conversion functions from TSVTransition objects to TraML datastructures

These functions convert the relevant data from a TSVTransition to the datastructures used by the TraML handler, namely ReactionMonitoringTransition, TargetedExperiment::Protein and TargetedExperiment::Peptide.

typedef std::vector< OpenMS::TargetedExperiment::ProteinProteinVectorType
 Typedefs. More...
 
typedef std::vector< OpenMS::TargetedExperiment::PeptidePeptideVectorType
 
typedef std::vector< OpenMS::ReactionMonitoringTransitionTransitionVectorType
 
String retentionTimeInterpretation_
 Members. More...
 
bool override_group_label_check_
 
bool force_invalid_mods_
 
static const char * strarray_ []
 
static const std::vector< std::string > header_names_
 
TransitionTSVReader::TSVTransition convertTransition_ (const ReactionMonitoringTransition *it, OpenMS::TargetedExperiment &targeted_exp)
 
void updateMembers_ ()
 Synchronize members with param class. More...
 
void getTSVHeader_ (const std::string &line, char &delimiter, std::vector< std::string > header, std::map< std::string, int > &header_dict)
 Determine separator in a CSV file and check for correct headers. More...
 
void readUnstructuredTSVInput_ (const char *filename, FileTypes::Type filetype, std::vector< TSVTransition > &transition_list)
 Read tab or comma separated input with columns defined by their column headers only. More...
 
void cleanupTransitions_ (TSVTransition &mytransition)
 Cleanup of the read fields (removing quotes etc.) More...
 
void resolveMixedSequenceGroups_ (std::vector< TSVTransition > &transition_list)
 
void createTransition_ (std::vector< TSVTransition >::iterator &tr_it, OpenMS::ReactionMonitoringTransition &rm_trans)
 Populate a new ReactionMonitoringTransition object from a row in the csv. More...
 
void createProtein_ (std::vector< TSVTransition >::iterator &tr_it, OpenMS::TargetedExperiment::Protein &protein)
 Populate a new TargetedExperiment::Protein object from a row in the csv. More...
 
void interpretRetentionTime_ (std::vector< TargetedExperiment::RetentionTime > &retention_times, const OpenMS::DataValue rt_value)
 Helper function to assign retention times to compounds and peptides. More...
 
void createPeptide_ (std::vector< TSVTransition >::iterator &tr_it, OpenMS::TargetedExperiment::Peptide &peptide)
 Populate a new TargetedExperiment::Peptide object from a row in the csv. More...
 
void createCompound_ (std::vector< TSVTransition >::iterator &tr_it, OpenMS::TargetedExperiment::Compound &compound)
 Populate a new TargetedExperiment::Compound object (a metabolite) from a row in the csv. More...
 
void addModification_ (std::vector< TargetedExperiment::Peptide::Modification > &mods, int location, const ResidueModification &rmod)
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

This class can convert TraML and TSV files into each other.

The TSV are tab-separated and need to have the following columns:

PrecursorMz (float) ProductMz (float) Tr_calibrated (float) transition_name (free text, needs to be unique for each transition [in this file]) CE (float) LibraryIntensity (float) transition_group_id (free text, designates the transition group [e.g. peptide] to which this transition belongs) decoy (1==decoy, 0== no decoy; determines whether the transition is a decoy transition or not) PeptideSequence (free text, sequence only (no modifications) ) ProteinName (free text) Annotation (free text, e.g. y7) FullUniModPeptideName (free text, should contain modifications*) MissedCleavages Replicates NrModifications PrecursorCharge (integer) PeptideGroupLabel (free text, designates to which peptide label group (as defined in MS:1000893) the peptide belongs to) LabelType (free text, optional description of which label was used, e.g. heavy or light) detecting_transition (bool, should this transition be used for peak-picking (detection) of the peak group?) identifying_transition (bool, should this transition be used for UIS identification together with the detecting transitions?) quantifying_transition (bool, should this transition be used for quantification?)

Member Typedef Documentation

◆ PeptideVectorType

◆ ProteinVectorType

Typedefs.

◆ TransitionVectorType

Constructor & Destructor Documentation

◆ TransitionTSVReader()

Constructor.

◆ ~TransitionTSVReader()

Destructor.

Member Function Documentation

◆ addModification_()

void addModification_ ( std::vector< TargetedExperiment::Peptide::Modification > &  mods,
int  location,
const ResidueModification rmod 
)
private

◆ cleanupTransitions_()

void cleanupTransitions_ ( TSVTransition mytransition)
private

Cleanup of the read fields (removing quotes etc.)

◆ convertTargetedExperimentToTSV()

void convertTargetedExperimentToTSV ( const char *  filename,
OpenMS::TargetedExperiment targeted_exp 
)

Write out a targeted experiment (TraML structure) into a tsv file.

Parameters
filenameThe output file
targeted_expThe targeted experiment

◆ convertTransition_()

TransitionTSVReader::TSVTransition convertTransition_ ( const ReactionMonitoringTransition it,
OpenMS::TargetedExperiment targeted_exp 
)
protected

◆ convertTSVToTargetedExperiment() [1/2]

void convertTSVToTargetedExperiment ( const char *  filename,
FileTypes::Type  filetype,
OpenMS::TargetedExperiment targeted_exp 
)

Read in a tsv/mrm file and construct a targeted experiment (TraML structure)

Parameters
filenameThe input file
filetypeThe type of file ("mrm" or "tsv")
targeted_expThe output targeted experiment

Referenced by SortPairDoubleByFirst().

◆ convertTSVToTargetedExperiment() [2/2]

void convertTSVToTargetedExperiment ( const char *  filename,
FileTypes::Type  filetype,
OpenSwath::LightTargetedExperiment targeted_exp 
)

Read in a tsv file and construct a targeted experiment (Light transition structure)

Parameters
filenameThe input file
filetypeThe type of file ("mrm" or "tsv")
targeted_expThe output targeted experiment

◆ createCompound_()

void createCompound_ ( std::vector< TSVTransition >::iterator &  tr_it,
OpenMS::TargetedExperiment::Compound compound 
)
private

Populate a new TargetedExperiment::Compound object (a metabolite) from a row in the csv.

◆ createPeptide_()

void createPeptide_ ( std::vector< TSVTransition >::iterator &  tr_it,
OpenMS::TargetedExperiment::Peptide peptide 
)
private

Populate a new TargetedExperiment::Peptide object from a row in the csv.

◆ createProtein_()

void createProtein_ ( std::vector< TSVTransition >::iterator &  tr_it,
OpenMS::TargetedExperiment::Protein protein 
)
private

Populate a new TargetedExperiment::Protein object from a row in the csv.

◆ createTransition_()

void createTransition_ ( std::vector< TSVTransition >::iterator &  tr_it,
OpenMS::ReactionMonitoringTransition rm_trans 
)
private

Populate a new ReactionMonitoringTransition object from a row in the csv.

◆ getTSVHeader_()

void getTSVHeader_ ( const std::string &  line,
char &  delimiter,
std::vector< std::string >  header,
std::map< std::string, int > &  header_dict 
)
private

Determine separator in a CSV file and check for correct headers.

Parameters
lineThe header to be parsed
delimiterThe delimiter which will be determined from the input
headerThe fields of the header
header_dictThe map which maps the fields in the header to their position

◆ interpretRetentionTime_()

void interpretRetentionTime_ ( std::vector< TargetedExperiment::RetentionTime > &  retention_times,
const OpenMS::DataValue  rt_value 
)
private

Helper function to assign retention times to compounds and peptides.

◆ readUnstructuredTSVInput_()

void readUnstructuredTSVInput_ ( const char *  filename,
FileTypes::Type  filetype,
std::vector< TSVTransition > &  transition_list 
)
private

Read tab or comma separated input with columns defined by their column headers only.

Parameters
filenameThe input file
filetypeThe type of file ("mrm" or "tsv")
transition_listThe output list of transitions

◆ resolveMixedSequenceGroups_()

void resolveMixedSequenceGroups_ ( std::vector< TSVTransition > &  transition_list)
private

Resolve cases where the same peptide label group has different sequences.

Since members in a peptide label group (MS:1000893) should only be isotopically modified forms of the same peptide, having different peptide sequences (different AA order) within the same group most likely constitutes an error. This function will fix the error by erasing the provided "peptide group label" for a peptide and replace it with the peptide id (transition group id).

Parameters
transition_listThe list of read transitions to be fixed.

◆ TSVToTargetedExperiment_() [1/2]

void TSVToTargetedExperiment_ ( std::vector< TSVTransition > &  transition_list,
OpenMS::TargetedExperiment exp 
)
protected

Convert a list of TSVTransition to a TargetedExperiment.

Converts the list (read from csv/mrm) file into a object model using the TargetedExperiment with proper hierarchical structure from Transition to Peptide to Protein.

◆ TSVToTargetedExperiment_() [2/2]

void TSVToTargetedExperiment_ ( std::vector< TSVTransition > &  transition_list,
OpenSwath::LightTargetedExperiment exp 
)
protected

Convert a list of TSVTransition to a LightTargetedExperiment.

Converts the list (read from csv/mrm) file into a object model using the LightTargetedExperiment with proper hierarchical structure from Transition to Peptide to Protein.

◆ updateMembers_()

void updateMembers_ ( )
protectedvirtual

Synchronize members with param class.

Reimplemented from DefaultParamHandler.

◆ validateTargetedExperiment()

void validateTargetedExperiment ( OpenMS::TargetedExperiment targeted_exp)

Validate a TargetedExperiment (check that all ids are unique)

◆ writeTSVOutput_()

void writeTSVOutput_ ( const char *  filename,
OpenMS::TargetedExperiment targeted_exp 
)
private

Write a TargetedExperiment to a file.

Parameters
filenameName of the output file
targeted_expThe data structure to be written to the file

Member Data Documentation

◆ force_invalid_mods_

bool force_invalid_mods_
private

◆ header_names_

const std::vector<std::string> header_names_
staticprivate

◆ override_group_label_check_

bool override_group_label_check_
private

◆ retentionTimeInterpretation_

String retentionTimeInterpretation_
private

Members.

◆ strarray_

const char* strarray_[]
staticprivate

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:14 using doxygen 1.8.13