Chem.Pharm2D.Utils

Package Chem :: Package Pharm2D :: Module Utils |
[hide private]
[frames] | no frames]

# Module Utils

source code

    utility functionality for the 2D pharmacophores code

    See Docs/Chem/Pharm2D.triangles.jpg for an illustration of the way
    pharmacophores are broken into triangles and labelled.

    See Docs/Chem/Pharm2D.signatures.jpg for an illustration of bit
    numbering

Functions | [hide private]
GetTriangles(nPts) returns a tuple with the distance indices for... | source code
_fact(x) | source code
BinsTriangleInequality(d1, d2, d3) checks the triangle inequality for combinations of distance bins. | source code
ScaffoldPasses(combo, bins=None) checks the scaffold passed in to see if all... | source code
NumCombinations(nItems, nSlots) returns the number of ways to fit nItems into nSlots We assume that (x,y) and (y,x) are equivalent, and (x,x) is allowed. | source code
CountUpTo(nItems, nSlots, vs, idx=0, startAt=0) Figures out where a given combination of indices would... | source code
GetIndexCombinations(nItems, nSlots, slot=0, lastItemVal=0) Generates all combinations of nItems in nSlots without including... | source code
GetAllCombinations(choices, noDups=1, which=0) Does the combinatorial explosion of the possible combinations of the elements of _choices_. | source code
UniquifyCombinations(combos) uniquifies the combinations in the argument... | source code
GetPossibleScaffolds(nPts, bins) gets all realizable scaffolds (passing the triangle inequality) with the... | source code

Variables | [hide private]
| nPointDistDict = ``{`2`:` `(``(`0`,` 1`)``)``,` 3`:` `(``(`0`,` 1`)``,` `(`0`,` 2`)``,` `(`1`,` 2`)``)``,` 4`:``...``
| nDistPointDict = ``{`1`:` 2`,` 3`:` 3`,` 5`:` 4`,` 7`:` 5`,` 9`:` 6`,` 11`:` 7`,` 13`:` 8`,` `...``
| _trianglesInPharmacophore = ``{``}``
| _numCombDict = ``{``}``
| _verbose = `0`
| _countCache = ``{``}``
| _indexCombinations = ``{``}``
| Complex0 = ``'``F``'``
| Complex16 = ``'``F``'``
| Complex32 = ``'``F``'``
| Complex64 = ``'``D``'``
| Complex8 = ``'``F``'``
| Float0 = ``'``f``'``
| Float16 = ``'``f``'``
| Float32 = ``'``f``'``
| Float64 = ``'``d``'``
| Float8 = ``'``f``'``
| Int0 = ``'``1``'``
| Int16 = ``'``s``'``
| Int32 = ``'``i``'``
| Int8 = ``'``1``'``
| absolute = `<ufunc 'absolute'>`
| add = `<ufunc 'add'>`
| arccos = `<ufunc 'arccos'>`
| arccosh = `<ufunc 'arccosh'>`
| arcsin = `<ufunc 'arcsin'>`
| arcsinh = `<ufunc 'arcsinh'>`
| arctan = `<ufunc 'arctan'>`
| arctan2 = `<ufunc 'arctan2'>`
| arctanh = `<ufunc 'arctanh'>`
| bitwise_and = `<ufunc 'bitwise_and'>`
| bitwise_or = `<ufunc 'bitwise_or'>`
| bitwise_xor = `<ufunc 'bitwise_xor'>`
| ceil = `<ufunc 'ceil'>`
| conjugate = `<ufunc 'conjugate'>`
| cos = `<ufunc 'cos'>`
| cosh = `<ufunc 'cosh'>`
| divide = `<ufunc 'divide'>`
| divide_safe = `<ufunc 'divide_safe'>`
| e = `2.71828182846`
| equal = `<ufunc 'equal'>`
| exp = `<ufunc 'exp'>`
| fabs = `<ufunc 'fabs'>`
| floor = `<ufunc 'floor'>`
| floor_divide = `<ufunc 'floor_divide'>`
| fmod = `<ufunc 'fmod'>`
| greater = `<ufunc 'greater'>`
| greater_equal = `<ufunc 'greater_equal'>`
| hypot = `<ufunc 'hypot'>`
| invert = `<ufunc 'invert'>`
| left_shift = `<ufunc 'left_shift'>`
| less = `<ufunc 'less'>`
| less_equal = `<ufunc 'less_equal'>`
| log = `<ufunc 'log'>`
| log10 = `<ufunc 'log10'>`
| logical_and = `<ufunc 'logical_and'>`
| logical_not = `<ufunc 'logical_not'>`
| logical_or = `<ufunc 'logical_or'>`
| logical_xor = `<ufunc 'logical_xor'>`
| maximum = `<ufunc 'maximum'>`
| minimum = `<ufunc 'minimum'>`
| multiply = `<ufunc 'multiply'>`
| negative = `<ufunc 'negative'>`
| not_equal = `<ufunc 'not_equal'>`
| pi = `3.14159265359`
| power = `<ufunc 'power'>`
| remainder = `<ufunc 'remainder'>`
| right_shift = `<ufunc 'right_shift'>`
| sin = `<ufunc 'sin'>`
| sinh = `<ufunc 'sinh'>`
| sqrt = `<ufunc 'sqrt'>`
| subtract = `<ufunc 'subtract'>`
| tan = `<ufunc 'tan'>`
| tanh = `<ufunc 'tanh'>`
| true_divide = `<ufunc 'true_divide'>`

Function Details | [hide private]

### GetTriangles(nPts) | source code
    returns a tuple with the distance indices for
    triangles composing an nPts-pharmacophore

### BinsTriangleInequality(d1, d2, d3) | source code
    checks the triangle inequality for combinations
    of distance bins.

    the general triangle inequality is:
       d1 + d2 >= d3
    the conservative binned form of this is:
       d1(upper) + d2(upper) >= d3(lower)

### ScaffoldPasses(combo, bins=None) | source code
    checks the scaffold passed in to see if all
    contributing triangles can satisfy the triangle inequality

    the scaffold itself (encoded in combo) is a list of binned distances

### NumCombinations(nItems, nSlots) | source code
    returns the number of ways to fit nItems into nSlots

    We assume that (x,y) and (y,x) are equivalent, and
    (x,x) is allowed.

    General formula is, for N items and S slots:
      res = (N+S-1)! / ( (N-1)! * S! )

### CountUpTo(nItems, nSlots, vs, idx=0, startAt=0) | source code
    Figures out where a given combination of indices would
     occur in the combinatorial explosion generated by _GetIndexCombinations_

     **Arguments**

       - nItems: the number of items to distribute

       - nSlots: the number of slots in which to distribute them

       - vs: a sequence containing the values to find

       - idx: used in the recursion

       - startAt: used in the recursion

    **Returns**

       an integer

### GetIndexCombinations(nItems, nSlots, slot=0, lastItemVal=0) | source code
    Generates all combinations of nItems in nSlots without including
      duplicates

    **Arguments**

      - nItems: the number of items to distribute

      - nSlots: the number of slots in which to distribute them

      - slot: used in recursion

      - lastItemVal: used in recursion

    **Returns**

      a list of lists

### GetAllCombinations(choices, noDups=1, which=0) | source code
    Does the combinatorial explosion of the possible combinations
    of the elements of _choices_.

    **Arguments**

      - choices: sequence of sequences with the elements to be enumerated

      - noDups: (optional) if this is nonZero, duplicates will not be included
        in the values returned

      - noDups: (optional) if this is nonzero, results with duplicates,
        e.g. (1,1,0), will not be generated

      - which: used in recursion

    **Returns**

      a list of lists

### UniquifyCombinations(combos) | source code
    uniquifies the combinations in the argument

    **Arguments**:

      - combos: a sequence of sequences

    **Returns**

      - a list of tuples containing the unique combos

    **Notes**

      - the order of the indices of the individual combos in the
        results list is modified (they are sorted)

### GetPossibleScaffolds(nPts, bins) | source code
    gets all realizable scaffolds (passing the triangle inequality) with the
    given number of points and returns them as a list of tuples

Variables Details | [hide private]

  ### nPointDistDict Value:
      {2: ((0, 1)),
       3: ((0, 1), (0, 2), (1, 2)),
       4: ((0, 1), (0, 2), (0, 3), (1, 2), (2, 3)),
       5: ((0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (2, 3), (3, 4)),
       6: ((0, 1),
           (0, 2),
           (0, 3),
           (0, 4),
      ...

  ### nDistPointDict Value:
      {1: 2, 3: 3, 5: 4, 7: 5, 9: 6, 11: 7, 13: 8, 15: 9, 17: 10}