OSWReader
- class pyprophet.io.export.osw.OSWReader(config: ExportIOConfig)[source]
Bases:
BaseOSWReaderClass for reading and processing data from an OpenSWATH workflow OSW-sqlite based file. Extended to support exporting functionality.
- __init__(config: ExportIOConfig)[source]
Initialize the reader with a given configuration.
- Parameters:
config (BaseIOConfig) – Configuration object containing input details, and module specific config for params for reading.
- _fetch_alignment_features(con, cfg)[source]
Fetch aligned features with good alignment scores.
This method retrieves features that have been aligned across runs and pass the alignment quality threshold. Only features whose reference feature passes the MS2 QVALUE threshold are included, ensuring that recovered peaks are aligned to high-quality reference features.
- Parameters:
con – Database connection
cfg – Configuration object with max_alignment_pep threshold
- Returns:
DataFrame with aligned feature IDs that pass quality threshold
- _get_peptide_protein_score_table_sqlite(con, level: str) str[source]
SQLite-compatible view builder for peptide/protein score tables. Always exposes the same columns: - *_EXPERIMENT_WIDE_(SCORE|PVALUE|QVALUE|PEP) (per RUN_ID) - *_RUN_SPECIFIC_(SCORE|PVALUE|QVALUE|PEP) (per RUN_ID) - *_GLOBAL_(SCORE|PVALUE|QVALUE|PEP) (no RUN_ID)
- _has_im(con) bool[source]
Return True if the FEATURE table contains the EXP_IM column.
Older OSW files may not have this column; centralise the PRAGMA check so callers don’t duplicate the logic.
- _has_im_boundaries(con) bool[source]
Return True if the FEATURE table contains IM boundary columns.
Older OSW files may not have these columns; this helper centralises the PRAGMA check so callers don’t duplicate the logic.
- _read_for_export_scored_report(con) DataFrame[source]
Lightweight reader that returns the minimal scored-report columns from an OSW SQLite. It tolerates missing tables by emitting NULL columns for absent sources.
- _read_standard_data(con, cfg)[source]
Read standard OpenSWATH data without IPF, optionally including aligned features.
- export_feature_scores(outfile: str, plot_callback)[source]
Export feature scores from OSW file for plotting.
Detects if SCORE tables exist and adjusts behavior: - If SCORE tables exist: applies RANK==1 filtering and plots SCORE + VAR_ columns - If SCORE tables don’t exist: plots only VAR_ columns
- Parameters:
outfile (str) – Path to the output PDF file.
plot_callback (callable) – Function to call for plotting each level’s data. Signature: plot_callback(df, outfile, level, append)