Package Chem :: Package AtomPairs :: Module Torsions
[hide private]
[frames] | no frames]

Module Torsions

source code

Contains an implementation of Topological-torsion fingerprints, as
described in:

R. Nilakantan, N. Bauman, J. S. Dixon, R. Venkataraghavan;
"Topological Torsion: A New Molecular Descriptor for SAR Applications.
Comparison with Other Descriptors" JCICS 27, 82-85 (1987).



Functions [hide private]
 
pyScorePath(mol, path, size, atomCodes=None)
Returns a score for an individual path.
source code
 
ExplainPathScore(score, size=4)
>>> m = Chem.MolFromSmiles('C=CC')...
source code
 
GetTopologicalTorsionFingerprintAsIntVect(...)
Returns the topological-torsion fingerprint for a molecule as a LongIntSparseIntVect...
source code
 
GetTopologicalTorsionFingerprint(...)
Returns the topological-torsion fingerprint for a molecule as a LongIntSparseIntVect...
source code
 
GetTopologicalTorsionFingerprintAsIds(mol, targetSize=4) source code
 
_test() source code
Function Details [hide private]

pyScorePath(mol, path, size, atomCodes=None)

source code 
Returns a score for an individual path.

>>> m = Chem.MolFromSmiles('CCCCC')
>>> c1 = long(Utils.GetAtomCode(m.GetAtomWithIdx(0),1))
>>> c2 = long(Utils.GetAtomCode(m.GetAtomWithIdx(1),2))
>>> c3 = long(Utils.GetAtomCode(m.GetAtomWithIdx(2),2))
>>> c4 = long(Utils.GetAtomCode(m.GetAtomWithIdx(3),1))
>>> t = c1 | (c2 << rdMolDescriptors.AtomPairsParameters.codeSize) | (c3 << (rdMolDescriptors.AtomPairsParameters.codeSize*2)) | (c4 << (rdMolDescriptors.AtomPairsParameters.codeSize*3))
>>> pyScorePath(m,(0,1,2,3),4)==t
1

The scores are path direction independent:
>>> pyScorePath(m,(3,2,1,0),4)==t
1


>>> m = Chem.MolFromSmiles('C=CC(=O)O')
>>> c1 = long(Utils.GetAtomCode(m.GetAtomWithIdx(0),1))
>>> c2 = long(Utils.GetAtomCode(m.GetAtomWithIdx(1),2))
>>> c3 = long(Utils.GetAtomCode(m.GetAtomWithIdx(2),2))
>>> c4 = long(Utils.GetAtomCode(m.GetAtomWithIdx(4),1))
>>> t = c1 | (c2 << rdMolDescriptors.AtomPairsParameters.codeSize) | (c3 << (rdMolDescriptors.AtomPairsParameters.codeSize*2)) | (c4 << (rdMolDescriptors.AtomPairsParameters.codeSize*3))
>>> pyScorePath(m,(0,1,2,4),4)==t
1

ExplainPathScore(score, size=4)

source code 


>>> m = Chem.MolFromSmiles('C=CC')
>>> score=pyScorePath(m,(0,1,2),3)
>>> ExplainPathScore(score,3)
(('C', 1, 0), ('C', 2, 1), ('C', 1, 1))

Again, it's order independent:
>>> score=pyScorePath(m,(2,1,0),3)
>>> ExplainPathScore(score,3)
(('C', 1, 0), ('C', 2, 1), ('C', 1, 1))


>>> m = Chem.MolFromSmiles('C=CO')
>>> score=pyScorePath(m,(0,1,2),3)
>>> ExplainPathScore(score,3)
(('C', 1, 1), ('C', 2, 1), ('O', 1, 0))

>>> m = Chem.MolFromSmiles('OC=CO')
>>> score=pyScorePath(m,(0,1,2,3),4)
>>> ExplainPathScore(score,4)
(('O', 1, 0), ('C', 2, 1), ('C', 2, 1), ('O', 1, 0))

>>> m = Chem.MolFromSmiles('CC=CO')
>>> score=pyScorePath(m,(0,1,2,3),4)
>>> ExplainPathScore(score,4)
(('C', 1, 0), ('C', 2, 1), ('C', 2, 1), ('O', 1, 0))


>>> m = Chem.MolFromSmiles('C=CC(=O)O')
>>> score=pyScorePath(m,(0,1,2,3),4)
>>> ExplainPathScore(score,4)
(('C', 1, 1), ('C', 2, 1), ('C', 3, 1), ('O', 1, 1))
>>> score=pyScorePath(m,(0,1,2,4),4)
>>> ExplainPathScore(score,4)
(('C', 1, 1), ('C', 2, 1), ('C', 3, 1), ('O', 1, 0))


>>> m = Chem.MolFromSmiles('OOOO')
>>> score=pyScorePath(m,(0,1,2),3)
>>> ExplainPathScore(score,3)
(('O', 1, 0), ('O', 2, 0), ('O', 2, 0))
>>> score=pyScorePath(m,(0,1,2,3),4)
>>> ExplainPathScore(score,4)
(('O', 1, 0), ('O', 2, 0), ('O', 2, 0), ('O', 1, 0))

GetTopologicalTorsionFingerprintAsIntVect(...)

source code 
Returns the topological-torsion fingerprint for a molecule as a LongIntSparseIntVect
C++ signature:
    GetTopologicalTorsionFingerprint(RDKit::ROMol mol, unsigned int targetSize=4) -> RDKit::SparseIntVect<long long>*

GetTopologicalTorsionFingerprint(...)

source code 
Returns the topological-torsion fingerprint for a molecule as a LongIntSparseIntVect
C++ signature:
    GetTopologicalTorsionFingerprint(RDKit::ROMol mol, unsigned int targetSize=4) -> RDKit::SparseIntVect<long long>*