alphabase.spectral_library.reader#

See examples in library_reader notebook.

Classes:

class alphabase.spectral_library.reader.LibraryReaderBase(charged_frag_types: List[str] = ['b_z1', 'b_z2', 'y_z1', 'y_z2', 'b_modloss_z1', 'b_modloss_z2', 'y_modloss_z1', 'y_modloss_z2'], column_mapping: dict = None, modification_mapping: dict = None, fdr=0.01, fixed_C57=False, mod_seq_columns=['ModifiedPeptideSequence', 'ModifiedPeptide', 'ModifiedSequence', 'FullUniModPeptideName', 'LabeledSequence', 'FullUniModPeptideName'], rt_unit='irt', precursor_mz_min: float = 400, precursor_mz_max: float = 2000, decoy: str = None, **kwargs)[source][source]#

Bases: MaxQuantReader, SpecLibBase

Methods:

__init__([charged_frag_types, ...])

Base class for reading spectral libraries from long format csv files.

__init__(charged_frag_types: List[str] = ['b_z1', 'b_z2', 'y_z1', 'y_z2', 'b_modloss_z1', 'b_modloss_z2', 'y_modloss_z1', 'y_modloss_z2'], column_mapping: dict = None, modification_mapping: dict = None, fdr=0.01, fixed_C57=False, mod_seq_columns=['ModifiedPeptideSequence', 'ModifiedPeptide', 'ModifiedSequence', 'FullUniModPeptideName', 'LabeledSequence', 'FullUniModPeptideName'], rt_unit='irt', precursor_mz_min: float = 400, precursor_mz_max: float = 2000, decoy: str = None, **kwargs)[source][source]#

Base class for reading spectral libraries from long format csv files.

Parameters:
  • charged_frag_types (list of str) – List of fragment types to be used in the spectral library. The default is [‘b_z1’,’b_z2’,’y_z1’, ‘y_z2’, ‘b_modloss_z1’,’b_modloss_z2’,’y_modloss_z1’, ‘y_modloss_z2’]

  • column_mapping (dict) – Dictionary mapping the column names in the csv file to the column names in the spectral library. The default is None, which uses the library_reader_base column mapping in psm_reader.yaml

  • modification_mapping (dict) – Dictionary mapping the modification names in the csv file to the modification names in the spectral library.

  • fdr (float) – False discovery rate threshold for filtering the spectral library. default is 0.01

  • fixed_C57 (bool) –

  • mod_seq_columns (list of str) – List of column names in the csv file containing the modified sequence. By default the mapping is taken from psm_reader.yaml

  • rt_unit (str) – Unit of the retention time column in the csv file. The default is ‘irt’

  • precursor_mz_min (float) – Minimum precursor m/z value for filtering the spectral library.

  • precursor_mz_max (float) – Maximum precursor m/z value for filtering the spectral library.

  • decoy (str) – Decoy type for the spectral library. Can be either pseudo_reverse or diann

class alphabase.spectral_library.reader.LibraryReaderFromRawData(charged_frag_types: List[str] = ['b_z1', 'b_z2', 'y_z1', 'y_z2', 'b_modloss_z1', 'b_modloss_z2', 'y_modloss_z1', 'y_modloss_z2'], precursor_mz_min: float = 400, precursor_mz_max: float = 2000, decoy: str = None, **kwargs)[source][source]#

Bases: SpecLibBase

Methods:

__init__([charged_frag_types, ...])

param charged_frag_types:

fragment types with charge.

extract_fragments(raw_files)

Include two steps:

import_psms(psm_files, psm_type)

__init__(charged_frag_types: List[str] = ['b_z1', 'b_z2', 'y_z1', 'y_z2', 'b_modloss_z1', 'b_modloss_z2', 'y_modloss_z1', 'y_modloss_z2'], precursor_mz_min: float = 400, precursor_mz_max: float = 2000, decoy: str = None, **kwargs)[source][source]#
Parameters:
  • charged_frag_types (List[str], optional) – fragment types with charge. Defaults to [ ‘b_z1’,’b_z2’,’y_z1’, ‘y_z2’ ].

  • precursor_mz_min (int, optional) – Use this to clip precursor df. Defaults to 400.

  • precursor_mz_max (int, optional) – Use this to clip precursor df. Defaults to 6000.

  • decoy (str, optional) – Decoy methods, could be “pseudo_reverse” or “diann”. Defaults to None.

extract_fragments(raw_files: list)[source][source]#
Include two steps:
  1. self.calc_fragment_mz_df() to generate self.fragment_mz_df

  2. Extract self.fragment_intensity_df from RAW files using AlphaRAW

Parameters:

raw_files (list) – RAW file paths

import_psms(psm_files: list, psm_type: str)[source][source]#
alphabase.spectral_library.reader.SWATHLibraryReader[source]#

alias of LibraryReaderBase Methods:

__init__([charged_frag_types, ...])

Base class for reading spectral libraries from long format csv files.