alphabase.spectral_library.translate#

Classes:

WritingProcess(task_queue, tsv, *args, **kwargs)

Functions:

create_modified_sequence(seq_mods_sites[, ...])

Translate (sequence, mods, mod_sites) into a modified sequence.

is_nterm_frag(frag_type)

mask_fragment_intensity_by_frag_nAA(...)

mask_fragment_intensity_by_mz_(...)

merge_precursor_fragment_df(precursor_df, ...)

Convert alphabase library into a single dataframe.

speclib_to_single_df(speclib, *[, ...])

Convert alphabase library to diann (or Spectronaut) library dataframe This method is not important, as it will be only used by DiaNN, or spectronaut, or others

speclib_to_swath_df(speclib, *[, ...])

translate_to_tsv(speclib, tsv, *[, ...])

class alphabase.spectral_library.translate.WritingProcess(task_queue, tsv, *args, **kwargs)[source][source]#

Bases: Process

Methods:

__init__(task_queue, tsv, *args, **kwargs)

run()

Method to be run in sub-process; can be overridden in sub-class

__init__(task_queue, tsv, *args, **kwargs)[source][source]#
run()[source][source]#

Method to be run in sub-process; can be overridden in sub-class

alphabase.spectral_library.translate.create_modified_sequence(seq_mods_sites: Tuple, translate_mod_dict: dict = None, mod_sep='[]', nterm='_', cterm='_')[source][source]#

Translate (sequence, mods, mod_sites) into a modified sequence. Used by df.apply(). For example, (‘ABCDEFG’,’Mod1@A;Mod2@E’,’1;5’)->`_A[Mod1@A]BCDE[Mod2@E]FG_`.

Parameters:
  • seq_mods_sites (List) – must be (sequence, mods, mod_sites)

  • translate_mod_dict (dict) – A dict to map AlphaX modification names to other software, use unimod name if None. Defaults to None.

  • mod_sep (str) – ‘[]’ or ‘()’, default ‘[]’

alphabase.spectral_library.translate.is_nterm_frag(frag_type: str)[source][source]#
alphabase.spectral_library.translate.mask_fragment_intensity_by_frag_nAA(fragment_intensity_df: DataFrame, precursor_df: DataFrame, max_mask_frag_nAA)[source][source]#
alphabase.spectral_library.translate.mask_fragment_intensity_by_mz_(fragment_mz_df: DataFrame, fragment_intensity_df: DataFrame, min_frag_mz, max_frag_mz)[source][source]#
alphabase.spectral_library.translate.merge_precursor_fragment_df(precursor_df: DataFrame, fragment_mz_df: DataFrame, fragment_inten_df: DataFrame, top_n_inten: int, frag_type_head: str = 'FragmentType', frag_mass_head: str = 'FragmentMz', frag_inten_head: str = 'RelativeIntensity', frag_charge_head: str = 'FragmentCharge', frag_series_head: str = 'FragmentNumber', frag_loss_head: str = 'FragmentLossType', verbose=True)[source][source]#

Convert alphabase library into a single dataframe. This method is not important, as it will be only used by DiaNN, or spectronaut, or others

alphabase.spectral_library.translate.speclib_to_single_df(speclib: SpecLibBase, *, translate_mod_dict: dict = None, keep_k_highest_fragments: int = 12, min_frag_mz=200, max_frag_mz=2000, min_frag_intensity=0.01, min_frag_nAA=0, modloss: str = 'H3PO4', frag_type_head: str = 'FragmentType', frag_mass_head: str = 'FragmentMz', frag_inten_head: str = 'RelativeIntensity', frag_charge_head: str = 'FragmentCharge', frag_loss_head: str = 'FragmentLossType', frag_series_head: str = 'FragmentNumber', verbose=True) DataFrame[source][source]#

Convert alphabase library to diann (or Spectronaut) library dataframe This method is not important, as it will be only used by DiaNN, or spectronaut, or others

Parameters:
  • translate_mod_dict (dict) – A dict to map AlphaX modification names to other software, use unimod name if None. Defaults to None.

  • keep_k_highest_peaks (int) – only keep highest fragments for each precursor. Default: 12

Returns:

a single dataframe in the SWATH-like format

Return type:

pd.DataFrame

alphabase.spectral_library.translate.speclib_to_swath_df(speclib: SpecLibBase, *, keep_k_highest_fragments: int = 12, min_frag_mz=200, max_frag_mz=2000, min_frag_intensity=0.01) DataFrame[source][source]#
alphabase.spectral_library.translate.translate_to_tsv(speclib: SpecLibBase, tsv: str, *, keep_k_highest_fragments: int = 12, min_frag_mz: float = 200, max_frag_mz: float = 2000, min_frag_intensity: float = 0.01, min_frag_nAA: int = 0, batch_size: int = 100000, translate_mod_dict: dict = None, multiprocessing: bool = True)[source][source]#