Closed adelenelai closed 4 years ago
The function was designed to return only one example per formula (for mass spec screening, for instance, one only needs one representative structure per formula, which was the intended use case) - a parallel function could be added to trim by InChIKey if you need trimming that retains all structural isomers?
hmm...makes sense in the context of intended use-case.
Trimming by InChiKey requires lookup in Cactus/CTS? Concerned it will be slow.
trimBuiltSmiles() deduplicates a set of SMILES by comparing their molecular formulae via the helper function MolFormFromSmiles.rcdk.
However, some structural isomers get 'trimmed' in this way...and they shouldn't be.
Minimal example:
gives
corresponding to
where SMILES with R1,R2 as 6,5; 6,4; 7,4; and 7,5 are trimmed off. The latter 3 should not be trimmed as they are structurally different from 5,5; 5,6; and 6,6 resp. although having the same MF.
Ideally, should eliminate potential duplicates at earlier stage even before they are generated, somewhere within buildSmiles or splitRrange (?)
Alternatively, could deduplicate by comparing canonical smiles instead of comparing MFs. Probably faster than doing isomorphism check.