Similarity Maps
相似性图是一种可视化原子对分子和参考分子之间相似性的贡献的方法。相似性图可用于可视化和确认相似区域。
实例
#导入模块和包
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import SimilarityMaps
#基于分子量创建相似性图
ms = [m for m in Chem.SDMolSupplier(‘input.sdf’)]
weights = SimilarityMaps.GetAtomicWeightsForFingerprint(ms[0], ms[1], SimilarityMaps.GetMorganFingerprint)
fig = SimilarityMaps.GetSimilarityMapFromWeights(ms[1], weights, size=(300, 300))
fig.savefig(“ms1.png”,bbox_inches=’tight’)
weights = SimilarityMaps.GetAtomicWeightsForFingerprint(ms[1], ms[0], SimilarityMaps.GetMorganFingerprint)
fig = SimilarityMaps.GetSimilarityMapFromWeights(ms[0], weights, size=(300, 300))
fig.savefig(“sm0.png”,bbox_inches=’tight’)
#基于电荷可视化分子相似程度
AllChem.ComputeGasteigerCharges(ms[0])
charges = [float(atom.GetProp(‘_GasteigerCharge’)) for atom in ms[0].GetAtoms()]
fig = SimilarityMaps.GetSimilarityMapFromWeights(ms[0],charges, size=(300, 300),scale=10)
fig.savefig(“ms0_charge.png”,bbox_inches=’tight’)