本文整理汇总了Python中rdkit.Chem.FindMolChiralCenters方法的典型用法代码示例。如果您正苦于以下问题:Python Chem.FindMolChiralCenters方法的具体用法?Python Chem.FindMolChiralCenters怎么用?Python Chem.FindMolChiralCenters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rdkit.Chem
的用法示例。
在下文中一共展示了Chem.FindMolChiralCenters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getMolSvg
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import FindMolChiralCenters [as 别名]
def getMolSvg(self):
self.drawer = rdMolDraw2D.MolDraw2DSVG(300,300)
#TODO, what if self._drawmol doesn't exist?
if self._drawmol != None:
#Chiral tags on R/S
chiraltags = Chem.FindMolChiralCenters(self._drawmol)
opts = self.drawer.drawOptions()
for tag in chiraltags:
idx = tag[0]
opts.atomLabels[idx]= self._drawmol.GetAtomWithIdx(idx).GetSymbol() + ':' + tag[1]
if len(self._selectedAtoms) > 0:
colors={self._selectedAtoms[-1]:(1,0.2,0.2)} #Color lastly selected a different color
self.drawer.DrawMolecule(self._drawmol, highlightAtoms=self._selectedAtoms, highlightAtomColors=colors, )
else:
self.drawer.DrawMolecule(self._drawmol)
self.drawer.FinishDrawing()
self.finishedDrawing.emit()#Signal that drawer has finished
svg = self.drawer.GetDrawingText().replace('svg:','')
return svg
示例2: _get_chiral_centers
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import FindMolChiralCenters [as 别名]
def _get_chiral_centers(self, mol):
"""
Use RDKit to find the chiral centers with CIP(R/S) label
This provides the absolute stereochemistry. The chiral label obtained
from pybabel and rdkit.mol.getchiraltag is relative positions of the bonds as provided
Args:
mol (Molecule): Molecule to asses
Return:
(dict): Keys are the atom index and values are the CIP label
"""
mol_rdk = self._get_rdk_mol(mol, 'smiles')
if mol_rdk is None:
# Conversion to RDKit has failed
return {}
else:
chiral_cc = Chem.FindMolChiralCenters(mol_rdk)
return dict(chiral_cc)
示例3: get_priority
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import FindMolChiralCenters [as 别名]
def get_priority(self, retroPrecursor, **kwargs):
if not self._loaded:
self.load_model()
necessary_reagent_atoms = retroPrecursor.necessary_reagent.count('[') / 2.
scores = []
for smiles in retroPrecursor.smiles_list:
# If buyable, basically free
ppg = self.pricer.lookup_smiles(smiles, alreadyCanonical=True)
if ppg:
scores.append(- ppg / 5.0)
continue
# Else, use heuristic
x = Chem.MolFromSmiles(smiles)
total_atoms = x.GetNumHeavyAtoms()
ring_bonds = sum([b.IsInRing() - b.GetIsAromatic()
for b in x.GetBonds()])
chiral_centers = len(Chem.FindMolChiralCenters(x))
scores.append(
- 2.00 * np.power(total_atoms, 1.5)
- 1.00 * np.power(ring_bonds, 1.5)
- 2.00 * np.power(chiral_centers, 2.0)
)
return np.sum(scores) - 4.00 * np.power(necessary_reagent_atoms, 2.0)
示例4: get_priority
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import FindMolChiralCenters [as 别名]
def get_priority(self, retroPrecursor, **kwargs):
if not self._loaded:
self.load_model()
necessary_reagent_atoms = retroPrecursor.necessary_reagent.count('[') / 2.
scores = []
for smiles in retroPrecursor.smiles_list:
# If buyable, basically free
ppg = self.pricer.lookup_smiles(smiles, alreadyCanonical=True)
if ppg:
scores.append(- ppg / 1000.0)
continue
# Else, use heuristic
x = Chem.MolFromSmiles(smiles)
total_atoms = x.GetNumHeavyAtoms()
ring_bonds = sum([b.IsInRing() - b.GetIsAromatic()
for b in x.GetBonds()])
chiral_centers = len(Chem.FindMolChiralCenters(x))
scores.append(
- 2.00 * np.power(total_atoms, 1.5)
- 1.00 * np.power(ring_bonds, 1.5)
- 2.00 * np.power(chiral_centers, 2.0)
)
sco = np.sum(scores) - 4.00 * np.power(necessary_reagent_atoms, 2.0)
return sco / retroPrecursor.template_score
示例5: calculateScore
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import FindMolChiralCenters [as 别名]
def calculateScore(m):
if _fscores is None: readFragmentScores()
# fragment score
fp = rdMolDescriptors.GetMorganFingerprint(m,2) #<- 2 is the *radius* of the circular fingerprint
fps = fp.GetNonzeroElements()
score1 = 0.
nf = 0
for bitId,v in iteritems(fps):
nf += v
sfp = bitId
score1 += _fscores.get(sfp,-4)*v
score1 /= nf
# features score
nAtoms = m.GetNumAtoms()
nChiralCenters = len(Chem.FindMolChiralCenters(m,includeUnassigned=True))
ri = m.GetRingInfo()
nBridgeheads,nSpiro=numBridgeheadsAndSpiro(m,ri)
nMacrocycles=0
for x in ri.AtomRings():
if len(x)>8: nMacrocycles+=1
sizePenalty = nAtoms**1.005 - nAtoms
stereoPenalty = math.log10(nChiralCenters+1)
spiroPenalty = math.log10(nSpiro+1)
bridgePenalty = math.log10(nBridgeheads+1)
macrocyclePenalty = 0.
# ---------------------------------------
# This differs from the paper, which defines:
# macrocyclePenalty = math.log10(nMacrocycles+1)
# This form generates better results when 2 or more macrocycles are present
if nMacrocycles > 0: macrocyclePenalty = math.log10(2)
score2 = 0. -sizePenalty -stereoPenalty -spiroPenalty -bridgePenalty -macrocyclePenalty
# correction for the fingerprint density
# not in the original publication, added in version 1.1
# to make highly symmetrical molecules easier to synthetise
score3 = 0.
if nAtoms > len(fps):
score3 = math.log(float(nAtoms) / len(fps)) * .5
sascore = score1 + score2 + score3
# need to transform "raw" value into scale between 1 and 10
min = -4.0
max = 2.5
sascore = 11. - (sascore - min + 1) / (max - min) * 9.
# smooth the 10-end
if sascore > 8.: sascore = 8. + math.log(sascore+1.-9.)
if sascore > 10.: sascore = 10.0
elif sascore < 1.: sascore = 1.0
return sascore