How to generate fingerprints in Java

ChemAxon efa1591b5a

03-06-2004 13:24:55

[copied from email]

"I need generate FingerPrint from java code. I have tried your libraries, but I havenĀ“t found any parameter settings of fingerprint or pharmacophore fingerprint descriptor in API.

Could you help me with java code?"

ChemAxon efa1591b5a

03-06-2004 13:37:13

Here is a simple example. Save it as then compile it: 'javac'.

It takes three command line arguments; the first is the configuration (parameter settings) for the fingerprint (for instance you can use the default configuration by ChemAxon that is found in jchem/examples/config/cfp.xml). The second command-line parameter is your input file, which can be any molecular structure file that contains at least one structure. The third parameter specifies the name of the output file where fingerprints are stored.

This sample code generates ChemicalFingerprints for each individual structure. It can be adapted to any other MolecularDescriptor provided by ChemAxon.

I hope this helps.



import chemaxon.descriptors.*;


 * Simple example code to demostrate the calculation of ChemicalFingerprint.

 * <br>

 * Takes three command-line arguments as input: config file, input SDfile,

 * output descriptor file


 * @author  Miklos Vargyas


public class GenerCF {

    public static void main( String[] args ) {

        try {

            // create parameters configuration from external XML config file

            CFParameters cfPar = new CFParameters( new File( args[ 0 ] ) );

            // create a molecular descriptor generator for one descriptor

            GenerateMD descript = new GenerateMD(1);

            // set the input file for the generator

            descript.setInput( args[ 1 ] );

            // and tell that input is an SDfile


            // specify the descriptor to be created: into which file, what type

            // what parameters settings to be applied

            descript.setDescriptor( args[ 2 ], "CF", cfPar, "" );

            // initialize the generator


            // start it and do the entire generation in one go


            // close output file



        catch ( Exception e ) {

            e.printStackTrace( System.err );





User 3898c01b63

14-05-2005 21:02:47

Dear Miklos,

With your famous code section, it is easy to make molecular descriptors. Thank you. That works fine with JDK1.5.0_01 and JChem3.0.8. I ran problem when I tried to compile (ok) and run (problem) with JDK1.3.1_11 and JChem2.2.1.

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/transform/TransformerException....

I found the classes: javax.xml.transform and javax.xml.parsers. Recompiled in the classpath. At the runtime, GenerCF still complain in the following line:

CFParameters cfPar = new CFParameters();

Would you please tell me where I can get the javax.xml.*. Our webserver used JDK1.3.1_11 and JChem2.2.1. It takes a while for us to upgrade the server.

Best regards,


ChemAxon efa1591b5a

15-05-2005 20:05:49

Dear Tiqing,

please find the xml parser library at this link

Get back to the forum if you experience further difficulties.



User 3898c01b63

22-06-2005 14:58:42

Dear Miklos,

With your famous, I extended this program to produce BCUT molecular descriptors. However, I tried to generate scalar descriptors with the hint from (GenerateMD class) without success. It is appreciated if you can post the java codes to generate the scalar descriptors (should be seven in JChem).

Best regards,


ChemAxon efa1591b5a

22-06-2005 15:56:52

Dear Tiqing,

I attached the code, it is directly derived from I also attached a suitable configuration file.

Hope this helps.