本文整理汇总了Python中rdkit.Chem.Crippen.MolLogP方法的典型用法代码示例。如果您正苦于以下问题:Python Crippen.MolLogP方法的具体用法?Python Crippen.MolLogP怎么用?Python Crippen.MolLogP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rdkit.Chem.Crippen
的用法示例。
在下文中一共展示了Crippen.MolLogP方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_logp
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def check_logp(dataset):
with open('generated_smiles_%s' % dataset, 'rb') as f:
all_smiles=set(pickle.load(f))
logp_sum=0
total=0
logp_score_per_molecule=[]
for smiles in all_smiles:
new_mol=Chem.MolFromSmiles(smiles)
try:
val = Crippen.MolLogP(new_mol)
except:
continue
logp_sum+=val
logp_score_per_molecule.append(val)
total+=1
return logp_sum/total, logp_score_per_molecule
示例2: evaluate_chem_mol
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [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: evaluate_chem_mol
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [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.
示例4: water_octanol_partition_coefficient_scores
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def water_octanol_partition_coefficient_scores(mols, norm=False):
scores = [MolecularMetrics._avoid_sanitization_error(lambda: Crippen.MolLogP(mol)) if mol is not None else None
for mol in mols]
scores = np.array(list(map(lambda x: -3 if x is None else x, scores)))
scores = np.clip(MolecularMetrics.remap(scores, -2.12178879609, 6.0429063424), 0.0, 1.0) if norm else scores
return scores
示例5: water_octanol_partition_coefficient_scores
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def water_octanol_partition_coefficient_scores(mols, norm=False):
scores = [MolecularMetrics._avoid_sanitization_error(lambda: Crippen.MolLogP(Chem.AddHs(mol, 1))) if mol is not None else None
for mol in mols]
scores = np.array(list(map(lambda x: -3 if x is None else x, scores)))
scores = np.clip(MolecularMetrics.remap(scores, -2.12178879609, 6.0429063424), 0.0, 1.0) if norm else scores
return scores
示例6: logP
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def logP(smile, train_smiles=None):
try:
low_logp = -2.12178879609
high_logp = 6.0429063424
logp = Crippen.MolLogP(Chem.MolFromSmiles(smile))
val = remap(logp, low_logp, high_logp)
val = np.clip(val, 0.0, 1.0)
return val
except ValueError:
return 0.0
#====== druglikeliness
示例7: properties
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def properties(mol):
"""
Calculates the properties that are required to calculate the QED descriptor.
"""
matches = []
if mol is None:
raise WrongArgument("properties(mol)", "mol argument is \'None\'")
x = [0] * 9
# MW
x[0] = Descriptors.MolWt(mol)
# ALOGP
x[1] = Descriptors.MolLogP(mol)
for hba in Acceptors: # HBA
if mol.HasSubstructMatch(hba):
matches = mol.GetSubstructMatches(hba)
x[2] += len(matches)
x[3] = Descriptors.NumHDonors(
mol) # HBD
# PSA
x[4] = Descriptors.TPSA(mol)
x[5] = Descriptors.NumRotatableBonds(
mol) # ROTB
x[6] = Chem.GetSSSR(Chem.DeleteSubstructs(
deepcopy(mol), AliphaticRings)) # AROM
for alert in StructuralAlerts: # ALERTS
if (mol.HasSubstructMatch(alert)):
x[7] += 1
ro5_failed = 0
if x[3] > 5:
ro5_failed += 1 # HBD
if x[2] > 10:
ro5_failed += 1 # HBA
if x[0] >= 500:
ro5_failed += 1
if x[1] > 5:
ro5_failed += 1
x[8] = ro5_failed
return x
示例8: logP_mw
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def logP_mw(fnames, is_active=False):
""" logP and molecular weight calculation for logP ~ MW chemical space visualization
Arguments:
fnames (list): List of file paths that contains CANONICAL_SMILES (, LOGP and MWT
if it contains the logP and molecular weight for each molecule).
is_active (bool, optional): selecting only active ligands (True) or all of the molecules (False)
if it is true, the molecule with PCHEMBL_VALUE >= 6.5 or SCORE > 0.5 will be selected.
(Default: False)
Returns:
df (DataFrame): The table contains three columns;
molecular weight, logP and index of file name in the fnames
"""
df = pd.DataFrame()
for i, fname in enumerate(fnames):
print(fname)
sub = pd.read_table(fname)
sub['LABEL'] = i
if 'PCHEMBL_VALUE' in sub.columns:
sub = sub[sub.PCHEMBL_VALUE >= (6.5 if is_active else 0)]
elif 'SCORE' in sub.columns:
sub = sub[sub.SCORE > (0.5 if is_active else 0)]
sub = sub.drop_duplicates(subset='CANONICAL_SMILES')
if not ('LOGP' in sub.columns and 'MWT' in sub.columns):
# If the the table does not contain LOGP and MWT
# it will calculate these coefficients with RDKit.
logp, mwt = [], []
for i, row in sub.iterrows():
try:
mol = Chem.MolFromSmiles(row.CANONICAL_SMILES)
x, y = desc.MolWt(mol), Crippen.MolLogP(mol)
logp.append(y)
mwt.append(x)
except:
sub = sub.drop(i)
print(row.CANONICAL_SMILES)
sub['LOGP'], sub['MWT'] = logp, mwt
df = df.append(sub[['MWT', 'LOGP', 'LABEL']])
return df
示例9: calc_esol_descriptors
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def calc_esol_descriptors(self, mol):
"""
Calcuate mw,logp,rotors and aromatic proportion (ap)
:param mol: input molecule
:return: named tuple with descriptor values
"""
mw = Descriptors.MolWt(mol)
logp = Crippen.MolLogP(mol)
rotors = Lipinski.NumRotatableBonds(mol)
ap = self.calc_ap(mol)
return self.Descriptor(mw=mw, logp=logp, rotors=rotors, ap=ap)
示例10: PhyChem
# 需要导入模块: from rdkit.Chem import Crippen [as 别名]
# 或者: from rdkit.Chem.Crippen import MolLogP [as 别名]
def PhyChem(smiles):
""" Calculating the 19D physicochemical descriptors for each molecules,
the value has been normalized with Gaussian distribution.
Arguments:
smiles (list): list of SMILES strings.
Returns:
props (ndarray): m X 19 matrix as nomalized PhysChem descriptors.
m is the No. of samples
"""
props = []
for smile in smiles:
mol = Chem.MolFromSmiles(smile)
try:
MW = desc.MolWt(mol)
LOGP = Crippen.MolLogP(mol)
HBA = Lipinski.NumHAcceptors(mol)
HBD = Lipinski.NumHDonors(mol)
rotable = Lipinski.NumRotatableBonds(mol)
amide = AllChem.CalcNumAmideBonds(mol)
bridge = AllChem.CalcNumBridgeheadAtoms(mol)
heteroA = Lipinski.NumHeteroatoms(mol)
heavy = Lipinski.HeavyAtomCount(mol)
spiro = AllChem.CalcNumSpiroAtoms(mol)
FCSP3 = AllChem.CalcFractionCSP3(mol)
ring = Lipinski.RingCount(mol)
Aliphatic = AllChem.CalcNumAliphaticRings(mol)
aromatic = AllChem.CalcNumAromaticRings(mol)
saturated = AllChem.CalcNumSaturatedRings(mol)
heteroR = AllChem.CalcNumHeterocycles(mol)
TPSA = MolSurf.TPSA(mol)
valence = desc.NumValenceElectrons(mol)
mr = Crippen.MolMR(mol)
# charge = AllChem.ComputeGasteigerCharges(mol)
prop = [MW, LOGP, HBA, HBD, rotable, amide, bridge, heteroA, heavy, spiro,
FCSP3, ring, Aliphatic, aromatic, saturated, heteroR, TPSA, valence, mr]
except:
print(smile)
prop = [0] * 19
props.append(prop)
props = np.array(props)
props = Scaler().fit_transform(props)
return props