How to create FCFP object?

User f50dadc210

07-09-2012 00:18:51

I want to use FCFP fingerprint to calculate tanimoto score.  I managed to create a ECFP object (see below), and call ECFP.getTanimoto method.


            ECFPParameters ep = new ECFPParameters();
            ep.setLength(1024);
            ep.setDiameter(4);
            ep.setKeepCounts(false);
            ECFP Fp = new ECFP(ep);
            ECFPGenerator GenECFP = new ECFPGenerator();
            Molecule M = m.GetMolecule();
            string[] k1 = GenECFP.generate(M, Fp);


I didn't figure out how to put FCFP parametes(see below) into ECFPParameters.


  <IdentifierConfiguration>

    <!-- Functional properties defined by Chemical Terms -->

    < Property Name ="HydrogenBondAcceptor " Value ="1 ">acceptor() </Property>

    < Property Name ="HydrogenBondDonor " Value ="1 ">donor() </Property>

    < Property Name ="Aromatic " Value ="1 ">arom() </Property>

    < Property Name ="Charge " Value ="1 "><![CDATA[ charge() * 10 ]]></Property>

  </IdentifierConfiguration>

Could you provide an example code to get a FCFP object?


Thanks


Bin

ChemAxon 4a2fc68cd1

07-09-2012 07:51:04

Hi Bin,


The easiest solution is to store your configuration in a separate XML file. E.g. you can start with downloading the FCFP example file from the ECFP/FCFP user guide:
http://www.chemaxon.com/jchem/examples/config/fcfp.xml


Once you have this file next to your code, you have to pass it to the ECFPParamaters constructor call:


ECFPParameters ep = new ECFPParameters(new File(pathToTheXmlConfigFile));


or if you have the content of the file as a String value in your code, you can also pass it to the constructor:


ECFPParameters ep = new ECFPParameters(xmlConfigString));


Note that the XML file or the XML string you use should be a full ECFP configuration, not only the IdentifierConfiguration part of it. You can use the example file linked above as a baseline.


Regards,
Peter