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

trimBuiltSmiles should not be used for de-duplication #11

Open
adelenelai opened this issue May 20, 2020 · 2 comments
Open

trimBuiltSmiles should not be used for de-duplication #11

adelenelai opened this issue May 20, 2020 · 2 comments

Comments

@adelenelai
Copy link

@adelenelai adelenelai commented May 20, 2020

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:

las_gensmiles <- "OS(=O)(=O)c1ccc(cc1)C([R1])[R2]"
r1ton <- "{C,C}"
nr1ton <- "{9-13}"
split <- splitRrange(las_gensmiles,nR1toN = nr1ton)  #"(5-7,4-6)"
las_series <- buildSmiles(las_gensmiles,R1toN = r1ton, nR1toN = split)

gives

las_series
[1] "OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCC"     "OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCCC"   
[3] "OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCCCC"   "OS(=O)(=O)c1ccc(cc1)C(CCCCCC)CCCC"   
[5] "OS(=O)(=O)c1ccc(cc1)C(CCCCCC)CCCCC"   "OS(=O)(=O)c1ccc(cc1)C(CCCCCC)CCCCCC" 
[7] "OS(=O)(=O)c1ccc(cc1)C(CCCCCCC)CCCC"   "OS(=O)(=O)c1ccc(cc1)C(CCCCCCC)CCCCC" 
[9] "OS(=O)(=O)c1ccc(cc1)C(CCCCCCC)CCCCCC"

corresponding to

sapply(las_series,MolFormFromSmiles.rcdk)
    OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCC    OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCCC 
                         "C16H26O3S"                          "C17H28O3S" 
  OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCCCC    OS(=O)(=O)c1ccc(cc1)C(CCCCCC)CCCC 
                         "C18H30O3S"                          "C17H28O3S" 
  OS(=O)(=O)c1ccc(cc1)C(CCCCCC)CCCCC  OS(=O)(=O)c1ccc(cc1)C(CCCCCC)CCCCCC 
                         "C18H30O3S"                          "C19H32O3S" 
  OS(=O)(=O)c1ccc(cc1)C(CCCCCCC)CCCC  OS(=O)(=O)c1ccc(cc1)C(CCCCCCC)CCCCC 
                         "C18H30O3S"                          "C19H32O3S" 
OS(=O)(=O)c1ccc(cc1)C(CCCCCCC)CCCCCC 
                         "C20H34O3S" 
trimBuiltSmiles(las_series)
[1] "OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCC"     "OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCCC"   
[3] "OS(=O)(=O)c1ccc(cc1)C(CCCCC)CCCCCC"   "OS(=O)(=O)c1ccc(cc1)C(CCCCCC)CCCCCC" 
[5] "OS(=O)(=O)c1ccc(cc1)C(CCCCCCC)CCCCCC"

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.

@schymane
Copy link
Owner

@schymane schymane commented May 20, 2020

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?

@adelenelai
Copy link
Author

@adelenelai adelenelai commented May 20, 2020

hmm...makes sense in the context of intended use-case.

Trimming by InChiKey requires lookup in Cactus/CTS? Concerned it will be slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.