alphapepttools.io.read_pg_table#
- alphapepttools.io.read_pg_table(path, search_engine, *, column_mapping=None, measurement_regex=None, **reader_provider_kwargs)#
Read protein group table to the
anndata.AnnDataformatRead (features x observations) protein group matrices from proteomics search engines into the
anndata.AnnDataformat (observations x features). Per default, raw intensities are returned, which can be modified dependening on the search engine. If a single unique feature index could be derived from the input, the function will assign it as var index. Otherwise, an ascending integer var index will be used.Supported formats include
AlphaDIA (
alphadia)AlphaPept (
alphapept, csv+hdf)DIANN (
diann)MaxQuant (
maxquant)Spectronaut (
spectronaut, parquet + tsv)
See
alphabase.pg_readermodule for more information- Parameters:
path (
str) – Path to protein group matrixsearch_engine (
str) – Name of engine output, pass the method name of the corresponding reader.column_mapping (
Optional[dict[str,Any]] (default:None)) – Passed toalphabase.pg_reader.pg_reader_provider.get_reader(). A dictionary of mapping alphabase columns (keys) to the corresponding columns in the other search engine (values). IfNonewill be loaded from thecolumn_mappingkey of the respective search engine inpg_reader.yaml.measurement_regex (
Optional[str] (default:None)) – Passed toalphabase.pg_reader.pg_reader_provider.get_reader(). Regular expression that identifies correct measurement type. Only relevant if PG matrix contains multiple measurement types. For example, alphapept returns the raw protein intensity per sample in columnAand the LFQ corrected value inA_LFQ. IfNoneloads raw intensities.reader_provider_kwargs – Passed to
alphabase.pg_reader.pg_reader_provider.get_reader()
- Return type:
- Returns:
anndata.AnnDataAnnData object that can be further processed with scVerse packages.- adata.X
Stores values of the intensity columns in the report of shape observations x features
- adata.obs
Stores observations with protein group matrix sample names as
sample_idcolumn.
- adata.var
Stores features and feature metadata.
Example
from alphapepttools.io import read_pg_table alphadia_path = ... adata = read_pg_table(alphadia_path, search_engine="alphadia") maxquant_path = ... # Read LFQ values from MaxQuant report adata = read_pg_table(maxquant_path, search_engine="maxquant", measurement_regex="lfq")
Get available regular expressions
from alphabase.pg_reader import pg_reader_provider alphapept_reader = pg_reader_provider.get_reader("alphapept") alphapept_reader.get_preconfigured_regex() > {'raw': '^.*(?<!_LFQ)$', 'lfq': '_LFQ$'}
See also
alphabase.pg_reader