Jeremy Murphy wrote:
> Firstly, the format is 
> output-only and is not a molecule per se, but a list of a descriptors for the 
> input molecule, so according to the example format, I presume that I should 
> inherit directly from OBFormat, right?     Thanks, 
> cheers.

If the output is a description of a molecule, first try deriving from 
OBMoleculeFormat. This means you don't have to write 
WriteChemObject(). Direct derivation from OBFormat is needed only if 
you expect to handle OBBase-derived objects other than OBMol, or the 
molecules are to be stored before output or other handled in other 
special ways.

 >Is there an existing format that inherits directly from OBFormat 
that >is a good example to go by?

Have a look at MolReportFormat, which might be a template for yours. 
It doesn't need to derive directly from OBFormat. CopyFormat is a 
simple format that does, because it is (theoretically) intended to 
work for all types of OBBase objects. FastSearchFormat also derives 
directly because it uses non-standard file handling and does 
complicated things with the data.

 >I get an error
 > message that it's not a valid output format.  Is this something to
 > do with  WriteMolecule() vs WriteChemObject()?

It is more likely to be because the flags are not right.

Even the use is primarily for single molecules, it would be worth 
thinking about what the output would look like if there was more than 
one, because the outputs are concatenated (unless the format flag 
WRITEONEONLY is set).

Chris

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to