Toolkit Tutorial: Advanced Programming


#include "dt_smiles.h"
#include "dt_finger.h"

int main () {
 
dt_Handle molecule1 , molecule2 , fingerprint1 , fingerprint2 ;
 
dt_Real similarity ;

 
/* Read SMILES in. */
 
molecule1 = dt_smilin ( 1 , "O" );
 
molecule2 = dt_smilin ( 12 , "Oc1ccc(O)cc1" );

 
/* Create FINGERPRINTs. */
 
fingerprint1 = dt_fp_generatefp ( molecule1 , 0 , 7 , 2048 );
 
fingerprint2 = dt_fp_generatefp ( molecule2 , 0 , 7 , 2048 );

 
/* Evaluate similarity. */
 
similarity = dt_fp_tanimoto ( fingerprint1 , fingerprint2 );
 
printf ( "Tanimoto: %.2f\n" , similarity );
 
similarity = dt_fp_tversky ( fingerprint1 , fingerprint2 , 0.5 , 0.5 );
 
printf ( "Tversky: %.2f\n" , similarity );
 
similarity = dt_fp_euclid ( fingerprint1 , fingerprint2 );
 
printf ( "Euclid: %.2f\n" , similarity );

 
return 0 ;
}