org.openscience.cdk.formula
Class MassToFormulaTool

java.lang.Object
  extended by org.openscience.cdk.formula.MassToFormulaTool

@TestClass(value="org.openscience.cdk.formula.MassToFormulaToolTest")
public class MassToFormulaTool
extends Object

Tool to determine molecular formula consistent with a given accurate mass. The molecular formulas are not validate. It only consist in generate combination according object (see MolecularFormulaChecker).

   MassToFormulaTool mf = new MassToFormulaTool();
   double myMass = 133.004242;
   IMolecularFormulaSet mfSet = mf.generate(myMass);
 

The elements are listed according on difference with the proposed mass.

Author:
miguelrojasch
Created on:
2007-03-01
Belongs to CDK module:
formula
Source code:
HEAD

Constructor Summary
MassToFormulaTool(IChemObjectBuilder builder)
          Construct an instance of MassToFormulaTool.
 
Method Summary
 IMolecularFormulaSet generate(double mass)
          Method that actually does the work of extracting the molecular formula.
 List<IRule> getRestrictions()
          Get the restrictions that must be presents in the molecular formula.
 void setDefaultRestrictions()
          Set the default restrictions that must be presents in the molecular formula.
 void setRestrictions(List<IRule> rulesNew)
          Set the restrictions that must be presents in the molecular formula.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MassToFormulaTool

public MassToFormulaTool(IChemObjectBuilder builder)
Construct an instance of MassToFormulaTool. It is necessary because different matrix have to build. Furthermore the default restrictions are initiated.

See Also:
setDefaultRestrictions()
Method Detail

setRestrictions

@TestMethod(value="testSetRestrictions_List")
public void setRestrictions(List<IRule> rulesNew)
                     throws CDKException
Set the restrictions that must be presents in the molecular formula.

Parameters:
rulesNew - The restrictions to impose
Throws:
CDKException
See Also:
getRestrictions(), setDefaultRestrictions(), IRule

getRestrictions

@TestMethod(value="testGetRestrictions")
public List<IRule> getRestrictions()
Get the restrictions that must be presents in the molecular formula.

Returns:
The restrictions to be imposed
See Also:
setDefaultRestrictions()

setDefaultRestrictions

@TestMethod(value="testSetDefaultRestrictions")
public void setDefaultRestrictions()
Set the default restrictions that must be presents in the molecular formula.

See Also:
getRestrictions()

generate

@TestMethod(value="testGenerate_double")
public IMolecularFormulaSet generate(double mass)
Method that actually does the work of extracting the molecular formula.

Parameters:
mass - molecular formula to create from the mass
Returns:
the filled molecular formulas as IMolecularFormulaSet