This section provides a tutorial example on how to use rdkit.Chem.rdmolfiles.MolFromSmiles(s) and rdkit.Chem.rdmolfiles.MolToSmiles(m) methods to handle molecules expressed in SMILES strings.
# 需要导入模块: from rdkit import Chem [as 别名]# 或者: from rdkit.Chem importMolFromSmiles[as 别名]defsetUp(self):current_dir = os.path.dirname(os.path.realpath(__file__))# simple flat ringfromrdkit.ChemimportMolFromSmilesself.cycle4 =MolFromSmiles('C1CCC1') self.cycle4.Compute2DC...
mol = Chem.MolFromSmiles('C1=CC=CC=C1C(CC)C') mol 下面是原来的邻接矩阵 adjacency_matrix = Chem.rdmolops.GetAdjacencyMatrix(mol) adjacency_matrix 实际上光有这个邻接矩阵是不够的。这个矩阵只反映了原子和原子之间的连接关系要还原成mol的话还需要通过增加顶点和顶点之间的度数来反映原子之间的键的种类。
采样的新分子的SDF文件和SMILES编码一样会存放在outputs/目录下。 夹克在这里为了偷看新分子和口袋的结合情况,在如下核心代码和PyMOL的帮助下,看了生成的新分子的2D构象和3D分子-口袋构象。 from rdkit import Chem from rdkit.Chem import Draw from rdkit.Chem import AllChem # Molecular mol_sdf = r'xxx\4...
fromrdkitimportChemfromrdkit.Chemimportrdmolops# 创建一个分子对象(这里以乙烯为例)smiles="C=C"mol=Chem.MolFromSmiles(smiles)# 计算分子中的自由旋转化学键数目num_rotatable_bonds=rdmolops.CalcNumRotatableBonds(mol)# 打印结果print(f"分子 '{smiles}' 中的自由旋转化学键数目为:{num_rotatable_bonds}...
1. 下载pymol:PyMOL | pymol.org 2. 完成安装 3. 找到下图所示的Prompt, 并运行pymol -R命令打开pymol server 4. 可以使用如下的简单代码运行pymol from rdkit.Chem import PyMol from rdkit import Chem v= Chem.PyMol.MolViewer() rdmol = Chem.MolFromSmiles('C') ...
def generate_3d_comformer(smiles, sdf_save_path, mmffVariant="MMFF94", randomSeed=0, maxIters=5000, increment=2, optim_count=10, save_force=False): count = 0 while count < optim_count: try: m = Chem.MolFromSmiles(smiles) m3d = Chem.AddHs(m) if save_force: try: AllChem.Embed...
MoLFormer is pre-trained on canonicalized SMILES of >1 B molecules from ZINC and PubChem with the following constraints: During pre-processing, the compounds are filtered to keep a maximum length of 211 characters. A 100/0/0 split was used for training, validation, and test, i.e. we use...
new_mol = Chem.MolFromSmiles(smiles, sanitize=False) new_mol = copy_edit_mol(new_mol).GetMol() new_mol = sanitize(new_mol)#if tmp_mol is not None: new_mol = tmp_molreturnnew_mol 开发者ID:wengong-jin,项目名称:hgraph2graph,代码行数:9,代码来源:chemutils.py ...
Here, we introduce a new molecule optimization method, MolFinder, based on an efficient global optimization algorithm, the conformational space annealing algorithm, and the SMILES representation. MolFinder finds diverse molecules with desired properties