File adapter for MRMFeatureQC files.
More...
#include <OpenMS/FORMAT/MRMFeatureQCFile.h>
|
void | pushValuesFromLine_ (const StringList &line, const std::map< String, Size > &headers, std::vector< MRMFeatureQC::ComponentQCs > &c_qcs) const |
| Save values from a line to a `ComponentQCs`. More...
|
|
void | pushValuesFromLine_ (const StringList &line, const std::map< String, Size > &headers, std::vector< MRMFeatureQC::ComponentGroupQCs > &cg_qcs) const |
| Save values from a line to a `ComponentGroupQCs`. More...
|
|
void | setPairValue_ (const String &key, const String &value, const String &boundary, std::map< String, std::pair< double, double >> &meta_values_qc) const |
| Set one of the values in a pair. More...
|
|
Int | getCastValue_ (const std::map< String, Size > &headers, const StringList &line, const String &header, const Int default_value) const |
| Extracts a column's value from a line. More...
|
|
double | getCastValue_ (const std::map< String, Size > &headers, const StringList &line, const String &header, const double default_value) const |
| Extracts a column's value from a line. More...
|
|
String | getCastValue_ (const std::map< String, Size > &headers, const StringList &line, const String &header, const String &default_value) const |
| Extracts a column's value from a line. More...
|
|
|
enum | LogType { CMD,
GUI,
NONE
} |
| Possible log types. More...
|
|
static String | logTypeToFactoryName_ (LogType type) |
| Return the name of the factory product used for this log type. More...
|
|
LogType | type_ |
|
time_t | last_invoke_ |
|
ProgressLoggerImpl * | current_logger_ |
|
static int | recursion_depth_ |
|
| 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...
|
|
File adapter for MRMFeatureQC files.
Loads and stores .csv or .tsv files describing an MRMFeatureQC.
◆ MRMFeatureQCFile()
◆ ~MRMFeatureQCFile()
◆ getCastValue_() [1/3]
Extracts a column's value from a line.
The method looks for the value found within `line[headers[header]]`. If the information is present and its value is valid, it will be converted to `Int` and returned. Otherwise, `default_value` (provided by the user) is returned.
- Parameters
-
[in] | headers | The mapping from columns' name to positions' indices |
[in] | line | A list of strings containing a single row's values |
[in] | header | The desired value's column name |
[in] | default_value | A default value to return in case the information is not found or invalid |
- Returns
- The found information (if found and valid) converted to `Int`. Otherwise `default_value`.
◆ getCastValue_() [2/3]
Extracts a column's value from a line.
The method looks for the value found within `line[headers[header]]`. If the information is present and its value is valid, it will be converted to `double` and returned. Otherwise, `default_value` (provided by the user) is returned.
- Parameters
-
[in] | headers | The mapping from columns' name to positions' indices |
[in] | line | A list of strings containing a single row's values |
[in] | header | The desired value's column name |
[in] | default_value | A default value to return in case the information is not found or invalid |
- Returns
- The found information (if found and valid) converted to `double`. Otherwise `default_value`.
◆ getCastValue_() [3/3]
Extracts a column's value from a line.
The method looks for the value found within `line[headers[header]]`. If the information is present and its value is valid, it will be converted to `String` and returned. Otherwise, `default_value` (provided by the user) is returned.
- Parameters
-
[in] | headers | The mapping from columns' name to positions' indices |
[in] | line | A list of strings containing a single row's values |
[in] | header | The desired value's column name |
[in] | default_value | A default value to return in case the information is not found or invalid |
- Returns
- The found information (if found and valid) converted to `String`. Otherwise `default_value`.
◆ load()
void load |
( |
const String & |
filename, |
|
|
MRMFeatureQC & |
mrmfqc, |
|
|
const bool |
is_component_group |
|
) |
| const |
Loads an MRMFeatureQC file.
- Exceptions
-
- Parameters
-
[in] | filename | The path to the input file |
[in,out] | mrmfqc | The output class which will contain the criteria |
[in] | is_component_group | true if the user intends to load ComponentGroupQCs data, false otherwise |
◆ pushValuesFromLine_() [1/2]
Save values from a line to a `ComponentQCs`.
- Note
- Lines missing the `component_name` value will be skipped.
- Parameters
-
[in] | line | A line containing the values from a row in the input file |
[in] | headers | A mapping from headers names to position indices |
[out] | c_qcs | The output will be saved in a new element of this vector |
◆ pushValuesFromLine_() [2/2]
Save values from a line to a `ComponentGroupQCs`.
- Note
- Lines missing the `component_group_name` value will be skipped.
- Parameters
-
[in] | line | A line containing the values from a row in the input file |
[in] | headers | A mapping from headers names to position indices |
[out] | cg_qcs | The output will be saved in a new element of this vector |
◆ setPairValue_()
Set one of the values in a pair.
The method is given in input a map from Strings to pairs. Assuming the key is present within the map, its mapped value will be updated with the given `value`, in the correct `boundary` position. If the key is not found, a new pair will be created and both its values set (in this case, a default value of 0.0 is given to the other pair's element).
- Parameters
-
[in] | key | The metavalue name |
[in] | value | The mapped pair |
[in] | boundary | "l" for lower bound or "u" for upper bound |
[out] | meta_values_qc | The map containing the metavalues and pairs |