Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: read all test smiles w/o missing #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions dataset/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,17 @@ def read_smiles(data_path, target, task):
with open(data_path) as csv_file:
csv_reader = csv.DictReader(csv_file, delimiter=',')
for i, row in enumerate(csv_reader):
if i != 0:
smiles = row['smiles']
label = row[target]
mol = Chem.MolFromSmiles(smiles)
if mol != None and label != '':
smiles_data.append(smiles)
if task == 'classification':
labels.append(int(label))
elif task == 'regression':
labels.append(float(label))
else:
ValueError('task must be either regression or classification')
smiles = row['smiles']
label = row[target]
mol = Chem.MolFromSmiles(smiles)
if mol != None and label != '':
smiles_data.append(smiles)
if task == 'classification':
labels.append(int(label))
elif task == 'regression':
labels.append(float(label))
else:
ValueError('task must be either regression or classification')
print(len(smiles_data))
return smiles_data, labels

Expand Down