dataset script
Browse files- sagan-mc.py +10 -0
sagan-mc.py
CHANGED
|
@@ -100,8 +100,18 @@ class SaganMC(datasets.GeneratorBasedBuilder):
|
|
| 100 |
]
|
| 101 |
|
| 102 |
def _generate_examples(self, filepath, split_name):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
with open(filepath, encoding="utf-8") as f:
|
| 104 |
reader = csv.DictReader(f)
|
| 105 |
for idx, row in enumerate(reader):
|
| 106 |
if row["split"] == split_name:
|
|
|
|
|
|
|
|
|
|
| 107 |
yield idx, row
|
|
|
|
| 100 |
]
|
| 101 |
|
| 102 |
def _generate_examples(self, filepath, split_name):
|
| 103 |
+
numeric_fields = [
|
| 104 |
+
"num_atoms", "num_atoms_all", "num_bonds", "num_bonds_all", "num_rings", "num_aromatic_rings",
|
| 105 |
+
"physchem_mol_weight", "physchem_logp", "physchem_tpsa", "physchem_qed",
|
| 106 |
+
"physchem_h_acceptors", "physchem_h_donors", "physchem_rotatable_bonds", "physchem_fraction_csp3",
|
| 107 |
+
"complex_ma_score", "complex_ma_runtime", "complex_bertz_score", "complex_bertz_runtime",
|
| 108 |
+
"complex_boettcher_score", "complex_boettcher_runtime", "synth_sa_score"
|
| 109 |
+
]
|
| 110 |
with open(filepath, encoding="utf-8") as f:
|
| 111 |
reader = csv.DictReader(f)
|
| 112 |
for idx, row in enumerate(reader):
|
| 113 |
if row["split"] == split_name:
|
| 114 |
+
for field in numeric_fields:
|
| 115 |
+
if field in row and row[field] == "":
|
| 116 |
+
row[field] = None
|
| 117 |
yield idx, row
|