本文整理匯總了Python中rdkit.Chem.rdMolDescriptors.CalcExactMolWt方法的典型用法代碼示例。如果您正苦於以下問題:Python rdMolDescriptors.CalcExactMolWt方法的具體用法?Python rdMolDescriptors.CalcExactMolWt怎麽用?Python rdMolDescriptors.CalcExactMolWt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rdkit.Chem.rdMolDescriptors
的用法示例。
在下文中一共展示了rdMolDescriptors.CalcExactMolWt方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: evaluate_chem_mol
# 需要導入模塊: from rdkit.Chem import rdMolDescriptors [as 別名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 別名]
def evaluate_chem_mol(mol):
try:
Chem.GetSSSR(mol)
clogp = Crippen.MolLogP(mol)
mw = MolDescriptors.CalcExactMolWt(mol)
tpsa = Descriptors.TPSA(mol)
ret_val = [
True,
320 < mw < 420,
2 < clogp < 3,
40 < tpsa < 60
]
except:
ret_val = [False] * 4
return ret_val
# Same as above but decodes and check if a cached value could be used.
示例2: evaluate_chem_mol
# 需要導入模塊: from rdkit.Chem import rdMolDescriptors [as 別名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 別名]
def evaluate_chem_mol(mol):
try:
Chem.GetSSSR(mol)
clogp = Crippen.MolLogP(mol)
mw = MolDescriptors.CalcExactMolWt(mol)
tpsa = Descriptors.TPSA(mol)
ret_val = [
True,
320 < mw < 420,
2 < clogp < 3,
40 < tpsa < 60
]
except:
ret_val = [False] * 4
return ret_val
# Same as above but decodes and check if a cached value could be used.
示例3: __init__
# 需要導入模塊: from rdkit.Chem import rdMolDescriptors [as 別名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 別名]
def __init__(self, mol, atom_count=None, MW=None, Tb=None):
if type(mol) == Chem.rdchem.Mol:
self.rdkitmol = mol
else:
self.rdkitmol = Chem.MolFromSmiles(mol)
if atom_count is None:
self.rdkitmol_Hs = Chem.AddHs(self.rdkitmol)
self.atom_count = len(self.rdkitmol_Hs.GetAtoms())
else:
self.atom_count = atom_count
if MW is None:
self.MW = rdMolDescriptors.CalcExactMolWt(self.rdkitmol_Hs)
else:
self.MW = MW
self.counts, self.success, self.status = smarts_fragment(J_BIGGS_JOBACK_SMARTS_id_dict, rdkitmol=self.rdkitmol)
if Tb is not None:
self.Tb_estimated = self.Tb(self.counts)
else:
self.Tb_estimated = Tb
示例4: reward_target_mw
# 需要導入模塊: from rdkit.Chem import rdMolDescriptors [as 別名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 別名]
def reward_target_mw(mol, target,ratio=40,max=4):
"""
Reward for a target molecular weight
:param mol: rdkit mol object
:param target: float
:return: float (-inf, max]
"""
x = rdMolDescriptors.CalcExactMolWt(mol)
reward = -1 * np.abs((x - target)/ratio) + max
return reward
# TODO(Bowen): num rings is a discrete variable, so what is the best way to
# calculate the reward?
示例5: choose
# 需要導入模塊: from rdkit.Chem import rdMolDescriptors [as 別名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 別名]
def choose(self, mol):
"""Return the largest covalent unit.
The largest fragment is determined by number of atoms (including hydrogens). Ties are broken by taking the
fragment with the higher molecular weight, and then by taking the first alphabetically by SMILES if needed.
:param mol: The molecule to choose the largest fragment from.
:type mol: rdkit.Chem.rdchem.Mol
:return: The largest fragment.
:rtype: rdkit.Chem.rdchem.Mol
"""
log.debug('Running LargestFragmentChooser')
# TODO: Alternatively allow a list of fragments to be passed as the mol parameter
fragments = Chem.GetMolFrags(mol, asMols=True)
largest = None
for f in fragments:
smiles = Chem.MolToSmiles(f, isomericSmiles=True)
log.debug('Fragment: %s', smiles)
organic = is_organic(f)
if self.prefer_organic:
# Skip this fragment if not organic and we already have an organic fragment as the largest so far
if largest and largest['organic'] and not organic:
continue
# Reset largest if it wasn't organic and this fragment is organic
if largest and organic and not largest['organic']:
largest = None
# Count atoms
atoms = 0
for a in f.GetAtoms():
atoms += 1 + a.GetTotalNumHs()
# Skip this fragment if fewer atoms than the largest
if largest and atoms < largest['atoms']:
continue
# Skip this fragment if equal number of atoms but weight is lower
weight = rdMolDescriptors.CalcExactMolWt(f)
if largest and atoms == largest['atoms'] and weight < largest['weight']:
continue
# Skip this fragment if equal atoms and equal weight but smiles comes last alphabetically
if largest and atoms == largest['atoms'] and weight == largest['weight'] and smiles > largest['smiles']:
continue
# Otherwise this is the largest so far
log.debug('New largest fragment: %s (%s)', smiles, atoms)
largest = {'smiles': smiles, 'fragment': f, 'atoms': atoms, 'weight': weight, 'organic': organic}
return largest['fragment']
示例6: choose
# 需要導入模塊: from rdkit.Chem import rdMolDescriptors [as 別名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 別名]
def choose(self, mol):
"""Return the largest covalent unit.
The largest fragment is determined by number of atoms (including hydrogens). Ties are broken by taking the
fragment with the higher molecular weight, and then by taking the first alphabetically by SMILES if needed.
:param mol: The molecule to choose the largest fragment from.
:type mol: :rdkit:`Mol <Chem.rdchem.Mol-class.html>`
:return: The largest fragment.
:rtype: :rdkit:`Mol <Chem.rdchem.Mol-class.html>`
"""
log.debug("Running LargestFragmentChooser")
# TODO: Alternatively allow a list of fragments to be passed as the mol parameter
fragments = Chem.GetMolFrags(mol, asMols=True)
largest = None
for f in fragments:
smiles = Chem.MolToSmiles(f, isomericSmiles=True)
log.debug("Fragment: %s", smiles)
organic = is_organic(f)
if self.prefer_organic:
# Skip this fragment if not organic and we already have an organic fragment as the largest so far
if largest and largest["organic"] and not organic:
continue
# Reset largest if it wasn't organic and this fragment is organic
if largest and organic and not largest["organic"]:
largest = None
# Count atoms
atoms = 0
for a in f.GetAtoms():
atoms += 1 + a.GetTotalNumHs()
# Skip this fragment if fewer atoms than the largest
if largest and atoms < largest["atoms"]:
continue
# Skip this fragment if equal number of atoms but weight is lower
weight = rdMolDescriptors.CalcExactMolWt(f)
if largest and atoms == largest["atoms"] and weight < largest["weight"]:
continue
# Skip this fragment if equal atoms and equal weight but smiles comes last alphabetically
if (
largest
and atoms == largest["atoms"]
and weight == largest["weight"]
and smiles > largest["smiles"]
):
continue
# Otherwise this is the largest so far
log.debug("New largest fragment: %s (%s)", smiles, atoms)
largest = {
"smiles": smiles,
"fragment": f,
"atoms": atoms,
"weight": weight,
"organic": organic,
}
return largest["fragment"]
# ==============================================================================
# from .normalize import NORMALIZATIONS, MAX_RESTARTS, Normalizer
# ==============================================================================