FromMass() public method

public FromMass ( IRange massRange, int maxNumberOfResults = int.MaxValue, bool sort = true ) : IEnumerable
massRange IRange
maxNumberOfResults int
sort bool
return IEnumerable
Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private static void ChemicalFormulaGeneratorExample()
        {
            ChemicalFormulaGenerator generator = new ChemicalFormulaGenerator(new ChemicalFormula("H2"), new ChemicalFormula("C4H2"));

            var formulas = generator.FromMass(0, 100).ToList();
            Console.WriteLine("Unique Formulas: " + formulas.Count);
        }