OpenMS
|
_MRMFeaturePickerFile_ loads components and components groups parameters from a .csv file. More...
#include <OpenMS/FORMAT/MRMFeaturePickerFile.h>
Public Member Functions | |
MRMFeaturePickerFile ()=default | |
Constructor. More... | |
~MRMFeaturePickerFile () override=default | |
Destructor. More... | |
void | load (const String &filename, std::vector< MRMFeaturePicker::ComponentParams > &cp_list, std::vector< MRMFeaturePicker::ComponentGroupParams > &cgp_list) |
Loads the file's data and saves it into vectors of `ComponentParams` and `ComponentGroupParams`. More... | |
Public Member Functions inherited from CsvFile | |
CsvFile () | |
Default constructor. More... | |
~CsvFile () override | |
destructor More... | |
CsvFile (const String &filename, char is=',', bool ie=false, Int first_n=-1) | |
Constructor with filename. More... | |
void | load (const String &filename, char is=',', bool ie=false, Int first_n=-1) |
Loads data from a text file. More... | |
void | store (const String &filename) |
Stores the buffer's content into a file. More... | |
void | addRow (const StringList &list) |
Add a row to the buffer. More... | |
void | clear () |
Clears the buffer. More... | |
bool | getRow (Size row, StringList &list) |
writes all items from a row to list More... | |
std::vector< String >::size_type | rowCount () const |
Returns the number of rows that were loaded from the file. More... | |
Protected Member Functions | |
bool | extractParamsFromLine_ (const StringList &line, const std::map< String, Size > &headers, MRMFeaturePicker::ComponentParams &cp, MRMFeaturePicker::ComponentGroupParams &cgp) const |
Extracts the information from a `StringList` and saves it into the correct data structures. More... | |
void | setCastValue_ (const String &key, const String &value, Param ¶ms) const |
Helper method which takes care of converting the given value to the desired type, based on the header (here `key`) information. More... | |
_MRMFeaturePickerFile_ loads components and components groups parameters from a .csv file.
The structures defined in [MRMFeaturePicker](MRMFeaturePicker) are used.
It is required that columns `component_name` and `component_group_name` are present. Lines whose `component_name`'s or `component_group_name`'s value is an empty string, will be skipped. The class supports the absence of information within other columns.
A reduced example of the expected format (fewer columns are shown here): > component_name,component_group_name,TransitionGroupPicker:stop_after_feature,TransitionGroupPicker:PeakPickerMRM:sgolay_frame_length > arg-L.arg-L_1.Heavy,arg-L,2,15 > arg-L.arg-L_1.Light,arg-L,2,17 > orn.orn_1.Heavy,orn,3,21 > orn.orn_1.Light,orn,3,13
|
default |
Constructor.
|
overridedefault |
Destructor.
|
protected |
Extracts the information from a `StringList` and saves it into the correct data structures.
[in] | line | The line parsed from the input file |
[in] | headers | A mapping from a given header to its value's position |
[out] | cp | The extracted component parameters |
[out] | cgp | The extracted component group parameters |
void load | ( | const String & | filename, |
std::vector< MRMFeaturePicker::ComponentParams > & | cp_list, | ||
std::vector< MRMFeaturePicker::ComponentGroupParams > & | cgp_list | ||
) |
Loads the file's data and saves it into vectors of `ComponentParams` and `ComponentGroupParams`.
The file is expected to contain at least two columns: `component_name` and `component_group_name`. Otherwise, an exception is thrown.
If a component group (identified by its name) is found multiple times, only the first one is saved.
[in] | filename | Path to the .csv input file |
[out] | cp_list | Component params are saved in this list |
[out] | cgp_list | Component Group params are saved in this list |
Exception::MissingInformation | If the required columns are not found. |
Exception::FileNotFound | If input file is not found. |
Helper method which takes care of converting the given value to the desired type, based on the header (here `key`) information.
[in] | key | The header name with which the correct conversion is chosen |
[in] | value | The value to be converted |
[in,out] | params | The object where the new value is saved |