bool SatisfyCriteria(IGlycan glycan) { int hexNAc = 0, hex = 0, fuc = 0, neuAc = 0, neuGc = 0; SortedDictionary <Monosaccharide, int> composite = glycan.Composition(); foreach (var key in composite.Keys) { switch (key) { case Monosaccharide.GlcNAc: hexNAc += composite[key]; break; case Monosaccharide.Gal: hex += composite[key]; break; case Monosaccharide.Man: hex += composite[key]; break; case Monosaccharide.Fuc: fuc += composite[key]; break; case Monosaccharide.NeuAc: neuAc += composite[key]; break; case Monosaccharide.NeuGc: neuGc += composite[key]; break; default: break; } } return(hexNAc <= hexNAc_ && hex <= hex_ && fuc <= fuc_ && neuAc <= neuAc_ && neuGc <= neuGc_); }
private double PermethylatedGlycanMass(IGlycan glycan) { double mass = 0; SortedDictionary <Monosaccharide, int> composite = glycan.Composition(); foreach (var monosaccharide in composite.Keys) { switch (monosaccharide) { case Monosaccharide.GlcNAc: mass += kPermHexNAc * composite[monosaccharide]; break; case Monosaccharide.Gal: mass += kPermHex * composite[monosaccharide]; break; case Monosaccharide.Man: mass += kPermHex * composite[monosaccharide]; break; case Monosaccharide.Fuc: mass += kPermFuc * composite[monosaccharide]; break; case Monosaccharide.NeuAc: mass += kPermNeuAc * composite[monosaccharide]; break; case Monosaccharide.NeuGc: mass += kPermNeuGc * composite[monosaccharide]; break; default: break; } } return(mass); }