Package rdkit :: Package Chem :: Module ReducedGraphs
[hide private]
[frames] | no frames]

Source Code for Module rdkit.Chem.ReducedGraphs

 1  # $Id$ 
 2  # 
 3  #  Copyright (c) 2013 Greg Landrum 
 4  # 
 5  #   @@ All Rights Reserved @@ 
 6  #  This file is part of the RDKit. 
 7  #  The contents are covered by the terms of the BSD license 
 8  #  which is included in the file license.txt, found at the root 
 9  #  of the RDKit source tree. 
10  # 
11  # Created by Greg Landrum, July 2013 
12   
13  import numpy 
14  from rdkit.Chem.rdReducedGraphs import * 
15   
16   
17 -def TanimotoSimilarity(arr1, arr2):
18 numer = arr1.dot(arr2) 19 if numer == 0.0: 20 return 0.0 21 denom = arr1.dot(arr1) + arr2.dot(arr2) - numer 22 if denom == 0.0: 23 return 0.0 24 return numer / denom
25