Task tutorial
Preflight a SMILES list before a batch workflow
Classify every input as accepted or rejected before descriptor calculation, similarity search, or duplicate review.
You will make
A local, input-order-preserving preflight report with an explicit status, canonical SMILES, or parser error for every source value.
Steps
- Load the source SMILES values in the same order as the CSV or spreadsheet rows.
- Run the batch canonicalization report before any API that skips invalid input.
- Map input_index back to the source row, fix or quarantine rejected values, then start the next workflow.
import json
import chematic
source_smiles = ["CCO", "C1CC", "OCC"]
report = json.loads(chematic.canonicalize_smiles_batch_json(source_smiles))
for row in report["records"]:
print(row)Expected result
CCO and OCC are accepted and each has a canonical_smiles value. The incomplete C1CC value is rejected with an error while staying in the record list at input_index 1.
If it does not work
This report validates SMILES syntax and representation only. Accepted rows are not proof of chemical identity, salt policy, stereochemical intent, safety, or experimental validity. Preserve the original source value and map the zero-based input_index to the original CSV row before acting on the result.