public void TestClone() { var 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]; spExp.Charge = 1; var clone = (IsotopePattern)spExp.Clone(); Assert.AreEqual(156.07770, clone.MonoIsotope.Mass, 0.001); Assert.AreEqual(156.07770, clone.Isotopes[0].Mass, 0.001); Assert.AreEqual(157.07503, clone.Isotopes[1].Mass, 0.001); Assert.AreEqual(157.08059, clone.Isotopes[2].Mass, 0.001); Assert.AreEqual(158.08135, clone.Isotopes[3].Mass, 0.001); Assert.AreEqual(1, clone.MonoIsotope.Intensity, 0.001); Assert.AreEqual(1, clone.Isotopes[0].Intensity, 0.001); Assert.AreEqual(0.0004, clone.Isotopes[1].Intensity, 0.001); Assert.AreEqual(0.0003, clone.Isotopes[2].Intensity, 0.001); Assert.AreEqual(0.002, clone.Isotopes[3].Intensity, 0.001); Assert.AreEqual(1, clone.Charge, 0.001); }
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 TestSortAndNormalizedByIntensityIsotopePattern() { var spExp = new IsotopePattern(new[] { new IsotopeContainer(157.07503, 0.0002), new IsotopeContainer(156.07770, 2), new IsotopeContainer(158.08135, 0.004), new IsotopeContainer(157.08059, 0.0006), }); spExp.MonoIsotope = spExp.Isotopes[1]; spExp.Charge = 1; var isoNorma = IsotopePatternManipulator.SortAndNormalizedByIntensity(spExp); var listISO = isoNorma.Isotopes; Assert.AreEqual(156.07770, isoNorma.MonoIsotope.Mass, 0.00001); Assert.AreEqual(156.07770, listISO[0].Mass, 0.00001); Assert.AreEqual(158.08135, listISO[1].Mass, 0.00001); Assert.AreEqual(157.08059, listISO[2].Mass, 0.00001); Assert.AreEqual(157.07503, listISO[3].Mass, 0.00001); Assert.AreEqual(1, isoNorma.MonoIsotope.Intensity, 0.00001); Assert.AreEqual(1, listISO[0].Intensity, 0.00001); Assert.AreEqual(0.002, listISO[1].Intensity, 0.00001); Assert.AreEqual(0.0003, listISO[2].Intensity, 0.00001); Assert.AreEqual(0.0001, listISO[3].Intensity, 0.00001); Assert.AreEqual(1, isoNorma.Charge, 0.001); }
public void TestGetMonoIsotope() { var isoP = new IsotopePattern(); var isoC = new IsotopeContainer(); isoP.MonoIsotope = isoC; Assert.AreEqual(isoC, isoP.MonoIsotope); }
public void TestSetChargeDouble() { var isoP = new IsotopePattern { Charge = 1.0 }; Assert.AreEqual(1.0, isoP.Charge, 0.000001); }
[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 TestSetMonoIsotopeIsotopeContainer() { var isoP = new IsotopePattern { MonoIsotope = new IsotopeContainer() }; Assert.IsNotNull(isoP); }
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); }
/// <summary> /// Get all combinatorial chemical isotopes given a structure. /// </summary> /// <param name="molFor">The IMolecularFormula to start</param> /// <returns>A IsotopePattern object containing the different combinations</returns> public IsotopePattern GetIsotopes(IMolecularFormula molFor) { if (builder == null) { try { isoFactory = CDK.IsotopeFactory; builder = molFor.Builder; } catch (Exception e) { Console.WriteLine(e.StackTrace); } } var mf = MolecularFormulaManipulator.GetString(molFor, true); var molecularFormula = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula(mf, builder); IsotopePattern abundance_Mass = null; foreach (var isos in molecularFormula.Isotopes) { var elementSymbol = isos.Symbol; var atomCount = molecularFormula.GetCount(isos); // Generate possible isotope containers for the current atom's // these will then me 'multiplied' with the existing patten var additional = new List <IsotopeContainer>(); foreach (var isotope in isoFactory.GetIsotopes(elementSymbol)) { double mass = isotope.ExactMass.Value; double abundance = isotope.Abundance.Value; if (abundance <= 0.000000001) { continue; } IsotopeContainer container = new IsotopeContainer(mass, abundance); if (storeFormula) { container.Formula = AsFormula(isotope); } additional.Add(container); } for (int i = 0; i < atomCount; i++) { abundance_Mass = CalculateAbundanceAndMass(abundance_Mass, additional); } } var isoP = IsotopePatternManipulator.SortAndNormalizedByIntensity(abundance_Mass); isoP = CleanAbundance(isoP, minIntensity); var isoPattern = IsotopePatternManipulator.SortByMass(isoP); return(isoPattern); }
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 TestGetNumberOfIsotopes() { var iso1 = new IsotopeContainer(); var iso2 = new IsotopeContainer(); var isoP = new IsotopePattern(new[] { iso1, iso2 }) { MonoIsotope = iso1 }; Assert.AreEqual(2, isoP.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 TestGetIsotopes() { var iso1 = new IsotopeContainer(); var iso2 = new IsotopeContainer(); var isoP = new IsotopePattern(new[] { iso1, iso2 }) { MonoIsotope = iso1 }; Assert.AreEqual(iso1, isoP.Isotopes[0]); Assert.AreEqual(iso2, isoP.Isotopes[1]); }
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); }
/// <summary> /// Search and find the closest difference in an array in terms of mass and /// intensity. Always return the position in this List. /// </summary> /// <param name="isoContainer"></param> /// <param name="pattern"></param> /// <returns></returns> private int GetClosestDataDiff(IsotopeContainer isoContainer, IsotopePattern pattern) { double diff = 100; int posi = -1; for (int i = 0; i < pattern.Isotopes.Count; i++) { double tempDiff = Math.Abs((isoContainer.Mass) - pattern.Isotopes[i].Mass); if (tempDiff <= (Tolerance / isoContainer.Mass) && tempDiff < diff) { diff = tempDiff; posi = i; } } return(posi); }
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); }
/// <summary> /// Return the isotope pattern normalized to the highest abundance. /// </summary> /// <param name="isotopeP">The IsotopePattern object to normalize</param> /// <returns>The IsotopePattern normalized</returns> public static IsotopePattern Normalize(IsotopePattern isotopeP) { IsotopeContainer isoHighest = null; double biggestAbundance = 0; /* Extraction of the isoContainer with the highest abundance */ foreach (var isoContainer in isotopeP.Isotopes) { double abundance = isoContainer.Intensity; if (biggestAbundance < abundance) { biggestAbundance = abundance; isoHighest = isoContainer; } } IsotopePattern isoNormalized; { /* Normalize */ var newIsotopes = new List <IsotopeContainer>(); IsotopeContainer monoIsotope = null; foreach (var isoContainer in isotopeP.Isotopes) { var inten = isoContainer.Intensity / isoHighest.Intensity; var icClone = (IsotopeContainer)isoContainer.Clone(); icClone.Intensity = inten; if (isoHighest.Equals(isoContainer)) { monoIsotope = icClone; } newIsotopes.Add(icClone); } isoNormalized = new IsotopePattern(newIsotopes); if (monoIsotope != null) { isoNormalized.MonoIsotope = monoIsotope; } isoNormalized.Charge = isotopeP.Charge; } return(isoNormalized); }
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); }
/// <summary> /// Normalize the intensity (relative abundance) of all isotopes in relation /// of the most abundant isotope. /// </summary> /// <param name="isopattern">The IsotopePattern object</param> /// <param name="minIntensity">The minimum abundance</param> /// <returns>The IsotopePattern cleaned</returns> private static IsotopePattern CleanAbundance(IsotopePattern isopattern, double minIntensity) { double intensity; double biggestIntensity = 0; foreach (var sc in isopattern.Isotopes) { intensity = sc.Intensity; if (intensity > biggestIntensity) { biggestIntensity = intensity; } } foreach (var sc in isopattern.Isotopes) { intensity = sc.Intensity; intensity /= biggestIntensity; if (intensity < 0) { intensity = 0; } sc.Intensity = intensity; } var sortedIsoPattern = new IsotopePattern { MonoIsotope = new IsotopeContainer(isopattern.Isotopes[0]) }; for (int i = 1; i < isopattern.Isotopes.Count; i++) { if (isopattern.Isotopes[i].Intensity >= (minIntensity)) { var container = new IsotopeContainer(isopattern.Isotopes[i]); sortedIsoPattern.isotopes.Add(container); } } return(sortedIsoPattern); }
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); }
/// <summary> /// Return the isotope pattern sorted by intensity to the highest abundance. /// </summary> /// <param name="isotopeP">The IsotopePattern object to sort</param> /// <returns>The IsotopePattern sorted</returns> public static IsotopePattern SortByIntensity(IsotopePattern isotopeP) { var isoSort = (IsotopePattern)isotopeP.Clone(); // Do nothing for empty isotope pattern if (isoSort.Isotopes.Count == 0) { return(isoSort); } // Sort the isotopes var listISO = isoSort.Isotopes; isoSort.isotopes.Sort( delegate(IsotopeContainer o1, IsotopeContainer o2) { return(o2.Intensity.CompareTo(o1.Intensity)); }); // Set the monoisotopic peak to the one with highest intensity isoSort.MonoIsotope = listISO[0]; return(isoSort); }
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 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); }
/// <summary> /// Calculates the mass and abundance of all isotopes generated by adding one /// atom. Receives the periodic table element and calculate the isotopes, if /// there exist a previous calculation, add these new isotopes. In the /// process of adding the new isotopes, remove those that has an abundance /// less than setup parameter minIntensity, and remove duplicated masses. /// </summary> /// <param name="additional">additional isotopes to 'multiple' the current pattern by</param> /// <returns>the calculation was successful</returns> private IsotopePattern CalculateAbundanceAndMass(IsotopePattern current, List <IsotopeContainer> additional) { if (additional == null || additional.Count == 0) { return(current); } var containers = new List <IsotopeContainer>(); // Verify if there is a previous calculation. If it exists, add the new // isotopes if (current == null) { current = new IsotopePattern(); foreach (var container in additional) { current.isotopes.Add(container); } } else { foreach (var container in current.Isotopes) { foreach (IsotopeContainer other in additional) { var abundance = container.Intensity * other.Intensity * 0.01; var mass = container.Mass + other.Mass; // merge duplicates with some resolution var existing = FindExisting(containers, mass, resolution); if (existing != null) { var newIntensity = existing.Intensity + abundance; // moving weighted avg existing.Mass = (existing.Mass * existing.Intensity + mass * abundance) / newIntensity; existing.Intensity = newIntensity; if (storeFormula) { foreach (var mf in container.Formulas) { AddDistinctFormula(existing, Union(mf, other.Formula)); } } continue; } // Filter isotopes too small if (abundance > minAbundance) { var newcontainer = new IsotopeContainer(mass, abundance); if (storeFormula) { foreach (var mf in container.Formulas) { newcontainer.AddFormula(Union(mf, other.Formula)); } } containers.Add(newcontainer); } } } current = new IsotopePattern(); foreach (var container in containers) { current.isotopes.Add(container); } } return(current); }
/// <summary> /// Return the isotope pattern sorted and normalized by intensity /// to the highest abundance. /// </summary> /// <param name="isotopeP">The IsotopePattern object to sort</param> /// <returns>The IsotopePattern sorted</returns> public static IsotopePattern SortAndNormalizedByIntensity(IsotopePattern isotopeP) { var isoNorma = Normalize(isotopeP); return(SortByIntensity(isoNorma)); }
public void TestGetCharge() { var isoP = new IsotopePattern(); Assert.AreEqual(0, isoP.Charge, 0.000001); }
/// <summary> /// Compare the IMolecularFormula with a isotope /// abundance pattern. /// </summary> /// <param name="isoto1">The Isotope pattern reference (predicted)</param> /// <param name="isoto2">The Isotope pattern reference (detected)</param> /// <returns>The hit score of similarity</returns> public double Compare(IsotopePattern isoto1, IsotopePattern isoto2) { IsotopePattern iso1 = IsotopePatternManipulator.SortAndNormalizedByIntensity(isoto1); IsotopePattern iso2 = IsotopePatternManipulator.SortAndNormalizedByIntensity(isoto2); /* charge to add */ if (isoto1.Charge == 1) { chargeToAdd = massE; } else if (isoto1.Charge == -1) { chargeToAdd = -massE; } else { chargeToAdd = 0; } foreach (var isoC in iso1.Isotopes) { double mass = isoC.Mass; isoC.Mass = mass + chargeToAdd; } double diffMass, diffAbun, factor, totalFactor = 0d; double score = 0d, tempScore; // Maximum number of isotopes to be compared according predicted isotope // pattern. It is assumed that this will have always more isotopeContainers int length = iso1.Isotopes.Count; for (int i = 0; i < length; i++) { var isoContainer = iso1.Isotopes[i]; factor = isoContainer.Intensity; totalFactor += factor; // Search for the closest isotope in the second pattern (detected) to the // current isotope (predicted pattern) int closestDp = GetClosestDataDiff(isoContainer, iso2); if (closestDp == -1) { continue; } diffMass = isoContainer.Mass - iso2.Isotopes[closestDp].Mass; diffMass = Math.Abs(diffMass); diffAbun = 1.0d - (isoContainer.Intensity / iso2.Isotopes[closestDp].Intensity); diffAbun = Math.Abs(diffAbun); tempScore = 1 - (diffMass + diffAbun); if (tempScore < 0) { tempScore = 0; } score += (tempScore * factor); } return(score / totalFactor); }
public void TestAddIsotopeIsotopeContainer() { var isoP = new IsotopePattern(new[] { new IsotopeContainer() }); Assert.IsNotNull(isoP); }