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

Library-level equivalent of the FileInfo tool. More...

#include <OpenMS/FORMAT/FileInfo.h>

Classes

struct  CorruptionInfo
 the -c (corrupt data) block More...
 
struct  DetailInfo
 detailed per-spectrum listing (the -d block); kept as pre-rendered lines More...
 
struct  ExperimentMeta
 experiment / instrument / sample / contact metadata (the -m block, peak files) More...
 
struct  FastaInfo
 FASTA specifics. More...
 
struct  FeatureInfo
 feature / consensus specifics More...
 
struct  FileMeta
 general header block (always populated) More...
 
struct  IdentInfo
 identification specifics (idXML / mzIdentML) More...
 
struct  MzTabInfo
 mzTab specifics More...
 
struct  NamedStats
 one named SummaryStatistics block; title is the label used in both renderers More...
 
struct  Options
 what to compute (mirrors the CLI flags; lets callers opt into expensive work) More...
 
struct  PeakInfo
 peak-file (MSExperiment) specifics More...
 
struct  ProcessingStep
 one data-processing step (the -p block) More...
 
struct  Range
 one [min,max] interval for a single dimension; present==false => "<none>" More...
 
struct  Ranges
 MSExperiment carries four range categories; non-MSExperiment maps fill only combined. More...
 
struct  RangeSet
 the four range dimensions FileInfo reports for a map / spectrum group More...
 
struct  Result
 the master result aggregate More...
 
struct  ValidationInfo
 the -v (schema/semantic validation) and -i (indexed mzML) blocks More...
 

Public Member Functions

 FileInfo ()=default
 
 ~FileInfo ()=default
 
Result run (const std::string &filename, const Options &options)
 Load filename (type auto-detected unless Options::forced_type set) and compute everything requested.
 
Result run (const std::string &filename)
 Load filename with default options (no extra flags).
 
Result runAll (const std::string &filename)
 Convenience: compute all content metrics (meta/processing/statistics on; no v/i/d/c).
 

Static Public Member Functions

static std::string toText (const Result &r, const Options &options)
 
static std::string toText (const Result &r)
 Return the human-readable rendering produced by run() (== the FileInfo CLI -out output, cached in r).
 
static std::string toTSV (const Result &r, const Options &options)
 
static std::string toTSV (const Result &r)
 Return the TSV rendering produced by run() (== the FileInfo CLI -out_tsv output, cached in r).
 

Private Member Functions

void report_ (const std::string &in, FileTypes::Type in_type, const Options &o, std::ostream &os, std::ostream &os_tsv, Result &r)
 

Detailed Description

Library-level equivalent of the FileInfo tool.

Loads a mass-spectrometry-related file (type auto-detected unless forced via Options::forced_type), extracts all file-level information into a structured FileInfo::Result, and can render that result as the exact human-readable text / TSV that the FileInfo command line tool emits.

Computation (run()) is fully separated from formatting (toText()/toTSV()), so the result is consumable directly from C++ and pyOpenMS without any stream.

FileInfo::Result r = fi.runAll("data.consensusXML");
std::cout << r.feature->num_features << "\n";
std::cout << FileInfo::toText(r); // == the FileInfo CLI output
Library-level equivalent of the FileInfo tool.
Definition FileInfo.h:48
Result runAll(const std::string &filename)
Convenience: compute all content metrics (meta/processing/statistics on; no v/i/d/c).
std::optional< FeatureInfo > feature
Definition FileInfo.h:224
static std::string toText(const Result &r, const Options &options)
the master result aggregate
Definition FileInfo.h:220

Class Documentation

◆ OpenMS::FileInfo::CorruptionInfo

struct OpenMS::FileInfo::CorruptionInfo

the -c (corrupt data) block

Collaboration diagram for FileInfo::CorruptionInfo:
[legend]
Class Members
vector< string > errors
bool performed = false
vector< string > warnings already-formatted message lines

◆ OpenMS::FileInfo::DetailInfo

struct OpenMS::FileInfo::DetailInfo

detailed per-spectrum listing (the -d block); kept as pre-rendered lines

Collaboration diagram for FileInfo::DetailInfo:
[legend]
Class Members
vector< string > lines
bool performed = false

◆ OpenMS::FileInfo::ExperimentMeta

struct OpenMS::FileInfo::ExperimentMeta

experiment / instrument / sample / contact metadata (the -m block, peak files)

Collaboration diagram for FileInfo::ExperimentMeta:
[legend]
Class Members
vector< Contact > contacts
string date
vector< string > detectors
string document_id
string instrument_model
string instrument_name
string instrument_vendor
vector< string > ion_sources
vector< string > mass_analyzers
bool present = false
string sample_comment
string sample_name
string sample_organism

◆ OpenMS::FileInfo::FastaInfo

struct OpenMS::FileInfo::FastaInfo

FASTA specifics.

Collaboration diagram for FileInfo::FastaInfo:
[legend]
Class Members
map< string, UInt64 > ambiguity_counts buckets depend on is_nucleic_acid
UInt64 dup_headers = 0
UInt64 dup_sequences = 0
bool is_nucleic_acid = false
SummaryStatistics< vector< double > > length_stats
UInt64 num_sequences = 0
map< char, UInt64 > residue_counts
UInt64 seq_with_ambiguous = 0
UInt64 total_residues = 0

◆ OpenMS::FileInfo::FeatureInfo

struct OpenMS::FileInfo::FeatureInfo

feature / consensus specifics

Collaboration diagram for FileInfo::FeatureInfo:
[legend]
Class Members
UInt64 assigned_ids = 0
map< Int, UInt64 > charges charge -> count
map< UInt64, UInt64 > ids_per_element number of IDs -> number of elements
bool is_consensus = false
vector< MapColumn > map_columns
UInt64 num_features = 0 number of (consensus) features
map< UInt64, UInt64 > size_distribution consensus-feature size -> count
double tic = 0.0 total ion current (featureXML)
UInt64 unassigned_ids = 0

◆ OpenMS::FileInfo::FileMeta

struct OpenMS::FileInfo::FileMeta

general header block (always populated)

Collaboration diagram for FileInfo::FileMeta:
[legend]
Class Members
string file_name
Type file_type = FileTypes::UNKNOWN
string file_type_name FileTypes::typeToName(file_type)

◆ OpenMS::FileInfo::IdentInfo

struct OpenMS::FileInfo::IdentInfo

identification specifics (idXML / mzIdentML)

Collaboration diagram for FileInfo::IdentInfo:
[legend]
Class Members
double avg_peptide_length = 0.0
string db_name
string db_version
UInt64 matched_spectra = 0
map< string, UInt64 > modification_counts
UInt64 modified_tophits = 0
UInt64 non_redundant_peptides = 0
UInt64 non_redundant_protein_hits = 0
UInt64 num_runs = 0
UInt64 peptide_hits = 0
UInt64 protein_hits = 0
double psms_per_spectrum = 0.0
vector< string > search_engines "engine (version)"
string taxonomy

◆ OpenMS::FileInfo::MzTabInfo

struct OpenMS::FileInfo::MzTabInfo

mzTab specifics

Collaboration diagram for FileInfo::MzTabInfo:
[legend]
Class Members
string mode
UInt64 nucleic_acids = 0
UInt64 oligonucleotides = 0
UInt64 osms = 0
UInt64 peptides = 0
UInt64 proteins = 0
UInt64 psms = 0
UInt64 small_molecules = 0
string type
string version

◆ OpenMS::FileInfo::NamedStats

struct OpenMS::FileInfo::NamedStats

one named SummaryStatistics block; title is the label used in both renderers

Collaboration diagram for FileInfo::NamedStats:
[legend]
Class Members
SummaryStatistics< vector< double > > stats
string title

◆ OpenMS::FileInfo::Options

struct OpenMS::FileInfo::Options

what to compute (mirrors the CLI flags; lets callers opt into expensive work)

Collaboration diagram for FileInfo::Options:
[legend]
Class Members
bool check_corrupt = false -c
bool check_index = false -i
bool detailed = false -d
Type forced_type = FileTypes::UNKNOWN == CLI -in_type
bool meta = false -m
bool processing = false -p
bool statistics = false -s
bool validate = false -v

◆ OpenMS::FileInfo::ProcessingStep

struct OpenMS::FileInfo::ProcessingStep

one data-processing step (the -p block)

Collaboration diagram for FileInfo::ProcessingStep:
[legend]
Class Members
vector< string > actions
string completion_time
string software_name
string software_version

◆ OpenMS::FileInfo::Range

struct OpenMS::FileInfo::Range

one [min,max] interval for a single dimension; present==false => "<none>"

Collaboration diagram for FileInfo::Range:
[legend]
Class Members
double max = 0.0
double min = 0.0
bool present = false

◆ OpenMS::FileInfo::Ranges

struct OpenMS::FileInfo::Ranges

MSExperiment carries four range categories; non-MSExperiment maps fill only combined.

Collaboration diagram for FileInfo::Ranges:
[legend]
Class Members
RangeSet chromatograms MSExperiment only.
RangeSet combined spectra + chromatograms (or the whole map)
bool is_experiment = false true => the per-level / chrom sections apply
map< UInt, RangeSet > per_ms_level MSExperiment only, keyed by MS level.
RangeSet spectra_overall MSExperiment only.

◆ OpenMS::FileInfo::RangeSet

struct OpenMS::FileInfo::RangeSet

the four range dimensions FileInfo reports for a map / spectrum group

Collaboration diagram for FileInfo::RangeSet:
[legend]
Class Members
bool has_mobility = false whether the mobility dimension applies at all
Range intensity
Range mobility ion mobility (only filled when the source carries it)
Range mz mass-to-charge
Range rt retention time (seconds)

◆ OpenMS::FileInfo::Result

struct OpenMS::FileInfo::Result

the master result aggregate

Collaboration diagram for FileInfo::Result:
[legend]
Class Members
CorruptionInfo corruption
DetailInfo detail
optional< ExperimentMeta > experiment_meta
optional< FastaInfo > fasta
optional< FeatureInfo > feature
optional< IdentInfo > ident
FileMeta meta
optional< MzTabInfo > mztab
optional< PeakInfo > peak
vector< ProcessingStep > processing
Ranges ranges filled for peak / feature / consensus
vector< NamedStats > statistics
string targeted_summary PQP: getSummary()
string text Human-readable rendering, identical to the FileInfo CLI -out output (filled by run()).
string transformation_summary trafoXML: model + printSummary
string tsv TSV rendering, identical to the FileInfo CLI -out_tsv output (filled by run()).
ValidationInfo validation

◆ OpenMS::FileInfo::ValidationInfo

struct OpenMS::FileInfo::ValidationInfo

the -v (schema/semantic validation) and -i (indexed mzML) blocks

Collaboration diagram for FileInfo::ValidationInfo:
[legend]
Class Members
string detail captured validator output (re-emitted verbatim)
vector< string > errors semantic validation
bool index_checked = false
bool index_valid = false
UInt64 indexed_chromatograms = 0
UInt64 indexed_spectra = 0
bool performed = false
string schema_version
bool supported = true
bool valid = false
vector< string > warnings

Constructor & Destructor Documentation

◆ FileInfo()

FileInfo ( )
default

◆ ~FileInfo()

~FileInfo ( )
default

Member Function Documentation

◆ report_()

void report_ ( const std::string &  in,
FileTypes::Type  in_type,
const Options o,
std::ostream &  os,
std::ostream &  os_tsv,
Result r 
)
private

Single computation+rendering core: loads in (already type-detected as in_type), writes the human-readable / TSV report to os / os_tsv, and populates r. Mirrors the historical TOPPFileInfo::outputTo_ so CLI output stays byte-identical.

◆ run() [1/2]

Result run ( const std::string &  filename)
inline

Load filename with default options (no extra flags).

See also
run(filename, options) for the exception contract.

References FileInfo::run().

Referenced by FileInfo::run().

◆ run() [2/2]

Result run ( const std::string &  filename,
const Options options 
)

Load filename (type auto-detected unless Options::forced_type set) and compute everything requested.

Exceptions
Exception::FileNotFoundif filename does not exist
Exception::ParseError/ format-specific exceptions if the file cannot be read (the loaders are not caught here; the CLI wrapper relies on TOPPBase to convert these to exit codes).

◆ runAll()

Result runAll ( const std::string &  filename)

Convenience: compute all content metrics (meta/processing/statistics on; no v/i/d/c).

See also
run for throws.

◆ toText() [1/2]

static std::string toText ( const Result r)
inlinestatic

Return the human-readable rendering produced by run() (== the FileInfo CLI -out output, cached in r).

References FileInfo::toText().

Referenced by FileInfo::toText().

◆ toText() [2/2]

static std::string toText ( const Result r,
const Options options 
)
static

Return the human-readable rendering produced by run() (== the FileInfo CLI -out output, cached in r).

Note
options is accepted for API symmetry only; the rendering reflects the Options passed to run().

◆ toTSV() [1/2]

static std::string toTSV ( const Result r)
inlinestatic

Return the TSV rendering produced by run() (== the FileInfo CLI -out_tsv output, cached in r).

References FileInfo::toTSV().

Referenced by FileInfo::toTSV().

◆ toTSV() [2/2]

static std::string toTSV ( const Result r,
const Options options 
)
static

Return the TSV rendering produced by run() (== the FileInfo CLI -out_tsv output, cached in r).

Note
options is accepted for API symmetry only; the rendering reflects the Options passed to run().