【问题标题】:How to use the ChEMBL API to download the chembldescriptors?如何使用 ChEMBL API 下载化学描述符?
【发布时间】:2022-11-28 02:48:36
【问题描述】:

我有一个带有 Molecule ChEMBL ID 的 .csv,但我找不到下载那组分子的 chembldescriptors 的代码。具体来说,我想下载:“TPSA”、“NumHAcceptors”、“NumHDonors”、“CX Acidic pKa”、“CX Basic pKa”、“qed”。

【问题讨论】:

  • 你应该提供样本数据,你应该尝试自己编写代码,遇到困难问问...
  • 我想,我想通了,几乎所有的查询:

标签: python api cheminformatics


【解决方案1】:

起点不是 .csv,但我可以通过 API(对于 python)获取所有信息

from chembl_webresource_client.new_client import new_client
import pandas as pd
#activity API:
activities = new_client.activity.filter(target_chembl_id__in = ['CHEMBL1824']  #erbB-2
                                       ).filter(standard_type = "IC50"
                                        , IC50_value__lte = 10000    
                                        , assay_type = 'B'                     #Only look for Binding Assays
                                       ).only(['molecule_chembl_id', 'ic50_value'])
act_df = pd.DataFrame(activities)
#find the list of compounds that are within the act_df dataframe:
cmpd_chembl_ids = list(set(act_df['molecule_chembl_id']))
#molecule API
molecules = new_client.molecule.filter(molecule_chembl_id__in = cmpd_chembl_ids  
                                       ).only([ 'molecule_chembl_id', 'molecule_properties'])
mol_df = pd.DataFrame(molecules)
#mol_df
# Convert nested cells (ie those containing a dictionary) to individual columns in the dataframe
mol_df['qed_weighted'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['qed_weighted'])
#mol_df['cx_logd'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['cx_logd'])
#mol_df['cx_logp'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['cx_logp'])
mol_df['cx_most_apka'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['cx_most_apka'])
mol_df['cx_most_bpka'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['cx_most_bpka'])
mol_df['hba'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['hba'])
mol_df['hbd'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['hbd'])
mol_df['psa'] = mol_df.loc[ mol_df['molecule_properties'].notnull(), 'molecule_properties'].apply(lambda x: x['psa'])

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多