1

因此,我一直在查看文档,但找不到任何相关内容。在 SDF 文件中,Chembl 名称为空,但我确实在我想要的 chembl ID 上有条目。这里'

 15 12  2  0
 16 13  1  0
 17 10  1  0
 18 16  2  0
 19 16  1  0
 20 19  2  0
 21 18  1  0
 22 20  1  0
  4  5  2  0
 10  9  2  0
 21 22  2  0
M  END
>  <chembl_id>  (4) 
CHEMBL6226

>  <chembl_pref_name>  (4) 
None

$$$$

for idx, mol in enumerate(self.hits):
    print(mol.GetProp("_Name"))

向我抛出空格。在这种情况下,我需要 chembl ID。

4

1 回答 1

1

SDF 中的属性被添加到分子中。您可以通过几种不同的方式访问它们:

# return the properties as a dictionary
prop_dict = mol.GetPropsAsDict()
chembl_id = prop_dict.get('chembl_id')

# Check a property exists
has_id = mol.HasProp('chembl_id')

# Get a single property
chembl_id = mol.GetProp('chembl_id')

# To get a numerical prop (assuming it exists in the file)
mol_wt = mol.GetDoubleProp('MolWt')

_Name 属性是从 SD 文件的标题行添加的,即在此示例中,_Name 属性将为“6602966”(PubChem id):

$$$$
6602966
     RDKit          2D

 27 29  0  0  0  0  0  0  0  0999 V2000
    8.1706    6.9514    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
...
于 2021-06-07T12:25:31.720 回答