-
Notifications
You must be signed in to change notification settings - Fork 29
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
moltosmiles function? #23
Comments
Thank you for your interest. |
I just added a PR that supports molecule generation from inchi strings. During my research for a solution I stumbled across OpenBabel which is an amazing ChemConverter. babel_cmd = raw"C:\Temp\OpenBabel\obabel.exe" # or wherever your babel is located
smiles = rstrip(read(`$babel_cmd -:"InChI=1/C2H6O/c1-2-3/h3H,2H2,1H3" -iinchi -osmi`, String))
# "CCO"
using MolecularGraph
mol = smilestomol("CCO")
sdf = printv2mol(mol)
smiles = rstrip(read(`$babel_cmd -:"$sdf" -imol -osmi`, String))
# "CCO" This still has some overhead in calling an external program but is still pretty fast. It would be tempting to build an OpenBabel.jl package ... |
Adding to @hhaensel's comment, with openbabel_jll one can use the ExecutableProduct, removing the overhead of calling an external program: using openbabel_jll
inchi = "InChI=1/C2H6O/c1-2-3/h3H,2H2,1H3"
smiles = rstrip(readchomp(`$(obabel()) -:$inchi -i inchi -o smiles`)) I would love to see this approach applied more broadly in this package to enable more flexible format conversion. |
Hi! I'm new to MolecularGraph.jl. Does it currently support a function to convert a GraphMol instance into a SMILES string?
The text was updated successfully, but these errors were encountered: