alphabase.peptide.mass_calc#

Functions:

calc_b_y_and_peptide_mass(sequence, ...[, ...])

It is highly recommend to use calc_b_y_and_peptide_masses_for_same_len_seqs as it is much faster

calc_b_y_and_peptide_masses_for_same_len_seqs(...)

Calculate b/y fragment masses and peptide masses for peptide sequences with same lengths.

calc_diff_modification_mass(pep_len, ...)

For open-search, we may also get modification mass diffs other than mod names.

calc_mod_diff_masses_for_same_len_seqs(nAA, ...)

Calculate diff modification masses for the given peptide length (nAA), For open-search, we may also get modification mass diffs other than mod names.

calc_peptide_masses_for_same_len_seqs(...[, ...])

Calculate peptide masses for peptide sequences with same lengths.

alphabase.peptide.mass_calc.calc_b_y_and_peptide_mass(sequence: str, mod_names: List[str], mod_sites: List[int], aa_mass_diffs: List[float] = None, aa_mass_diff_sites: List[int] = None) Tuple[ndarray, ndarray, float][source][source]#

It is highly recommend to use calc_b_y_and_peptide_masses_for_same_len_seqs as it is much faster

alphabase.peptide.mass_calc.calc_b_y_and_peptide_masses_for_same_len_seqs(sequences: ndarray, mod_list: List[List[str]], site_list: List[List[int]], mod_diff_list: List[List[float]] = None, mod_diff_site_list: List[List[int]] = None) Tuple[ndarray, ndarray, ndarray][source][source]#

Calculate b/y fragment masses and peptide masses for peptide sequences with same lengths. We need ‘same_len’ here because numpy can process AA sequences with same length very fast.

Parameters:
  • sequence (np.ndarray of str) – np.ndarray of peptie sequences with same length.

  • mod_list (List[List[str]]) – list of modifications , e.g. [[‘Oxidation@M’,’Phospho@S’],[‘Phospho@S’,’Deamidated@N’]]

  • site_list (List[List[int]]) – list of modification sites corresponding to mod_list, e.g. [[3,6],[4,17]]

  • mod_diff_list (List[List[float]]) – list of modifications, e.g. [[15.994915,79.966331],[79.966331,0.984016]]

  • mod_diff_site_list (List[List[int]]) – list of modification mass diff sites corresponding to mod_list, e.g. [[3,6],[4,17]]

Returns:

  • np.ndarray – neutral b fragment masses (2-D array)

  • np.ndarray – neutral y fragmnet masses (2-D array)

  • np.ndarray – neutral peptide masses (1-D array)

alphabase.peptide.mass_calc.calc_diff_modification_mass(pep_len: int, mass_diffs: List[float], mass_diff_sites: List[int]) ndarray[source][source]#

For open-search, we may also get modification mass diffs other than mod names. This function calculate modification masses from these diff masses.

Parameters:
  • pep_len (int) – nAA

  • mass_diffs (List[float]) – mass diffs on the peptide

  • mass_diff_sites (List[int]) – localized sites of corresponding mass diffs

Returns:

1-D array with length=`peplen`. Masses of modifications (mass diffs) through the peptide, 0 if sites has no modifications

Return type:

np.ndarray

alphabase.peptide.mass_calc.calc_mod_diff_masses_for_same_len_seqs(nAA: int, aa_mass_diffs_list: List[List[float]], mod_sites_list: List[List[int]]) ndarray[source][source]#

Calculate diff modification masses for the given peptide length (nAA), For open-search, we may also get modification mass diffs other than mod names. This function calculate modification masses from these diff masses.

Parameters:
  • nAA (int) – peptide length

  • mod_names_list (List[List[str]]) – list of modification list

  • mod_sites_list (List[List[int]]) – list of modification site list corresponding to mod_names_list. * site=0 refers to an N-term modification * site=-1 refers to a C-term modification * 1<=site<=peplen refers to a normal modification

Returns:

2-D array with shape=`(nAA, pep_count or len(mod_names_list)))`. Masses of modifications through all the peptides, 0 if sites has no modifications

Return type:

np.ndarray

alphabase.peptide.mass_calc.calc_peptide_masses_for_same_len_seqs(sequences: ndarray, mod_list: List[str], mod_diff_list: List[str] = None) ndarray[source][source]#

Calculate peptide masses for peptide sequences with same lengths. We need ‘same_len’ here because numpy can process AA sequences with same length very fast. See alphabase.aa.calc_sequence_masses_for_same_len_seqs

Parameters:
  • mod_list (List[str]) – list of modifications, e.g. [‘Oxidation@M;Phospho@S’,’Phospho@S;Deamidated@N’]

  • mass_diff_list (List[str]) – List of modifications as mass diffs, e.g. [‘15.9xx;79.9xxx’,’79.9xx;0.98xx’]

Returns:

peptide masses (1-D array, H2O already added)

Return type:

np.ndarray