OpenMS
2.7.0
|
Load MSP text file and save it into an `MSExperiment`. More...
#include <OpenMS/FORMAT/MSPGenericFile.h>
Public Member Functions | |
MSPGenericFile () | |
Default constructor. More... | |
MSPGenericFile (const String &filename, MSExperiment &library) | |
Constructor with filename and output library. More... | |
~MSPGenericFile ()=default | |
Destructor. More... | |
void | getDefaultParameters (Param ¶ms) |
Get the class' default parameters. More... | |
void | load (const String &filename, MSExperiment &library) |
Load the file's data and metadata, and save it into an `MSExperiment`. More... | |
void | store (const String &filename, const MSExperiment &library) const |
Save data and metadata into a file. 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 DefaultParamHandler & | operator= (const DefaultParamHandler &rhs) |
Assignment operator. More... | |
virtual bool | operator== (const DefaultParamHandler &rhs) const |
Equality operator. More... | |
void | setParameters (const Param ¶m) |
Sets the parameters. More... | |
const Param & | getParameters () const |
Non-mutable access to the parameters. More... | |
const Param & | getDefaults () const |
Non-mutable access to the default parameters. More... | |
const String & | getName () 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... | |
Private Member Functions | |
void | updateMembers_ () |
Overrides `DefaultParamHandler`'s method. More... | |
void | addSpectrumToLibrary (MSSpectrum &spectrum, MSExperiment &library) |
Private Attributes | |
std::set< String > | loaded_spectra_names_ |
To keep track of which spectra have already been loaded and avoid duplicates. More... | |
std::vector< String > | synonyms_ |
String | synonyms_separator_ |
The separator to be used in "Synon" metaValue. More... | |
Friends | |
class | MSPGenericFile_friend |
To test private and protected methods. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from DefaultParamHandler | |
static void | writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &prefix="") |
Writes all parameters to meta values. More... | |
Protected Member Functions inherited from DefaultParamHandler | |
void | defaultsToParam_ () |
Updates the parameters after the defaults have been set in the constructor. More... | |
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< String > | subsections_ |
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... | |
Load MSP text file and save it into an `MSExperiment`.
This class is specialized for metabolites data. The required fields are: Name, Num Peaks, and the peaks data
Points (meaning x and y info) may be separated by a space or a colon. Peaks may be separated by a space or a semicolon.
An example of the expected format: > Name: foo > Num Peaks: 11 > 35 310; 36 1230; 37 27; 38 303; 47 5240; > 66 203; 67 68; 68 77; 82 63; 83 240; > 136 350;
Another supported format: > Name: bar > Num Peaks: 11 > 35:310 36:1230 37:27 38:303 47:5240 > 66:203 67:68 68:77 82:63 83:240 > 136:350
MSPGenericFile | ( | ) |
Default constructor.
MSPGenericFile | ( | const String & | filename, |
MSExperiment & | library | ||
) |
Constructor with filename and output library.
|
default |
Destructor.
|
private |
Validate and add a spectrum to a spectral library
The spectrum is added to the library if all following criteria are met:
MissingInformation | If the spectrum doesn't have a name or Num Peaks info is missing |
ParseError | If Num Peaks' value doesn't match with the number of raw peaks parsed |
[in/out] | spectrum The spectrum to be added | |
[out] | library | The spectrum is added into this `MSExperiment` library |
Referenced by MSPGenericFile_friend::addSpectrumToLibrary().
void getDefaultParameters | ( | Param & | params | ) |
Get the class' default parameters.
void load | ( | const String & | filename, |
MSExperiment & | library | ||
) |
Load the file's data and metadata, and save it into an `MSExperiment`.
[in] | filename | Path to the MSP input file |
[out] | library | The variable into which the extracted information will be saved |
FileNotFound | If the file could not be found |
void store | ( | const String & | filename, |
const MSExperiment & | library | ||
) | const |
Save data and metadata into a file.
[in] | filename | Path to the MSP input file |
[out] | library | The variable from which extracted information will be saved |
FileNotWritable | If the file is not writable |
|
privatevirtual |
Overrides `DefaultParamHandler`'s method.
Reimplemented from DefaultParamHandler.
|
friend |
To test private and protected methods.
|
private |
To keep track of which spectra have already been loaded and avoid duplicates.
|
private |
|
private |
The separator to be used in "Synon" metaValue.