-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
import os
import pandas as pd
import csv
import oddt
from oddt.scoring.functions import RFScore
oddt.toolkit = oddt.toolkits.rdk
rf = rfscore(version=1, n_jobs=-1)
# rf.load('/path/to/your/model.pkl')
with open('result_csv.csv', 'w', newline='') as csvfile:
fieldnames = ['pdb_id', 'rf_score_v1']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for root, dirs, _ in os.walk('./coreset'):
for dir in dirs:
pdb_id = dir
ligands_file = os.path.join(root, dir, f'{pdb_id}_ligand.sdf')
proteins_file = os.path.join(root, dir, f'{pdb_id}_pocket.pdb')
lig_mol = next(oddt.toolkit.readfile('sdf', ligands_file))
prot_mol = next(oddt.toolkit.readfile('pdb', proteins_file))
score = rf.predict(lig_mol, prot_mol)
print(f'{pdb_id}_ligand.sdf', score)
writer.writerow({'pdb_id': pdb_id, 'rf_score_v1': score})
ref_df = pd.read_csv("2016_core_affinity.csv", sep='\t')
result_df = pd.read_csv("result_csv.csv")
BUT IT RAISES ERROR:
Traceback (most recent call last):
File "oddt_rfscore_Coreset.py", line 9, in <module>
rf = RFScore(version=1, n_jobs=-1)
TypeError: 'module' object is not callable
Metadata
Metadata
Assignees
Labels
No labels