converting smiles directly to binary finger prints

User 955ad06ce5

25-10-2007 10:11:15

i want to convert smiles to finger prints with the code above:





public byte[] convert(String fname){





byte[] barray=null;


String content;


// String fname = "C:/chemDoc/mollib.smiles";


MolImporter importer = null;


Molecule mole = null;


try{


FileReader fr=new FileReader(fname);


BufferedReader br=new BufferedReader(fr);





String XMLconfig = "C:/chemDoc/cfp.xml";


CFParameters params = new CFParameters(new File(XMLconfig));


ChemicalFingerprint cf = new ChemicalFingerprint(params);


importer = new MolImporter();





ByteArrayOutputStream byteOut = new ByteArrayOutputStream();





while(true){


content=br.readLine();


if(content == null)


break;





mole = importer.importMol(content);


cf.generate(mole);


byteOut.write(cf.toData());


}


barray = byteOut.toByteArray();





}catch(FileNotFoundException ex){





}catch(IOException ex){





}catch(MDGeneratorException ex){





}





// FileUtil.saveBinFile(barray,"C:/mahmut.bin");





return barray;


}





how can i configure the length of finger prints?


is it possible to convert fingerprints back to a meaningful notation like smiles?





regards.

ChemAxon efa1591b5a

26-10-2007 08:11:39

Hi





the Screen section of the JChem Developer's Guide is a good starting point, you may wish to follow this link http://www.chemaxon.com/jchem/doc/guide/screen/index.html to find out more. In particular, the first example appears to be relevant for you: http://www.chemaxon.com/jchem/doc/guide/screen/index.html#basic_generate.





If you would like to tweak fingerprint parameters, like the length of the fingerprint, then you can use the CFParameter class, its API is available online: http://www.chemaxon.com/jchem/doc/api/chemaxon/descriptors/CFParameters.html.





Hope this helps.





Regards


Miklos

User cec095effb

26-10-2007 13:30:29

I think gokayaydin tries to convert a file that has .smiles extension to a file that has .bin extension. I tried to make this kind of convertion too but i couldn't generate a valid byte array. Is it possible to generate byte array from smiles file? What is wrong with the gokayaydin's program?

ChemAxon efa1591b5a

29-10-2007 09:17:02

To generate binary fingeprint data one can use the toData() method of the ChemicalFingeprint class, as seen in the source code by gokayaydin.


This information can be read and processed by the corresponding fromData() method of the same class.





Regarding the last question of gokayaydin, the answer is apparently no. It is not possible to reproduce the molecule form the fingerprint, the fingerprint does not encode all properties of a molecular structure, it can be regarded as a lossy compression.





Sorry, I've no capacity to debug source codes...





Regards


Miklos