# \[ANN\] OpenSMILES.jl a SMILES parser for Julia!

**URL:** https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675
**Category:** Package Announcements
**Created:** [March 29, 2020, 1:54pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675 "2020-03-29T13:54:58Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [March 29, 2020, 1:54pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/1 "2020-03-29T13:54:58Z")

</div>

So if you are a chemist, biochemist, or someone working in those fields you may know what SMILES is. If not it’s basically a string representation for chemicals that preserves their connectivity and implied characteristics by physical laws. OpenSMILES.jl([GitHub - caseykneale/OpenSMILES.jl: OpenSMILES parser in Julia](https://github.com/caseykneale/OpenSMILES.jl)) does exactly that, it allows a user to parse SMILES strings into LightGraphs.jl graphs!

Its useful for chemical datamining, QSAR, drug discovery, chemoinformatics, visualization, scraping, AI/ML, etc. Or just for looking at somewhat pretty pictures derived entirely from strings! For example here is tryptophan(the amino acid in turkey that is fabled to make people sleepy)  
SMILES representation: “C1=CC=C2C(=C1)C(=CN2)CC(C(=O)O)N”

OpenSMILES.jl graph plot:  
 ![](https://global.discourse-cdn.com/julialang/original/3X/3/5/35ac68f263ec5d9c6862534a041259de6bf95e3d.png)

So is this package perfect? Nope. Does it handle Chirality? Not yet? Will it ever? If you contribute sure, otherwise maybe not.

Are there likely bugs/issues? Maybe. Will I ever know? If you use it and report them yes!

It’s an early release but I think it has some serious utility and is a valueable contribution to JuliaChemistry which is an in the works Domain (discussion here: [Should there be a Chemistry Domain/Organization? - #18 by mfh](https://discourse.julialang.org/t/should-there-be-a-chemistry-domain/36475/18))

Thank you!

---

<div class="post-metadata">

### Author: ![braamvandyk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/braamvandyk/32/5086_2.png) [@braamvandyk](https://discourse.julialang.org/u/braamvandyk)
#### Post date: [March 29, 2020, 3:38pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/2 "2020-03-29T15:38:16Z")

</div>

Thanks. This is great! Do you foresee a SMILES generator from A mol file in the future?

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [March 29, 2020, 4:34pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/3 "2020-03-29T16:34:29Z")

</div>

Know of good documentation for Mol file formats? 🙂  
If so I wouldn’t mind filling that need if its not in ChemFiles 🙂

---

<div class="post-metadata">

### Author: ![braamvandyk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/braamvandyk/32/5086_2.png) [@braamvandyk](https://discourse.julialang.org/u/braamvandyk)
#### Post date: [March 29, 2020, 5:19pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/4 "2020-03-29T17:19:59Z")

</div>

As a start: [here](https://chem.libretexts.org/Courses/University_of_Arkansas_Little_Rock/ChemInformatics_(2017)%3A_Chem_4399%2F%2F5399/2.2%3A_Chemical_Representations_on_Computer%3A_Part_II/2.2.2%3A_Anatomy_of_a_MOL_file)

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [March 29, 2020, 6:20pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/5 "2020-03-29T18:20:30Z")

</div>

Looks doable 🙂 But the alternative might be just to get it into a common graph format, then work on bridging that format to others. I’m not a serious I/O guy but I’ve had to write readers/writers a bit.

---

<div class="post-metadata">

### Author: ![IlyaOrson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ilyaorson/32/1681_2.png) [@IlyaOrson](https://discourse.julialang.org/u/IlyaOrson)
#### Post date: [March 29, 2020, 8:40pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/6 "2020-03-29T20:40:23Z")

</div>

The [SELFIES paper](https://arxiv.org/abs/1905.13741) might be of interest for the organization, it comes with [code](https://github.com/aspuru-guzik-group/selfies) :). As far as I understand, the trade-off is that the SELFIES representation is always a valid molecule but is less human readable, which does not matter much for the use case of exploring the molecule space programmatically with generation models. Not my area though, I just attended a nice talk by that research group.

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [March 29, 2020, 9:00pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/7 "2020-03-29T21:00:16Z")

</div>

Interesting, what does Apache 2.0 mean as far as noncommercial recreations go? Could I MIT a license of a port of it? I have a feeling I wouldn’t be able to port the code directly given Python & Julia’s string differences, but whatever came out at least could be tested against vetted code.

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [March 29, 2020, 9:03pm UTC](https://discourse.julialang.org/t/ann-opensmiles-jl-a-smiles-parser-for-julia/36675/8 "2020-03-29T21:03:34Z")

</div>

Oh wow… 2k+ lines of python if then else statements basically.

[https://github.com/aspuru-guzik-group/selfies/blob/master/build/lib/selfies/selfies\_fcts.py](https://github.com/aspuru-guzik-group/selfies/blob/master/build/lib/selfies/selfies_fcts.py)
