Hi Noel,

> I see that MFAnalyser is gone from trunk, to be replaced by
> MolecularFormulaManipulator. Using MolecularFormulaManipulator and the
> jar at http://cheminfo.informatics.indiana.edu/~rguha/code/java/nightly/,
> I have the following results...
> 
> For the molecule represented by the SMILES string "C", I get a
> molecular formula of "C1" (getString) 
How Egon commented you have to make explicit the hydrogens
using CDKHydrogenAdded before calling the MolecularFormulaGenerator.

> and a molecular weight of -1
> (getTotalExactMass).
> 
The other problem with calculating the exact mass is that you have to
specify what Isotope is the element with the corresponding exact mass.
Of course, we think automatically C is 12 and H is 1 but could not be.
You have different examples in MolecularFormulaManipulatorTest.
Nevertheless I add one possible solution that it could help you.


IsotopeFactory ifac = IsotopeFactory.getInstance(builder);

MolecularFormula formula = new MolecularFormula();
formula.addIsotope(ifac.getMajorIsotope("C"),2);
formula.addIsotope(ifac.getMajorIsotope("H"),6);

For this case you will obtain the correctly exact mass.

Best regards,
 Miquel



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to