How to use the pyteomics.mass.std_aa_comp function in pyteomics

To help you get started, we’ve selected a few pyteomics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kusterlab / prosit / prosit / converters / msp.py View on Github external
def generate_aa_comp():
    """
    >>> aa_comp = generate_aa_comp()
    >>> aa_comp["M"]
    Composition({'H': 9, 'C': 5, 'S': 1, 'O': 1, 'N': 1})
    >>> aa_comp["Z"]
    Composition({'H': 9, 'C': 5, 'S': 1, 'O': 2, 'N': 1})
    """
    db = pyteomics.mass.Unimod()
    aa_comp = dict(pyteomics.mass.std_aa_comp)
    s = db.by_title("Oxidation")["composition"]
    aa_comp["Z"] = aa_comp["M"] + s
    s = db.by_title("Carbamidomethyl")["composition"]
    aa_comp["C"] = aa_comp["C"] + s
    return aa_comp
github compomics / moFF / moff.py View on Github external
fix_mod_count = row.mod_peptide.count('C')
                if fix_mod_count > 0:
                    comps["H"] += (ptm_map['cC']['deltaChem']
                                   [0] * fix_mod_count)
                    comps["C"] += (ptm_map['cC']['deltaChem']
                                   [1] * fix_mod_count)
                    comps["N"] += (ptm_map['cC']['deltaChem']
                                   [2] * fix_mod_count)
                    comps["O"] += (ptm_map['cC']['deltaChem']
                                   [3] * fix_mod_count)
                comps["H"] += 2
                comps["O"] += 1
        else:
            # fixed and variable mod are both in the sequence
            comps = Counter(
                list(chain(*[list(std_aa_comp[aa].elements()) for aa in row.peptide])))
            if '<' in row.mod_peptide or '-' in row.mod_peptide:
                # check only if modificatio are present.
                # for the future use dthe tag_mod_sequence_delimiter use in moFF_setting
                for ptm in ptm_map.keys():
                    ptm_c = row.mod_peptide.count(ptm)
                    # ptm_c =  sum(ptm in s for s in row.mod_peptide)
                    if ptm_c >= 1:
                        comps["H"] += (ptm_map[ptm]['deltaChem'][0] * ptm_c)
                        comps["C"] += (ptm_map[ptm]['deltaChem'][1] * ptm_c)
                        comps["N"] += (ptm_map[ptm]['deltaChem'][2] * ptm_c)
                        comps["O"] += (ptm_map[ptm]['deltaChem'][3] * ptm_c)
            comps["H"] += 2
            comps["O"] += 1

        theoretical_isotopic_cluster = isotopic_variants(
            comps,   charge= int(round(row.mass / float(row.mz))) , npeaks=3)