private void DoValidate() { if (!BioMassCalc.IsSkylineHeavySymbol(IsotopeSymbol)) // e.g. accept H' but not D { throw new InvalidDataException(string.Format(Resources.IsotopeEnrichmentItem_DoValidate_Isotope_enrichment_is_not_supported_for_the_symbol__0__, IsotopeSymbol)); } if (MIN_ATOM_PERCENT_ENRICHMENT > AtomPercentEnrichment || AtomPercentEnrichment > MAX_ATOM_PERCENT_ENRICHMENT) { throw new InvalidDataException(string.Format(Resources.IsotopeEnrichmentItem_DoValidate_Atom_percent_enrichment__0__must_be_between__1__and__2__, AtomPercentEnrichment, MIN_ATOM_PERCENT_ENRICHMENT, MAX_ATOM_PERCENT_ENRICHMENT)); } }
public void TestGetHeavyFormula() { Assert.AreEqual("C'O2", SequenceMassCalc.GetHeavyFormula("CO2", LabelAtoms.C13)); Assert.AreEqual("C'O2", SequenceMassCalc.GetHeavyFormula("C'O2", LabelAtoms.C13)); Assert.AreEqual("C'", SequenceMassCalc.GetHeavyFormula("C", LabelAtoms.C13)); Assert.AreEqual("N'", SequenceMassCalc.GetHeavyFormula("N", LabelAtoms.N15)); Assert.AreEqual("O'", SequenceMassCalc.GetHeavyFormula("O", LabelAtoms.O18)); Assert.AreEqual("H'", SequenceMassCalc.GetHeavyFormula("H", LabelAtoms.H2)); Assert.AreEqual("Cl'", SequenceMassCalc.GetHeavyFormula("Cl", LabelAtoms.Cl37)); Assert.AreEqual("Br'", SequenceMassCalc.GetHeavyFormula("Br", LabelAtoms.Br81)); Assert.AreEqual("P'", SequenceMassCalc.GetHeavyFormula("P", LabelAtoms.P32)); Assert.AreEqual("S'", SequenceMassCalc.GetHeavyFormula("S", LabelAtoms.S34)); // Make sure IUPAC nicknames don't find their way into our list of heavy symbols Assume.IsTrue(BioMassCalc.IsSkylineHeavySymbol("H'")); Assume.IsFalse(BioMassCalc.IsSkylineHeavySymbol("D")); Assume.IsFalse(BioMassCalc.IsSkylineHeavySymbol("T")); }