Good morning,

Use this class for Tanimoto calucations:
 org.openscience.cdk.similarity.Tanimoto (see doc: 
http://cdk.github.io/cdk/latest/docs/api/index.html)

you could do something like this to calculate your tanimoto score:

public static double cdkCalculateTanimotoCoef(IFingerprinter fingerprinter, 
IAtomContainer acReference, IAtomContainer acStructure ) {

        double ret = 0.0;

        try {

            IBitFingerprint fpReference = 
fingerprinter.getBitFingerprint(acReference);

            //Tanimoto-score
            IBitFingerprint fpStructure = 
fingerprinter.getBitFingerprint(acStructure);
            ret = Tanimoto.calculate(fpReference, fpStructure);

        } catch (Exception ex) {
            //...
        }

        return ret;
    }



Viele Grüße,
   Manuel Stesycki

IT
   0208 / 306-2146
   Physikbau, Büro 117
   stesy...@mpi-muelheim.mpg.de<mailto:stesy...@mpi-muelheim.mpg.de>

Max-Planck-Institut für Kohlenforschung
   Kaiser-Wilhelm-Platz 1
   D-45470 Mülheim an der Ruhr
   http://www.kofo.mpg.de/de

Am 24.03.2021 um 04:55 schrieb Sub Jae Shin 
<cnb.mons...@gmail.com<mailto:cnb.mons...@gmail.com>>:

To CDK developers.

Hello, I'm trying to get drug-drug similarity by Tanimoto score.

I'm a beginner of cdk and java, so I'm stuck in the process of changing smiles 
file to Tanimoto score's calculate method's variable.


package com.company;
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.io.SMILESReader;
import java.io<http://java.io>.*;

public class Main {

    public static void main(String[] args) {
        try {

            InputStream mol2DataStream = new 
FileInputStream("../data/drugbank/structure.smiles");
            SMILESReader reader = new SMILESReader(mol2DataStream);
            IChemFile file = reader.read(new ChemFile());

        } catch (FileNotFoundException | CDKException e) {
            System.out.println(e.getMessage());
        }
    }
}

Sincerely
Seopjae Shin.


_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net<mailto:Cdk-user@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/cdk-user

_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to