(Please cc the list)
Well, it hasn't been done, but the goal of the project is to support
all chemical file formats.
In the meanwhile, I've written a Python script that handles the
particular file you sent. If you have more files that exhibit
different types of bonds (e.g. aromatic, double) and charges then I
can add support for those too. Once the Python prototype is finished,
I'll have a go at porting to C++.
To run the Python script, install Python 2.7, the Python bindings for
Open Babel, and then run the script at the command-line with an
inputfile and outputfile, e.g.
C:\Python27\python smog.py myfile.res myoutputfile.smi
Then, you can convert the file to SVG (for example) and drag-and-drop
onto Firefox to see all of the isomers.
- Noel
On 8 February 2014 16:37, C Anthony Lewis <cale...@plymouth.ac.uk> wrote:
> Hi Noel,
>
> You may remember this thread from late November last year. ... I'm wondering
> whether there is an intention to include the SMOG format in Open Babel. I've
> had a look at the download page and it doesn't appear there have been any
> updates since I first inquired so I'm assuming the format isn't (yet)
> included.
> ...
>
> ________________________________
> From: Noel O'Boyle [baoille...@gmail.com]
> Sent: 25 November 2013 19:30
> To: C Anthony Lewis
> Subject: Re: [Open Babel] User defined 'mask' for data import
>
> Could you resend and cc the list? Thanks.
>
> - Noel
>
>
> On 25 November 2013 17:44, C Anthony Lewis
> <cale...@plymouth.ac.uk<mailto:cale...@plymouth.ac.uk>> wrote:
> Hi Noel,
>
> Many thanks for the reply... I've attached one of my smaller files, which
> contains the data for all constitutional isomers of C8H18 (alkane, 18
> isomers), and a document describing the format of this '*.res' file provided
> by the authors. I hope this helps.
>
> Anthony
>
> From: Noel O'Boyle [mailto:baoille...@gmail.com<mailto:baoille...@gmail.com>]
> Sent: 25 November 2013 13:38
> To: C Anthony Lewis
> Cc:
> openbabel-discuss@lists.sourceforge.net<mailto:openbabel-discuss@lists.sourceforge.net>
> Subject: Re: [Open Babel] User defined 'mask' for data import
>
> Can you provide an example? (Please cc to the list)
> - Noel
>
> On 25 November 2013 13:20, C Anthony Lewis
> <cale...@plymouth.ac.uk<mailto:cale...@plymouth.ac.uk>> wrote:
> Dear Open Babelers,
>
> Is it possible for 'the user' (i.e. me) to define a 'mask' to import data
> from a file? I'm not sure if I'm using the appropriate words but by 'mask' I
> mean something that will enable me to extract a specific re-occurring (but
> varying) portion of a file.
>
> In particular, I wish to extract the connection tables from output files
> generated by 'SMOG' (see CCL archives
> http://www.ccl.net/cca/software/MS-DOS/SMOG/index.shtml and
> http://pubs.acs.org/doi/abs/10.1021/ci950393z) and then generate the SMILES
> from the table. Unfortunately, I cannot get 'SMOG' to work under Windows 7
> and, anyway, I'm not sure that would help much as the SMILES for each of the
> isomers enumerated isn't provided by the application or in the file. Of
> course, I could use one or other of the (more current) isomer enumeration
> applications to recreate the isomers but I thought I'd first ask about the
> files I already have.
>
> Many thanks for any suggestions,
>
> Anthony
>
>
>
> C. Anthony Lewis
> Petroleum & Environmental Geochemistry Group & Centre for Chemical Sciences,
> School of Geography, Earth and Environmental Sciences,
> University of Plymouth,
> Plymouth, Devon PL4 8AA, U.K.
>
> tel: +44 (0)1752 584554
> email: cale...@plymouth.ac.uk<mailto:cale...@plymouth.ac.uk>
> web: http://www.pegg.org.uk<http://www.pegg.org.uk/>
> http://www.plymouth.ac.uk/chemistry
>
> ________________________________
>
>
> <http://www.plymouth.ac.uk/worldclass>
> This email and any files with it are confidential and intended solely for the
> use of the recipient to whom it is addressed. If you are not the intended
> recipient then copying, distribution or other use of the information
> contained is strictly prohibited and you should not rely on it. If you have
> received this email in error please let the sender know immediately and
> delete it from your system(s). Internet emails are not necessarily secure.
> While we take every care, Plymouth University accepts no responsibility for
> viruses and it is your responsibility to scan emails and their attachments.
> Plymouth University does not accept responsibility for any changes made after
> it was sent. Nothing in this email or its attachments constitutes an order
> for goods or services unless accompanied by an official order form.
> <http://www.plymouth.ac.uk/worldclass>
>
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing
> conversations that shape the rapidly evolving mobile landscape. Sign up now.
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss<http://www.plymouth.ac.uk/worldclass>
> <http://www.plymouth.ac.uk/worldclass>
> ________________________________
> [X]<http://www.plymouth.ac.uk/worldclass>
>
> This email and any files with it are confidential and intended solely for the
> use of the recipient to whom it is addressed. If you are not the intended
> recipient then copying, distribution or other use of the information
> contained is strictly prohibited and you should not rely on it. If you have
> received this email in error please let the sender know immediately and
> delete it from your system(s). Internet emails are not necessarily secure.
> While we take every care, Plymouth University accepts no responsibility for
> viruses and it is your responsibility to scan emails and their attachments.
> Plymouth University does not accept responsibility for any changes made after
> it was sent. Nothing in this email or its attachments constitutes an order
> for goods or services unless accompanied by an official order form.
>
> ________________________________
> [http://www.plymouth.ac.uk/images/email_footer.gif]<http://www.plymouth.ac.uk/worldclass>
>
> This email and any files with it are confidential and intended solely for the
> use of the recipient to whom it is addressed. If you are not the intended
> recipient then copying, distribution or other use of the information
> contained is strictly prohibited and you should not rely on it. If you have
> received this email in error please let the sender know immediately and
> delete it from your system(s). Internet emails are not necessarily secure.
> While we take every care, Plymouth University accepts no responsibility for
> viruses and it is your responsibility to scan emails and their attachments.
> Plymouth University does not accept responsibility for any changes made after
> it was sent. Nothing in this email or its attachments constitutes an order
> for goods or services unless accompanied by an official order form.
from __future__ import print_function
import os
import sys
import pybel
ob = pybel.ob
def smog2mol(lines):
mol = ob.OBMol()
for line in lines:
atmnum = int(line[:3])
element = line[6:10].strip()
bonds = line[23:]
if atmnum > 0:
atm = ob.OBAtom()
atm.SetAtomicNum(ob.cvar.etab.GetAtomicNum(element))
mol.AddAtom(atm)
for i, b in enumerate(bonds):
if int(b):
mol.AddBond(mol.NumAtoms(), i+1, int(b))
else:
for i, n in enumerate(bonds):
for j in range(int(n)):
atm = ob.OBAtom()
atm.SetAtomicNum(ob.cvar.etab.GetAtomicNum(element))
mol.AddAtom(atm)
mol.AddBond(mol.NumAtoms(), i+1, 1)
return mol
def readSMOG(filename):
with open(filename) as f:
for line in f:
if line.startswith("Isomer"):
lines = []
while True:
temp = f.next().strip()
if not temp:
break
lines.append(temp)
yield smog2mol(lines)
def printhelp():
print("python smog.py inputfile outputfile")
sys.exit(1)
def handleargs(args):
options = {}
if len(args) != 3:
printhelp()
options['inputfile'] = sys.argv[1]
if not os.path.isfile(sys.argv[1]):
printhelp()
options['outputfile'] = sys.argv[2]
return options
if __name__ == "__main__":
options = handleargs(sys.argv)
output = pybel.Outputfile("smi", options['outputfile'], overwrite=True)
for mol in readSMOG(options['inputfile']):
m = pybel.Molecule(mol)
m.removeh()
output.write(m)
output.close()
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss