How to use the pyteomics.cmass.fast_mass 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 bittremieux / spectrum_utils / spectrum_utils / spectrum.py View on Github external
else:
        mods = {}
    ions = []
    for i in range(1, len(peptide)):
        for ion_type in types:
            if ion_type in 'abc':   # N-terminal fragment.
                ion_index = i
                sequence = peptide[:i]
                mod_mass = sum([md for pos, md in mods.items() if pos < i])
            else:   # C-terminal fragment.
                ion_index = len(peptide) - i
                sequence = peptide[i:]
                mod_mass = sum([md for pos, md in mods.items() if pos >= i])
            for charge in range(1, max_charge + 1):
                ions.append(PeptideFragmentAnnotation(
                    charge, mass.fast_mass(
                        sequence=sequence, ion_type=ion_type,
                        charge=charge, aa_mass=_aa_mass) + mod_mass / charge,
                    ion_type, ion_index))
    return sorted(ions, key=operator.attrgetter('calc_mz'))