generateformula: Generate molecular formulae given a target mass and a set of...

Description Usage Arguments Value Author(s) See Also Examples

Description

These functions generate a list of cdkFormula objects or strings given a mass and a set of elements and their possible counts (specified as a range). generate.formula.iter employs recently updated code making it much faster than generate.formula.

In addition, generate.formula.iter returns an iterator, using which very large sets of formulae can be generated without excessive memory consumption. By default this method returns molecular formulae as strings, rather than cdkFormula objects. By default this method does not perform any validation, and even if validation = TRUE no validation is performed. generate.formula can perform validation, but this results in significantly slower run times.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
generate.formula(mass, window=0.01, elements=list(c("C",0,50),c("H",0,50),
                                                  c("N",0,50),c("O",0,50),
                                                  c("S",0,50)),
                 validation=FALSE, charge=0.0)
generate.formula.iter(mass, window = 0.01,
                              elements = list(
                                C=c(0,50),
                                H=c(0,50),
                                N=c(0,50),
                                O=c(0,50),
                                S=c(0,50)),
                              validation = FALSE,
                              charge = 0.0,
                              as.string=TRUE)
		 

Arguments

mass

The mass value from which to be generate the formulas.

,

window

The window accuracy in the same units as mass.

,

elements

Elements to take into account.

,

validation

TRUE, if the method should only generate valid formulas. If FALSE, nonsensical formulae my be generated which must be filtered out by the user

,

charge

The charge value of the formula.

as.string

If TRUE the formula is returned as a string, otherwise as a IMolecularFormula object

Value

List of IMolecularFormula objects or strings, representing molecular formulae

Author(s)

Miguel Rojas-Cherto ([email protected])

See Also

get.formula, set.charge.formula, get.isotopes.pattern, isvalid.formula

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
mfSet <- generate.formula(18.03383,charge=1,
                          elements=list(c("C",0,50),c("H",0,50),c("N",0,50)))
for (i in mfSet) {
  print(i)
}

mit <- generate.formula.iter(18.03383,charge=1,
                          elements=list(C=c(0,50), H=c(0,50), N=c(0,50)))
hit <- itertools::ihasNext(mit)
while (itertools::hasNext(hit)) 
  print(iterators::nextElem(hit))			  

rcdk documentation built on Sept. 26, 2018, 9:05 a.m.