private static void ChemicalFormulaGeneratorExample() { //// Create a generator with formula bounds. In this case, every formula needs to have at least H2 but no more than C4H2 //ChemicalFormulaGenerator generator = new ChemicalFormulaGenerator(new ChemicalFormula("H2"), new ChemicalFormula("C4H2")); //var formulas = generator.FromMass(0, 100).ToList(); //foreach (var formula in formulas) //{ // WriteFormulaToConsole(formula); //} //Console.WriteLine("Unique Formulas: " + formulas.Count); // Create a generator with formula bounds. In this case, every formula needs to have at least H2 but no more than C4H2 ChemicalFormulaGenerator generator = new ChemicalFormulaGenerator(new ChemicalFormula("C10000N1000H1000O1000")); DoubleRange range = DoubleRange.FromPPM(new ChemicalFormula("C62H54N42O24").MonoisotopicMass, 0.1); double mass = range.Mean; int count = 0; foreach (var formula in generator.FromMass(range).Validate()) { Console.WriteLine("{0,-15} {1:F10} {2,-5:G5} ppm", formula, formula.MonoisotopicMass, Tolerance.GetTolerance(formula.MonoisotopicMass, mass, ToleranceUnit.PPM)); count++; } Console.WriteLine("Unique Formulas: " + count); }
public void GetTolerancePPMPositive() { double value = Tolerance.GetTolerance(500.001, 500.0, ToleranceUnit.PPM); Assert.AreEqual(1.9999999999527063, value); }
public void GetToleranceDaNegative() { double value = Tolerance.GetTolerance(5, 10, ToleranceUnit.DA); Assert.AreEqual(-5, value); }
public void GetToleranceDaZero() { double value = Tolerance.GetTolerance(10, 10, ToleranceUnit.DA); Assert.AreEqual(0, value); }
public void GetToleranceDaPositive() { double value = Tolerance.GetTolerance(10, 5, ToleranceUnit.DA); Assert.AreEqual(5, value); }