alphabase.pg_reader.spectronaut_reader¶
Spectronaut Protein Group Reader.
Classes:
|
Reader for pivot reports from the Spectronaut search engine. |
- class alphabase.pg_reader.spectronaut_reader.SpectronautPGReader(*, column_mapping: dict[str, str] | None = None, measurement_regex: str | Literal['default'] | None = 'default')[source][source]¶
Bases:
PGReaderBaseReader for pivot reports from the Spectronaut search engine.
Examples
Get example data
import os import tempfile from alphabase.tools.data_downloader import DataShareDownloader from alphabase.pg_reader import SpectronautPGReader # Download to temporary directory # Data provided by Pham et al, 2024 (https://doi.org/10.1093/bioinformatics/btae432), # originally generated by Bekker-Jensen et al, 2020 (https://doi.org/10.1038/s41467-020-14609-1) URL = "https://datashare.biochem.mpg.de/s/ot008eF6wwSISvk" download_dir = tempfile.mkdtemp() download_path = DataShareDownloader(url=URL, output_dir=download_dir).download()
The reader will return the values that are stored in the spectronaut report. Note that the nature of these values depends on the selection made by the user during the data export in Spectronaut and might represent Protein Quantities or Peptide Quantities.
reader = SpectronautPGReader() results = reader.import_file(download_path) results.index.names > FrozenList(['proteins', 'genes'])
Spectronaut allows users to export a multitude of feature-level metadata. You can retrieve additional columns from the report by using the add_column_mapping method
reader = SpectronautPGReader() reader.add_column_mapping({"organism": "PG.Organisms"}) results = reader.import_file(spectronaut_path) results.index.names > FrozenList(['proteins', 'genes', 'organism'])
Methods:
__init__(*[, column_mapping, measurement_regex])Initialize Spectronaut protein group matrix reader.
- __init__(*, column_mapping: dict[str, str] | None = None, measurement_regex: str | Literal['default'] | None = 'default')[source][source]¶
Initialize Spectronaut protein group matrix reader.
- Parameters:
column_mapping – Dictionary mapping alphabase column names (keys) to Spectronaut column names (values). If None, uses default mapping from configuration file.
measurement_regex –
Pattern to select quantity columns
”default” (default): Intensities exported by the user in the spectronaut report. Might depend on the specific report.
custom: Any valid regular expression
See class documentation for usage examples and get_preconfigured_regex() for available patterns.