OpenMS  2.4.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MascotGenericFile Class Reference

Read/write Mascot generic files (MGF). More...

#include <OpenMS/FORMAT/MascotGenericFile.h>

Inheritance diagram for MascotGenericFile:
ProgressLogger DefaultParamHandler

Public Member Functions

 MascotGenericFile ()
 constructor More...
 
 ~MascotGenericFile () override
 destructor More...
 
void updateMembers_ () override
 docu in base class More...
 
void store (const String &filename, const PeakMap &experiment, bool compact=false)
 stores the experiment data in a MascotGenericFile that can be used as input for MASCOT shell execution (optionally a compact format is used: no zero-intensity peaks, limited number of decimal places) More...
 
void store (std::ostream &os, const String &filename, const PeakMap &experiment, bool compact=false)
 store the experiment data in a MascotGenericFile; the output is written to the given stream, the filename will be noted in the file (optionally a compact format is used: no zero-intensity peaks, limited number of decimal places) More...
 
template<typename MapType >
void load (const String &filename, MapType &exp)
 loads a Mascot Generic File into a PeakMap More...
 
std::pair< String, StringgetHTTPPeakListEnclosure (const String &filename) const
 enclosing Strings of the peak list body for HTTP submission 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...
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) 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 writeParameterHeader_ (const String &name, std::ostream &os)
 writes a parameter header More...
 
void writeModifications_ (const std::vector< String > &mods, std::ostream &os, bool variable_mods=false)
 write a list of (fixed or variable) modifications More...
 
void writeHeader_ (std::ostream &os)
 writes the full header More...
 
void writeSpectrum_ (std::ostream &os, const PeakSpectrum &spec, const String &filename, const String &native_id_type_accession)
 writes the spectrum More...
 
void writeMSExperiment_ (std::ostream &os, const String &filename, const PeakMap &experiment)
 writes the MSExperiment More...
 
template<typename SpectrumType >
bool getNextSpectrum_ (std::ifstream &is, SpectrumType &spectrum, Size &line_number, const Size &spectrum_number)
 reads a spectrum block, the section between 'BEGIN IONS' and 'END IONS' of a MGF file More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Protected Attributes

bool store_compact_
 use a compact format for storing (no zero-intensity peaks, limited number of decimal places)? More...
 
std::map< String, Stringmod_group_map_
 mapping of modifications with specificity groups, that have to be treated specially (e.g. "Deamidated (NQ)") 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...
 

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...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Read/write Mascot generic files (MGF).

For details of the format, see http://www.matrixscience.com/help/data_file_help.html#GEN.

Constructor & Destructor Documentation

◆ MascotGenericFile()

constructor

◆ ~MascotGenericFile()

~MascotGenericFile ( )
override

destructor

Member Function Documentation

◆ getHTTPPeakListEnclosure()

std::pair<String, String> getHTTPPeakListEnclosure ( const String filename) const

enclosing Strings of the peak list body for HTTP submission

Can be used to embed custom content into HTTP submission (when writing only the MGF header in HTTP format and then adding the peaks (in whatever format, e.g. mzXML) enclosed in this body. The filename can later be found in the Mascot response.

◆ getNextSpectrum_()

bool getNextSpectrum_ ( std::ifstream &  is,
SpectrumType spectrum,
Size line_number,
const Size spectrum_number 
)
inlineprotected

◆ load()

void load ( const String filename,
MapType exp 
)
inline

loads a Mascot Generic File into a PeakMap

Parameters
filenamefile name which the map should be read from
expthe map which is filled with the data from the given file
Exceptions
FileNotFoundis thrown if the given file could not be found

References MSExperiment::addSpectrum(), File::exists(), SpectrumSettings::getPrecursors(), MSExperiment::reset(), and MSSpectrum::setMSLevel().

◆ store() [1/2]

void store ( const String filename,
const PeakMap experiment,
bool  compact = false 
)

stores the experiment data in a MascotGenericFile that can be used as input for MASCOT shell execution (optionally a compact format is used: no zero-intensity peaks, limited number of decimal places)

◆ store() [2/2]

void store ( std::ostream &  os,
const String filename,
const PeakMap experiment,
bool  compact = false 
)

store the experiment data in a MascotGenericFile; the output is written to the given stream, the filename will be noted in the file (optionally a compact format is used: no zero-intensity peaks, limited number of decimal places)

◆ updateMembers_()

void updateMembers_ ( )
overridevirtual

docu in base class

Reimplemented from DefaultParamHandler.

◆ writeHeader_()

void writeHeader_ ( std::ostream &  os)
protected

writes the full header

◆ writeModifications_()

void writeModifications_ ( const std::vector< String > &  mods,
std::ostream &  os,
bool  variable_mods = false 
)
protected

write a list of (fixed or variable) modifications

◆ writeMSExperiment_()

void writeMSExperiment_ ( std::ostream &  os,
const String filename,
const PeakMap experiment 
)
protected

writes the MSExperiment

◆ writeParameterHeader_()

void writeParameterHeader_ ( const String name,
std::ostream &  os 
)
protected

writes a parameter header

◆ writeSpectrum_()

void writeSpectrum_ ( std::ostream &  os,
const PeakSpectrum spec,
const String filename,
const String native_id_type_accession 
)
protected

writes the spectrum

Member Data Documentation

◆ mod_group_map_

std::map<String, String> mod_group_map_
protected

mapping of modifications with specificity groups, that have to be treated specially (e.g. "Deamidated (NQ)")

◆ store_compact_

bool store_compact_
protected

use a compact format for storing (no zero-intensity peaks, limited number of decimal places)?