When you process a compound table, keeping each result attached to its source row makes review and reprocessing easier. chematic’s canonicalize_smiles_batch_json returns an ordered report containing the source SMILES and the outcome for each input.
Three inputs produce three report records
Passing CCO, C1CC, and OCC in that order produces the following correspondence. This example was checked with the published npm package v1.1.2.
input_index input status canonical_smiles
0 CCO accepted C(C)O
1 C1CC rejected
2 OCC accepted C(C)O
The C1CC record also contains a parser message about its ring closure. The record to review has input_index: 1, and the following OCC record keeps input_index: 2. You can use that index to join results back to compound IDs in the source table.
input_index starts at zero. For a simple CSV with one header row, the spreadsheet row is input_index + 2. If you select rows during import, carry their original row numbers alongside the selected input list.
Return record details and batch counts together
Each report record contains input, status, and, when parsing succeeds, canonical_smiles. The batch also includes input_count, record_count, accepted_count, and rejected_count. The example therefore reads as three inputs, three results, two accepted records, and one record to review.
You can retain the source SMILES while adding descriptors or similarity results. Joining by input index also lets you reuse the same table when a reviewed record is corrected and processed again.
Connect the Rust result to Python and WASM
The report exposes the ordered results of Rust’s SmilesBatchCanonicalizer as JSON through Python and WASM APIs. Python accepts a list of SMILES; WASM accepts a string with an explicit delimiter. Each calling convention fits its environment while retaining the correspondence with the source input.
The implementation is in the batch processor, Python API, and WASM API. Keeping source records attached to results at the API boundary makes the operation easier to use from spreadsheets and file-processing tools.