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

Selfies alphabet token changes #58

Closed
whitead opened this issue Aug 8, 2021 · 3 comments
Closed

Selfies alphabet token changes #58

whitead opened this issue Aug 8, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@whitead
Copy link
Contributor

whitead commented Aug 8, 2021

sf.encoder('C#[S-]')

outputs

'[C][#S-expl]'

which uses a token [#S-expl] that does not appear on get_semantic_robust_alphabet. The closest token I see is [#S+1expl].

This arises by running the following code:

start_selfies = '[C][#S-1expl]' 
start_smiles = sf.decoder(start_selfies)
end_smiles = rdkit.Chem.MolToSmiles(rdkit.Chem.MolFromSmiles(start_smiles))
print('smiles change', start_smiles, end_smiles)
end_selfies = sf.encoder(end_smiles)
print('selfies change', start_selfies, end_selfies)
smiles change C#[S-1] C#[S-]
selfies change [C][#S-1expl] [C][#S-expl]

Is this intended behavior? I'm having this happen while running STONED and it's changing my alphabet. Any ideas would be appreciated!

@MarioKrenn6240
Copy link
Collaborator

Thanks for this comment. We will constrain the decoder to output only one version, [X-1expl] in the next version (after the workshop).

@MarioKrenn6240 MarioKrenn6240 added the enhancement New feature or request label Aug 9, 2021
@alstonlo
Copy link
Collaborator

Hi @whitead,

In selfies 2.0.0, we have constrained selfies.encoder to one unique representation for every atom, which also matches the symbols returned by selfies.get_semantic_robust_alphabet. This should prevent alphabet changes! For example,

print(sf.encoder("C#[S-1]"))  # [C][#S-1]
print(sf.encoder("C#[S-]"))   # [C][#S-1]
print(sf.encoder("[CH]#C"))   # [CH1][#C]
print(sf.encoder("[CH1]#C"))  # [CH1][#C]

Thanks for the suggestion!

@whitead
Copy link
Contributor Author

whitead commented Oct 25, 2021

Sounds good to me. Thanks!

@whitead whitead closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants