[Rdkit-discuss] Peptide cis/trans bonds

2017-04-24 Thread Bruce Milne
Hi,

Does anyone know how I can force RDKit to keep peptide bonds ‘trans’ during 
conformer generation and subsequent minimisation? The structures will be used 
for docking so the absolute quality of the geometries is not so much an issue 
but I’d like to avoid glaringly awkward things like these cis-peptide bonds.

The procedure I’m using is basically:

m = Chem.MolFromMolFile(f, sanitize=True, removeHs=False) # Using a .mol file 
with hydrogens already added.

confIds = AllChem.EmbedMultipleConfs(m, numConfs=10,
 clearConfs=False,
 useRandomCoords=True,
 enforceChirality=True,
 useExpTorsionAnglePrefs=True,
 useBasicKnowledge=True,
 numThreads=0)

for id in confIds:
AllChem.MMFFOptimizeMoleculeConfs(m, numThreads=0, mmffVariant='MMFF94', 
confId=id)
print >>file('{0}{1}.mol'.format('conformer_', count), 
'w+'),Chem.MolToPDBBlock(m, confId=id)
count += 1

Cheers,
Bruce Milne
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Pharm2D.SigFactory and psql issues

2017-04-24 Thread Greg Landrum
The first part has a quick reply: I haven't yet done the PostgreSQL builds for 
conda; that's on my list, but it likely won't happen until later this week.

The second requires more thought...


From: Pavel Polishchuk 
Sent: Monday, April 24, 2017 8:30:35 AM
To: RDKit Discuss
Subject: [Rdkit-discuss] Pharm2D.SigFactory and psql issues

Hello,

   I found two issues which are reproducible in 2016.09 and 2017.3 conda
builds.

   0. The first issue is related to PostgreSQL. If I try to install it
from conda it asks me to downgrade rdkit to 2016.3. After downgrading of
rdkit psql works well.

   1. Generation of 2D pharmacophore fingerprints using default
parameters returns errors for some molecules. However if I add
trianglePruneBins=False option to initialization procedure of a
signature factory it starts working. It seems that Gen2DFingerprint
ignores trianglePruneBins parameter. Below is a code example:

from rdkit import Chem
from rdkit import RDConfig
from rdkit.Chem.Pharm2D.SigFactory import SigFactory
from rdkit.Chem.Pharm2D import Generate

import os

fdefName = os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef')
factory = ChemicalFeatures.BuildFeatureFactory(fdefName)
sigFactory = SigFactory(factory, minPointCount=2, maxPointCount=3,
trianglePruneBins=True)   # replace to False and the error will
disappear(True is a default value)
sigFactory.SetBins([(0,2),(2,5),(5,8)])
sigFactory.Init()

mol = Chem.MolFromSmiles('Cc1nc(CN(C)c2ncnc3ccc(-c4ccc5c(c4)OCO5)cc23)cs1')
fp = Generate.Gen2DFingerprint(mol, sigFactory)

---
ValueErrorTraceback (most recent call last)
/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/SigFactory.py
in GetBitIdx(self, featIndices, dists, sortIndices)
 249 print('\tbins:', repr(self._bins), type(self._bins))
--> 250   bin_ = self._findBinIdx(dists, self._bins,
self._scaffolds[len(dists)])
 251 except ValueError:

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/SigFactory.py
in _findBinIdx(self, dists, bins, scaffolds)
 169   whichBins[i] = where
--> 170 res = scaffolds.index(tuple(whichBins))
 171 if _verbose:

ValueError: (2, 0, 0) is not in list

During handling of the above exception, another exception occurred:

IndexErrorTraceback (most recent call last)
 in ()
   1 # from rdkit.Chem.Pharm2D import Generate
   2 mol =
Chem.MolFromSmiles('Cc1nc(CN(C)c2ncnc3ccc(-c4ccc5c(c4)OCO5)cc23)cs1')
> 3 fp = Generate.Gen2DFingerprint(mol, sigFactory)

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/Generate.py
in Gen2DFingerprint(mol, sigFactory, perms, dMat, bitInfo)
 160 for match in matchesToMap:
 161   if sigFactory.shortestPathsOnly:
--> 162 idx = _ShortestPathsMatch(match, perm, sig, dMat,
sigFactory)
 163 if idx is not None and bitInfo is not None:
 164   l = bitInfo.get(idx, [])

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/Generate.py
in _ShortestPathsMatch(match, featureSet, sig, dMat, sigFactory)
  71 dist[i] = d
  72
---> 73   idx = sigFactory.GetBitIdx(featureSet, dist, sortIndices=False)
  74   if _verbose:
  75 print('\t', dist, minD, maxD, idx)

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/SigFactory.py
in GetBitIdx(self, featIndices, dists, sortIndices)
 253   fams = [fams[x] for x in featIndices]
 254   raise IndexError('distance bin not found: feats: %s;
dists=%s; bins=%s; scaffolds: %s' %
--> 255(fams, dists, self._bins, self._scaffolds))
 256
 257 return startIdx + offset + bin_

IndexError: distance bin not found: feats: ['Acceptor', 'Aromatic',
'Aromatic']; dists=[5, 1, 1]; bins=[(0, 2), (2, 5), (5, 8)]; scaffolds:
[0, [(0,), (1,), (2,)], 0, [(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1),
(0, 1, 2), (0, 2, 1), (0, 2, 2), (1, 0, 0), (1, 0, 1), (1, 0, 2), (1, 1,
0), (1, 1, 1), (1, 1, 2), (1, 2, 0), (1, 2, 1), (1, 2, 2), (2, 0, 1),
(2, 0, 2), (2, 1, 0), (2, 1, 1), (2, 1, 2), (2, 2, 0), (2, 2, 1), (2, 2,
2)], 0]


Kind regards,
Pavel.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! 

[Rdkit-discuss] Pharm2D.SigFactory and psql issues

2017-04-24 Thread Pavel Polishchuk
Hello,

   I found two issues which are reproducible in 2016.09 and 2017.3 conda 
builds.

   0. The first issue is related to PostgreSQL. If I try to install it 
from conda it asks me to downgrade rdkit to 2016.3. After downgrading of 
rdkit psql works well.

   1. Generation of 2D pharmacophore fingerprints using default 
parameters returns errors for some molecules. However if I add 
trianglePruneBins=False option to initialization procedure of a 
signature factory it starts working. It seems that Gen2DFingerprint 
ignores trianglePruneBins parameter. Below is a code example:

from rdkit import Chem
from rdkit import RDConfig
from rdkit.Chem.Pharm2D.SigFactory import SigFactory
from rdkit.Chem.Pharm2D import Generate

import os

fdefName = os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef')
factory = ChemicalFeatures.BuildFeatureFactory(fdefName)
sigFactory = SigFactory(factory, minPointCount=2, maxPointCount=3, 
trianglePruneBins=True)   # replace to False and the error will 
disappear(True is a default value)
sigFactory.SetBins([(0,2),(2,5),(5,8)])
sigFactory.Init()

mol = Chem.MolFromSmiles('Cc1nc(CN(C)c2ncnc3ccc(-c4ccc5c(c4)OCO5)cc23)cs1')
fp = Generate.Gen2DFingerprint(mol, sigFactory)

---
ValueErrorTraceback (most recent call last)
/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/SigFactory.py
 
in GetBitIdx(self, featIndices, dists, sortIndices)
 249 print('\tbins:', repr(self._bins), type(self._bins))
--> 250   bin_ = self._findBinIdx(dists, self._bins, 
self._scaffolds[len(dists)])
 251 except ValueError:

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/SigFactory.py
 
in _findBinIdx(self, dists, bins, scaffolds)
 169   whichBins[i] = where
--> 170 res = scaffolds.index(tuple(whichBins))
 171 if _verbose:

ValueError: (2, 0, 0) is not in list

During handling of the above exception, another exception occurred:

IndexErrorTraceback (most recent call last)
 in ()
   1 # from rdkit.Chem.Pharm2D import Generate
   2 mol = 
Chem.MolFromSmiles('Cc1nc(CN(C)c2ncnc3ccc(-c4ccc5c(c4)OCO5)cc23)cs1')
> 3 fp = Generate.Gen2DFingerprint(mol, sigFactory)

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/Generate.py
 
in Gen2DFingerprint(mol, sigFactory, perms, dMat, bitInfo)
 160 for match in matchesToMap:
 161   if sigFactory.shortestPathsOnly:
--> 162 idx = _ShortestPathsMatch(match, perm, sig, dMat, 
sigFactory)
 163 if idx is not None and bitInfo is not None:
 164   l = bitInfo.get(idx, [])

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/Generate.py
 
in _ShortestPathsMatch(match, featureSet, sig, dMat, sigFactory)
  71 dist[i] = d
  72
---> 73   idx = sigFactory.GetBitIdx(featureSet, dist, sortIndices=False)
  74   if _verbose:
  75 print('\t', dist, minD, maxD, idx)

/home/pavlo/anaconda3/envs/rdk_2017_3/lib/python3.6/site-packages/rdkit/Chem/Pharm2D/SigFactory.py
 
in GetBitIdx(self, featIndices, dists, sortIndices)
 253   fams = [fams[x] for x in featIndices]
 254   raise IndexError('distance bin not found: feats: %s; 
dists=%s; bins=%s; scaffolds: %s' %
--> 255(fams, dists, self._bins, self._scaffolds))
 256
 257 return startIdx + offset + bin_

IndexError: distance bin not found: feats: ['Acceptor', 'Aromatic', 
'Aromatic']; dists=[5, 1, 1]; bins=[(0, 2), (2, 5), (5, 8)]; scaffolds: 
[0, [(0,), (1,), (2,)], 0, [(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), 
(0, 1, 2), (0, 2, 1), (0, 2, 2), (1, 0, 0), (1, 0, 1), (1, 0, 2), (1, 1, 
0), (1, 1, 1), (1, 1, 2), (1, 2, 0), (1, 2, 1), (1, 2, 2), (2, 0, 1), 
(2, 0, 2), (2, 1, 0), (2, 1, 1), (2, 1, 2), (2, 2, 0), (2, 2, 1), (2, 2, 
2)], 0]


Kind regards,
Pavel.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss