OpenMS
Loading...
Searching...
No Matches
FIAMSScheduler Class Reference

Batch driver for FIA-MS analyses. Dispatches each sample of a CSV-described batch to FIAMSDataProcessor. More...

#include <OpenMS/ANALYSIS/ID/FIAMSScheduler.h>

Collaboration diagram for FIAMSScheduler:
[legend]

Public Member Functions

 FIAMSScheduler ()=default
 Default-construct an empty scheduler (no samples loaded, paths set to defaults).
 
 FIAMSScheduler (std::string filename, std::string base_dir="/", std::string output_dir="/", bool load_cached_=true)
 Construct from a batch CSV and parse it immediately.
 
 ~FIAMSScheduler ()=default
 Default destructor.
 
 FIAMSScheduler (const FIAMSScheduler &cp)=default
 Copy constructor.
 
FIAMSScheduleroperator= (const FIAMSScheduler &fdp)=default
 Copy assignment.
 
void run ()
 Run the batch: process every sample loaded from the CSV.
 
const std::vector< std::map< std::string, std::string > > & getSamples ()
 Return the parsed batch as a vector of header-keyed std::map rows.
 
const std::string & getBaseDir ()
 Return the base directory passed to the constructor.
 
const std::string & getOutputDir ()
 Return the output directory passed to the constructor.
 

Private Member Functions

void loadSamples_ ()
 Parse the batch CSV at filename_ and populate samples_.
 

Private Attributes

std::string filename_
 CSV file describing the batch.
 
std::string base_dir_
 Base directory for per-sample input paths (must end with a path separator).
 
std::string output_dir_
 Base directory under which per-sample outputs are written (must end with a path separator).
 
bool load_cached_
 Forwarded to FIAMSDataProcessor::run; reuse cached results when true.
 
std::vector< std::map< std::string, std::string > > samples_
 Parsed CSV rows; populated by loadSamples_.
 

Detailed Description

Batch driver for FIA-MS analyses. Dispatches each sample of a CSV-described batch to FIAMSDataProcessor.

A CSV file describing the batch is parsed during construction. Each row defines one sample and is consumed by run, which loads the corresponding mzML file, configures a FIAMSDataProcessor instance, and runs the analysis once per requested time window. Samples are processed in parallel (OpenMP-parallelised loop).

The CSV is comma-delimited; the first row is taken as the header. Each subsequent row is stored as a header-keyed std::map<String, String>. The implementation looks up the following keys per row (column names as read from the CSV):

  • filename — base filename of the sample's mzML (no path, no .mzML extension); the loader appends .mzML.
  • dir_input — sample subdirectory relative to base_dir.
  • dir_output — sample subdirectory relative to output_dir; created on demand.
  • resolution — instrument resolution; parsed with std::stof.
  • charge — instrument polarity; forwarded as the polarity parameter of FIAMSDataProcessor (typical values "positive" / "negative").
  • db_mapping — accurate-mass database mapping file (relative to base_dir); forwarded as the db:mapping parameter (three tab-separated columns: mass, formula, identifier).
  • db_struct — accurate-mass database structure file (relative to base_dir); forwarded as the db:struct parameter (four tab-separated columns: identifier, name, SMILES, InChI).
  • positive_adducts / negative_adducts — adduct list files (relative to base_dir).
  • time";"-separated list of time windows in seconds (e.g. "30;60;90;180"); FIAMSDataProcessor::run is invoked once per window.

The mzML path opened for each sample is therefore base_dir + dir_input + "/" + filename + ".mzML".

No column validation is performed; missing or mis-named keys raise the usual std::map::at exception.

Constructor & Destructor Documentation

◆ FIAMSScheduler() [1/3]

FIAMSScheduler ( )
default

Default-construct an empty scheduler (no samples loaded, paths set to defaults).

◆ FIAMSScheduler() [2/3]

FIAMSScheduler ( std::string  filename,
std::string  base_dir = "/",
std::string  output_dir = "/",
bool  load_cached_ = true 
)

Construct from a batch CSV and parse it immediately.

The CSV at filename is read during construction (see class documentation for the expected columns) and the parsed rows are kept for subsequent run calls.

Parameters
filenameFull path to the batch CSV file.
base_dirBase directory used to resolve the per-row dir_input, db_mapping, db_struct, and adduct paths. Must end with a path separator.
output_dirOutput directory under which each row's dir_output is created. Must end with a path separator.
load_cached_Forwarded to FIAMSDataProcessor::run as its load_cached flag; if true, cached intermediate results are reused.

◆ ~FIAMSScheduler()

~FIAMSScheduler ( )
default

Default destructor.

◆ FIAMSScheduler() [3/3]

FIAMSScheduler ( const FIAMSScheduler cp)
default

Copy constructor.

Member Function Documentation

◆ getBaseDir()

const std::string & getBaseDir ( )

Return the base directory passed to the constructor.

◆ getOutputDir()

const std::string & getOutputDir ( )

Return the output directory passed to the constructor.

◆ getSamples()

const std::vector< std::map< std::string, std::string > > & getSamples ( )

Return the parsed batch as a vector of header-keyed std::map rows.

◆ loadSamples_()

void loadSamples_ ( )
private

Parse the batch CSV at filename_ and populate samples_.

Treats the first row as headers and every subsequent row as a sample; each row is stored as a header-keyed std::map<String, String>. Invoked by the constructor.

◆ operator=()

FIAMSScheduler & operator= ( const FIAMSScheduler fdp)
default

Copy assignment.

◆ run()

void run ( )

Run the batch: process every sample loaded from the CSV.

For each sample (rows are processed by an #pragma omp parallel for loop), this loads the mzML at base_dir/dir_input/filename.mzML, creates a fresh FIAMSDataProcessor with the per-row parameters, creates the per-sample dir_output directory if missing, and runs the processor once per time window listed in the row's time cell. Progress messages are emitted via OPENMS_LOG_INFO at the start and end of every (sample, time) pair.

Member Data Documentation

◆ base_dir_

std::string base_dir_
private

Base directory for per-sample input paths (must end with a path separator).

◆ filename_

std::string filename_
private

CSV file describing the batch.

◆ load_cached_

bool load_cached_
private

Forwarded to FIAMSDataProcessor::run; reuse cached results when true.

◆ output_dir_

std::string output_dir_
private

Base directory under which per-sample outputs are written (must end with a path separator).

◆ samples_

std::vector<std::map<std::string, std::string> > samples_
private

Parsed CSV rows; populated by loadSamples_.