public void TestGeneratorSavesState() { IsotopePatternGenerator isogen = new IsotopePatternGenerator(.1); IMolecularFormula mf1 = MolecularFormulaManipulator.GetMolecularFormula("C6H12O6", builder); IsotopePattern ip1 = isogen.GetIsotopes(mf1); Assert.AreEqual(1, ip1.Isotopes.Count); IMolecularFormula mf2 = MolecularFormulaManipulator.GetMolecularFormula("C6H12O6", builder); IsotopePattern ip2 = isogen.GetIsotopes(mf2); Assert.AreEqual(1, ip2.Isotopes.Count); }
public void TestCalculateIsotopesOrthinine() { // RESULTS ACCORDING PAGE: http://www2.sisweb.com/mstools/isotope.htm double[] massResults = { 133.097720, 134.094750, 134.101079, 134.103990, 135.101959, 135.104430 }; double[] abundResults = { 1.00, .006, .054, 0.002, 0.004, 0.001 }; IMolecularFormula molFor = new MolecularFormula(); molFor.Add(builder.NewIsotope("C"), 5); molFor.Add(builder.NewIsotope("H"), 13); molFor.Add(builder.NewIsotope("N"), 2); molFor.Add(builder.NewIsotope("O"), 2); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(0.0010); IsotopePattern isoPattern = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(6, isoPattern.Isotopes.Count); Assert.AreEqual(massResults[0], isoPattern.Isotopes[0].Mass, 0.01); Assert.AreEqual(massResults[1], isoPattern.Isotopes[1].Mass, 0.01); Assert.AreEqual(massResults[2], isoPattern.Isotopes[2].Mass, 0.01); Assert.AreEqual(massResults[3], isoPattern.Isotopes[3].Mass, 0.01); Assert.AreEqual(massResults[4], isoPattern.Isotopes[4].Mass, 0.01); Assert.AreEqual(massResults[5], isoPattern.Isotopes[5].Mass, 0.01); Assert.AreEqual(abundResults[0], isoPattern.Isotopes[0].Intensity, 0.01); Assert.AreEqual(abundResults[1], isoPattern.Isotopes[1].Intensity, 0.01); Assert.AreEqual(abundResults[2], isoPattern.Isotopes[2].Intensity, 0.01); Assert.AreEqual(abundResults[3], isoPattern.Isotopes[3].Intensity, 0.01); Assert.AreEqual(abundResults[4], isoPattern.Isotopes[4].Intensity, 0.01); Assert.AreEqual(abundResults[5], isoPattern.Isotopes[5].Intensity, 0.01); }
public void TestGetIsotopesIMolecularFormulaWithoutONE() { IMolecularFormula molFor = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula("C41H79N8O3P", builder); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(.01); IsotopePattern isos = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(6, isos.Isotopes.Count, 0.001); }
[TestMethod(), Ignore()] //Non-deterministic test value is bad! This likely depends on our current isotope data which is also bad. public void TestCalculateIsotopesC20H30Fe2P2S4Cl4() { IMolecularFormula molFor = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula("C20H30Fe2P2S4Cl4", builder); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(.01); IsotopePattern isos = isotopeGe.GetIsotopes(molFor); Assert.IsTrue(isos.Isotopes.Count == 34 || isos.Isotopes.Count == 35); }
public void TestCalculateIsotopesMn() { IMolecularFormula molFor = new MolecularFormula(); molFor.Add(builder.NewIsotope("Mn"), 1); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(0.001); IsotopePattern isoPattern = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(1, isoPattern.Isotopes.Count); }
public void TestGetIsotopes1() { var molFor = new MolecularFormula(); molFor.Add(builder.NewIsotope("Br")); molFor.Add(builder.NewIsotope("Br")); var isotopeGe = new IsotopePatternGenerator(0.1); var isoPattern = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(3, isoPattern.Isotopes.Count); }
public void TestCalculateIsotopesC10000() { IMolecularFormula molFor = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula("C10000", builder); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(.1); IsotopePattern isos = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(44, isos.Isotopes.Count); for (int i = 0; i < isos.Isotopes.Count; i++) { Assert.IsTrue(isos.Isotopes[i].Mass > 120085); } }
public void TestMultipleFormulasForAMass() { var mf = MolecularFormulaManipulator.GetMolecularFormula("C6Cl2", builder); var isogen = new IsotopePatternGenerator(0.1) .SetMinIntensity(0.01) .SetMinResolution(0.01) .SetStoreFormulas(true); var pattern = isogen.GetIsotopes(mf); var isotopes = pattern.Isotopes; Assert.AreEqual(1, isotopes[0].Formulas.Count); Assert.AreEqual(1, isotopes[1].Formulas.Count); Assert.AreEqual(2, isotopes[2].Formulas.Count); Assert.AreEqual(2, isotopes[3].Formulas.Count); Assert.AreEqual(3, isotopes[4].Formulas.Count); }
public void TestGetIsotopesIMolecularFormulaDeprotonate() { IsotopePatternGenerator isogen = new IsotopePatternGenerator(.1); IMolecularFormula mf1 = MolecularFormulaManipulator.GetMolecularFormula("C6H12O6", builder); MolecularFormulaManipulator.AdjustProtonation(mf1, -1); IsotopePattern ip1 = isogen.GetIsotopes(mf1); Assert.AreEqual(1, ip1.Isotopes.Count); isogen = new IsotopePatternGenerator(.1); IMolecularFormula mf2 = MolecularFormulaManipulator.GetMolecularFormula("C6H11O6", builder); IsotopePattern ip2 = isogen.GetIsotopes(mf2); Assert.AreEqual(1, ip2.Isotopes.Count); Assert.AreEqual(ip1.Isotopes[0].Mass, ip2.Isotopes[0].Mass, 0.001); }
public void TestExperiment() { var spExp = new IsotopePattern(new[] { new IsotopeContainer(762.6006, 124118304), new IsotopeContainer(763.6033, 57558840), new IsotopeContainer(764.6064, 15432262), }); spExp.MonoIsotope = spExp.Isotopes[0]; spExp.Charge = 1.0; var formula = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula("C42H85NO8P", CDK.Builder); var isotopeGe = new IsotopePatternGenerator(0.01); var patternIsoPredicted = isotopeGe.GetIsotopes(formula); var is_ = new IsotopePatternSimilarity(); var score = is_.Compare(spExp, patternIsoPredicted); Assert.AreEqual(0.97, score, .01); }
public void TestGetIsotopesIMolecularFormulaCharged() { IsotopePatternGenerator isogen = new IsotopePatternGenerator(.1); IMolecularFormula mfPositive = MolecularFormulaManipulator.GetMolecularFormula("C6H11O6Na", builder); mfPositive.Charge = 1; IsotopePattern ip1 = isogen.GetIsotopes(mfPositive); Assert.AreEqual(1, ip1.Isotopes.Count); isogen = new IsotopePatternGenerator(.1); IMolecularFormula mfNeutral = MolecularFormulaManipulator.GetMolecularFormula("C6H12O6Na", builder); mfNeutral.Charge = 0; IsotopePattern ip2 = isogen.GetIsotopes(mfNeutral); Assert.AreEqual(1, ip2.Isotopes.Count); Assert.AreNotEqual(ip1.Isotopes[0].Mass, ip2.Isotopes[0].Mass); }
public void TestCompareIsotopePatternIsotopePattern() { var is_ = new IsotopePatternSimilarity(); IsotopePattern spExp = new IsotopePattern(new[] { new IsotopeContainer(156.07770, 1), new IsotopeContainer(157.07503, 0.0004), new IsotopeContainer(157.08059, 0.0003), new IsotopeContainer(158.08135, 0.002), }); spExp.MonoIsotope = spExp.Isotopes[0]; var formula = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula("C6H10N3O2", builder); var isotopeGe = new IsotopePatternGenerator(0.1); var patternIsoPredicted = isotopeGe.GetIsotopes(formula); var patternIsoNormalize = IsotopePatternManipulator.Normalize(patternIsoPredicted); var score = is_.Compare(spExp, patternIsoNormalize); Assert.AreNotSame(0.0, score); }
public void TestCalculateIsotopesnCarbono() { // RESULTS ACCORDING PAGE: http://www2.sisweb.com/mstools/isotope.htm double[] massResults = { 120.000000, 121.003360, 122.006709 }; double[] abundResults = { 1.00, .108, 0.005 }; IMolecularFormula molFor = new MolecularFormula(); molFor.Add(builder.NewIsotope("C"), 10); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(0.0010); IsotopePattern isoPattern = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(3, isoPattern.Isotopes.Count); Assert.AreEqual(massResults[0], isoPattern.Isotopes[0].Mass, 0.01); Assert.AreEqual(massResults[1], isoPattern.Isotopes[1].Mass, 0.01); Assert.AreEqual(massResults[2], isoPattern.Isotopes[2].Mass, 0.01); Assert.AreEqual(abundResults[0], isoPattern.Isotopes[0].Intensity, 0.01); Assert.AreEqual(abundResults[1], isoPattern.Isotopes[1].Intensity, 0.01); Assert.AreEqual(abundResults[2], isoPattern.Isotopes[2].Intensity, 0.01); }
public void TestCalculateIsotopesAllBromine() { // RESULTS ACCORDING PAGE: http://www2.sisweb.com/mstools/isotope.htm double[] massResults = { 157.836669, 159.834630, 161.832580 }; double[] abundResults = { .512, 1.00, .487 }; IMolecularFormula molFor = new MolecularFormula(); molFor.Add(builder.NewIsotope("Br")); molFor.Add(builder.NewIsotope("Br")); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(.1); IsotopePattern isoPattern = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(3, isoPattern.Isotopes.Count); Assert.AreEqual(massResults[0], isoPattern.Isotopes[0].Mass, 0.01); Assert.AreEqual(massResults[1], isoPattern.Isotopes[1].Mass, 0.01); Assert.AreEqual(massResults[2], isoPattern.Isotopes[2].Mass, 0.01); Assert.AreEqual(abundResults[0], isoPattern.Isotopes[0].Intensity, 0.01); Assert.AreEqual(abundResults[1], isoPattern.Isotopes[1].Intensity, 0.01); Assert.AreEqual(abundResults[2], isoPattern.Isotopes[2].Intensity, 0.01); }
public void TestCalculateIsotopesIodemethylidyne() { // RESULTS ACCORDING PAGE: http://www2.sisweb.com/mstools/isotope.htm var massResults = new[] { 138.904480, 139.907839 }; var abundResults = new[] { 1.00, .011 }; var molFor = new MolecularFormula(); molFor.Add(builder.NewIsotope("C")); molFor.Add(builder.NewIsotope("I")); Assert.AreEqual(2, molFor.IsotopesCount); var isotopeGe = new IsotopePatternGenerator(.01); var isoPattern = isotopeGe.GetIsotopes(molFor); Assert.AreEqual(2, isoPattern.Isotopes.Count); Assert.AreEqual(massResults[0], isoPattern.Isotopes[0].Mass, 0.01); Assert.AreEqual(massResults[1], isoPattern.Isotopes[1].Mass, 0.01); Assert.AreEqual(abundResults[0], isoPattern.Isotopes[0].Intensity, 0.01); Assert.AreEqual(abundResults[1], isoPattern.Isotopes[1].Intensity, 0.01); }
public void TestSelectingMF() { var is_ = new IsotopePatternSimilarity(); IsotopePattern spExp = new IsotopePattern(new[] { new IsotopeContainer(156.07770, 1), new IsotopeContainer(157.07503, 0.0101), new IsotopeContainer(157.08059, 0.074), new IsotopeContainer(158.08135, 0.0024), }); spExp.MonoIsotope = spExp.Isotopes[0]; spExp.Charge = 1; double score = 0; string mfString = ""; string[] listMF = { "C4H8N6O", "C2H12N4O4", "C3H12N2O5", "C6H10N3O2", "CH10N5O4", "C4H14NO5" }; for (int i = 0; i < listMF.Length; i++) { IMolecularFormula formula = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula(listMF[i], builder); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(0.01); IsotopePattern patternIsoPredicted = isotopeGe.GetIsotopes(formula); IsotopePattern patternIsoNormalize = IsotopePatternManipulator.Normalize(patternIsoPredicted); double tempScore = is_.Compare(spExp, patternIsoNormalize); if (score < tempScore) { mfString = MolecularFormulaManipulator.GetString(formula); score = tempScore; } } Assert.AreEqual("C6H10N3O2", mfString); }