当前位置: 首页>>代码示例>>Python>>正文


Python Descriptors.TPSA属性代码示例

本文整理汇总了Python中rdkit.Chem.Descriptors.TPSA属性的典型用法代码示例。如果您正苦于以下问题:Python Descriptors.TPSA属性的具体用法?Python Descriptors.TPSA怎么用?Python Descriptors.TPSA使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在rdkit.Chem.Descriptors的用法示例。


在下文中一共展示了Descriptors.TPSA属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: evaluate_chem_mol

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [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. 
开发者ID:stan-his,项目名称:DeepFMPO,代码行数:22,代码来源:rewards.py

示例2: evaluate_chem_mol

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [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. 
开发者ID:stan-his,项目名称:DeepFMPO,代码行数:22,代码来源:rewards.py

示例3: default_rule_template

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [as 别名]
def default_rule_template(alert_list, file_name):
    """
    Build a default rules template
    :param alert_list: list of alert set names
    :param file_name: output file name
    :return: None
    """
    default_rule_dict = {
        "MW": [0, 500],
        "LogP": [-5, 5],
        "HBD": [0, 5],
        "HBA": [0, 10],
        "TPSA": [0, 200],
        "Rot": [0, 10]
    }
    for rule_name in alert_list:
        if rule_name == "Inpharmatica":
            default_rule_dict["Rule_" + rule_name] = True
        else:
            default_rule_dict["Rule_" + rule_name] = False
    write_rules(default_rule_dict, file_name) 
开发者ID:PatWalters,项目名称:rd_filters,代码行数:23,代码来源:rd_filters.py

示例4: evaluate

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [as 别名]
def evaluate(self, lst_in):
        """
        Evaluate structure alerts on a list of SMILES
        :param lst_in: input list of [SMILES, Name]
        :return: list of alerts matched or "OK"
        """
        smiles, name = lst_in
        mol = Chem.MolFromSmiles(smiles)
        if mol is None:
            return [smiles, name, 'INVALID', -999, -999, -999, -999, -999]
        desc_list = [MolWt(mol), MolLogP(mol), NumHDonors(mol), NumHAcceptors(mol), TPSA(mol),
                     CalcNumRotatableBonds(mol)]
        for row in self.rule_list:
            patt, max_val, desc = row
            if len(mol.GetSubstructMatches(patt)) > max_val:
                return [smiles, name] + [desc + " > %d" % (max_val)] + desc_list
        return [smiles, name] + ["OK"] + desc_list 
开发者ID:PatWalters,项目名称:rd_filters,代码行数:19,代码来源:rd_filters.py

示例5: create_feature_df

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [as 别名]
def create_feature_df(smiles_df):
    temp = list(zip(*smiles_df['canonical_smiles'].map(get_descriptors)))
    columns = ["MolLogP", "MolMR", "BalabanJ", "NumHAcceptors", "NumHDonors", "NumValenceElectrons", "TPSA"]
    df = pd.DataFrame(columns=columns)
    for i, c in enumerate(columns):
        df.loc[:, c] = temp[i]
    df = (df - df.mean(axis=0, numeric_only=True)) / df.std(axis=0, numeric_only=True)
    df = smiles_df.join(df)
    return df 
开发者ID:jrwnter,项目名称:cddd,代码行数:11,代码来源:preprocessing.py

示例6: get_descriptors

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [as 别名]
def get_descriptors(sml):
    try:
        m = Chem.MolFromSmiles(sml)
        descriptor_list = []
        descriptor_list.append(Descriptors.MolLogP(m))
        descriptor_list.append(Descriptors.MolMR(m)) #ok
        descriptor_list.append(Descriptors.BalabanJ(m))
        descriptor_list.append(Descriptors.NumHAcceptors(m)) #ok
        descriptor_list.append(Descriptors.NumHDonors(m)) #ok
        descriptor_list.append(Descriptors.NumValenceElectrons(m))
        descriptor_list.append(Descriptors.TPSA(m)) # nice
        return descriptor_list
    except:
        return [np.float("nan")] * 7 
开发者ID:jrwnter,项目名称:cddd,代码行数:16,代码来源:preprocessing.py

示例7: tpsa

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [as 别名]
def tpsa(mol: Mol) -> float:
    return Descriptors.TPSA(mol) 
开发者ID:BenevolentAI,项目名称:guacamol,代码行数:4,代码来源:descriptors.py

示例8: properties

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [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 
开发者ID:gablg1,项目名称:ORGAN,代码行数:40,代码来源:mol_metrics.py

示例9: main

# 需要导入模块: from rdkit.Chem import Descriptors [as 别名]
# 或者: from rdkit.Chem.Descriptors import TPSA [as 别名]
def main():
    cmd_input = docopt(cmd_str)
    alert_file_name = cmd_input.get("--alerts") or pkg_resources.resource_filename('rd_filters',
                                                                                   "data/alert_collection.csv")
    rf = RDFilters(alert_file_name)

    if cmd_input.get("template"):
        template_output_file = cmd_input.get("--out")
        default_rule_template(rf.get_alert_sets(), template_output_file)

    elif cmd_input.get("filter"):
        input_file_name = cmd_input.get("--in")
        rules_file_name = cmd_input.get("--rules") or pkg_resources.resource_filename('rd_filters', "data/rules.json")
        rules_file_path = get_config_file(rules_file_name, "FILTER_RULES_DATA")
        prefix_name = cmd_input.get("--prefix")
        num_cores = cmd_input.get("--np") or mp.cpu_count()
        num_cores = int(num_cores)

        print("using %d cores" % num_cores, file=sys.stderr)
        start_time = time.time()
        p = Pool(num_cores)
        input_data = [x.split() for x in open(input_file_name)]
        input_data = [x for x in input_data if len(x) == 2]
        rule_dict = read_rules(rules_file_path)

        rule_list = [x.replace("Rule_", "") for x in rule_dict.keys() if x.startswith("Rule") and rule_dict[x]]
        rule_str = " and ".join(rule_list)
        print(f"Using alerts from {rule_str}", file=sys.stderr)
        rf.build_rule_list(rule_list)
        res = list(p.map(rf.evaluate, input_data))
        df = pd.DataFrame(res, columns=["SMILES", "NAME", "FILTER", "MW", "LogP", "HBD", "HBA", "TPSA", "Rot"])
        df_ok = df[
            (df.FILTER == "OK") &
            df.MW.between(*rule_dict["MW"]) &
            df.LogP.between(*rule_dict["LogP"]) &
            df.HBD.between(*rule_dict["HBD"]) &
            df.HBA.between(*rule_dict["HBA"]) &
            df.TPSA.between(*rule_dict["TPSA"]) &
            df.Rot.between(*rule_dict["Rot"])
            ]
        output_smiles_file = prefix_name + ".smi"
        output_csv_file = prefix_name + ".csv"
        df_ok[["SMILES", "NAME"]].to_csv(f"{output_smiles_file}", sep=" ", index=False, header=False)
        print(f"Wrote SMILES for molecules passing filters to {output_smiles_file}", file=sys.stderr)
        df.to_csv(f"{prefix_name}.csv", index=False)
        print(f"Wrote detailed data to {output_csv_file}", file=sys.stderr)

        num_input_rows = df.shape[0]
        num_output_rows = df_ok.shape[0]
        fraction_passed = "%.1f" % (num_output_rows / num_input_rows * 100.0)
        print(f"{num_output_rows} of {num_input_rows} passed filters {fraction_passed}%", file=sys.stderr)
        elapsed_time = "%.2f" % (time.time() - start_time)
        print(f"Elapsed time {elapsed_time} seconds", file=sys.stderr) 
开发者ID:PatWalters,项目名称:rd_filters,代码行数:55,代码来源:rd_filters.py


注:本文中的rdkit.Chem.Descriptors.TPSA属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。