def testGetPossiblePharmacophores(self): bins = [(1, 2), (2, 3), (5, 6)] vals = [ (2, 3), (3, 24), ] for tpl in vals: num, tgt = tpl pphores = Utils.GetPossibleScaffolds(num, bins) cnt = len(pphores) assert cnt == tgt, f'bad pharmacophore count {cnt} for probe {str(tpl)}' self.assertEqual(Utils.GetPossibleScaffolds(1, bins), 0)
def Init(self): """ Initializes internal parameters. This **must** be called after making any changes to the signature parameters """ accum = 0 self._scaffolds = [0] * (len( Utils.nPointDistDict[self.maxPointCount + 1])) self._starts = {} if not self.skipFeats: self._nFeats = len(self.featFactory.GetFeatureFamilies()) else: self._nFeats = 0 for fam in self.featFactory.GetFeatureFamilies(): if fam not in self.skipFeats: self._nFeats += 1 for i in range(self.minPointCount, self.maxPointCount + 1): self._starts[i] = accum nDistsHere = len(Utils.nPointDistDict[i]) scaffoldsHere = Utils.GetPossibleScaffolds( i, self._bins, useTriangleInequality=self.trianglePruneBins) nBitsHere = len(scaffoldsHere) self._scaffolds[nDistsHere] = scaffoldsHere pointsHere = Utils.NumCombinations(self._nFeats, i) * nBitsHere accum += pointsHere self._sigSize = accum if not self.useCounts: self.sigKlass = SparseBitVect elif self._sigSize < 2**31: self.sigKlass = IntSparseIntVect else: self.sigKlass = LongSparseIntVect
def testGetPossiblePharmacophores(self): bins = [(1, 2), (2, 3), (5, 6)] vals = [ (2, 3), (3, 24), ] for tpl in vals: num, tgt = tpl pphores = Utils.GetPossibleScaffolds(num, bins) cnt = len(pphores) assert cnt == tgt, 'bad pharmacophore count %d for probe %s' % ( cnt, str(tpl))