![]() |
OpenMS
|
Loads MRM component and component-group parameter sets from a comma-separated file. More...
#include <OpenMS/FORMAT/MRMFeaturePickerFile.h>
Public Member Functions | |
| MRMFeaturePickerFile ()=default | |
| Default constructor. | |
| ~MRMFeaturePickerFile () override=default | |
| Destructor. | |
| void | load (const std::string &filename, std::vector< MRMFeaturePicker::ComponentParams > &cp_list, std::vector< MRMFeaturePicker::ComponentGroupParams > &cgp_list) |
Read filename and populate cp_list / cgp_list. | |
Public Member Functions inherited from CsvFile | |
| CsvFile () | |
| Default constructor. | |
| ~CsvFile () override | |
| destructor | |
| CsvFile (const std::string &filename, char is=',', bool ie=false, Int first_n=-1) | |
| Constructor with filename. | |
| void | load (const std::string &filename, char is=',', bool ie=false, Int first_n=-1) |
| Loads data from a text file. | |
| void | store (const std::string &filename) |
| Stores the buffer's content into a file. | |
| void | addRow (const StringList &list) |
| Add a row to the buffer. | |
| void | clear () |
| Clears the buffer. | |
| bool | getRow (Size row, StringList &list) const |
| writes all items from a row to list | |
| std::vector< std::string >::size_type | rowCount () const |
| Returns the number of rows that were loaded from the file. | |
Protected Member Functions | |
| bool | extractParamsFromLine_ (const StringList &line, const std::map< std::string, Size > &headers, MRMFeaturePicker::ComponentParams &cp, MRMFeaturePicker::ComponentGroupParams &cgp) const |
Extract the ComponentParams and ComponentGroupParams entries from a single parsed CSV line. | |
| void | setCastValue_ (const std::string &key, const std::string &value, Param ¶ms) const |
Insert value into params under key, converting the string to the type expected for that parameter name. | |
Loads MRM component and component-group parameter sets from a comma-separated file.
Produces parallel ComponentParams and ComponentGroupParams vectors (see MRMFeaturePicker) for use by MRMFeaturePicker.
"component_name" and "component_group_name". Any additional column is interpreted by its header name:"TransitionGroupPicker:PeakPickerChromatogram:<param>" feeds the per-component parameter set (ComponentParams::params)."TransitionGroupPicker:<param>" (without the PeakPickerChromatogram prefix) feeds the per-component-group parameter set (ComponentGroupParams::params).component_name or component_group_name cell is empty are skipped entirely.A reduced example (fewer columns are shown here):
component_name,component_group_name,TransitionGroupPicker:stop_after_feature,TransitionGroupPicker:PeakPickerChromatogram: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 |
Default constructor.
|
overridedefault |
Destructor.
|
protected |
Extract the ComponentParams and ComponentGroupParams entries from a single parsed CSV line.
Reads component_name and component_group_name from line via headers; if either is empty, the call returns false and cp / cgp are left in an unspecified state. Otherwise every column whose header matches one of the TransitionGroupPicker: prefixes feeds the corresponding parameter set as described in the class brief.
| [in] | line | Tokens of the input line, indexed by headers. |
| [in] | headers | Mapping from header name to column index in line. |
| [out] | cp | Receives the per-component parameters. |
| [out] | cgp | Receives the per-component-group parameters (component_group_name plus any matching values). |
true on a fully-populated pair; false when either required name cell was empty. | void load | ( | const std::string & | filename, |
| std::vector< MRMFeaturePicker::ComponentParams > & | cp_list, | ||
| std::vector< MRMFeaturePicker::ComponentGroupParams > & | cgp_list | ||
| ) |
Read filename and populate cp_list / cgp_list.
Both output vectors are cleared at the start of the call. The file is parsed as comma-separated; the first non-empty line is treated as the header. For every subsequent line with non-empty component_name and component_group_name cells one ComponentParams entry is appended to cp_list. A ComponentGroupParams entry is appended to cgp_list only the first time a given component_group_name is encountered; subsequent rows with the same group name extend cp_list but do not produce a new cgp_list entry.
| [in] | filename | Path to the .csv input file. |
| [out] | cp_list | Receives the per-row component parameters. |
| [out] | cgp_list | Receives one entry per unique component_group_name. |
| Exception::MissingInformation | When the required component_name and/or component_group_name columns are absent. |
| Exception::FileNotFound | When filename cannot be opened. |
|
protected |
Insert value into params under key, converting the string to the type expected for that parameter name.
Empty values are dropped without modifying params. The target type is selected by looking key up in a hard-coded table:
"gauss_width", "peak_width", "signal_to_noise", "sn_win_len", "stop_after_intensity_ratio", "min_peak_width", "recalculate_peaks_max_z", "minimal_quality", "resample_boundary" -> double."use_gauss", "write_sn_log_messages", "remove_overlapping_peaks", "recalculate_peaks", "use_precursors", "compute_peak_quality", "compute_peak_shape_metrics" -> bool (case-insensitive "true" maps to "true", everything else to "false")."sgolay_frame_length", "sgolay_polynomial_order", "sn_bin_count" -> UInt (via double rounding)."stop_after_feature" -> Int.String.| [in] | key | Parameter name (the column header with any TransitionGroupPicker: prefix already stripped). |
| [in] | value | Value to convert. |
| [in,out] | params | Parameter container to update. |