def __init__(self, sequence, mass=None, missed_cleavages=0, length=None, unordered=False):
     if mass is None:
         if isinstance(sequence, basestring):
             mass = sequence_to_mass(str(sequence)) - precursor_mass_shift
             length = len(sequence_tokenizer(sequence)[0])
         else:
             mass = sum(map(masser, sequence))
             length = len(sequence)
     self.sequence = sequence
     self.mass = mass
     self.missed_cleavages = missed_cleavages
     self.length = length
     self.unordered = unordered
 def __init__(self, sequence_str, mass=None, missed_cleavages=0, cleaver=None, mod_index=None, length=None):
     if mass is None:
         mass = sequence_to_mass(str(sequence_str)) - precursor_mass_shift
     super(SimpleFragment, self).__init__(
         sequence_str, mass, missed_cleavages, cleaver, mod_index, length)
from glycresoft_ms2_classification.structure.sequence import Sequence
from glycresoft_ms2_classification.structure.sequence import GrowingSequence
from glycresoft_ms2_classification.structure.sequence import Protease
from glycresoft_ms2_classification.structure.sequence import strip_modifications
from glycresoft_ms2_classification.structure.sequence import sequence_to_mass
from glycresoft_ms2_classification.structure.stub_glycopeptides import StubGlycopeptide
from glycresoft_ms2_classification.structure.composition import Composition
from glycresoft_ms2_classification.structure import modification
from glycresoft_ms2_classification.structure import residue
from glycresoft_ms2_classification.structure import glycans as glycan_lib
from glycresoft_ms2_classification.utils.mass_heap import MassHeap

mammalian_glycans = glycan_lib.load_from_file()

residue_symbols = residue.symbol_to_residue
smallest_mass = sequence_to_mass("G")


def generate_n_linked_sequons():
    wild_interval = set(residue_symbols)
    wild_interval.discard("P")
    sequons = map(''.join, itertools.product(["N"], wild_interval, ["S", "T"]))
    return sequons


def generate_component_set(constant_modifications, variable_modifications):
    components = set(residue_symbols)
    const_modified = set()
    for mod in constant_modifications:
        for symbol, name in residue_symbols.items():
            if mod.valid_site(name, "internal"):
def y_mass(seq):
    return sequence_to_mass(seq) - precursor_mass_shift + y_mass_shift