Hi Matthew,
In latest version of OB (master branch on github) automatically detects .gz
extensions and compresses the output - adds "-z" option to converter.
https://github.com/openbabel/openbabel/blob/master/scripts/python/pybel.py#L253
If you're using newest OB it should work out of the box. Oth
Hi Stefano,
That worked! Thanks!
Matthew
On Fri, Apr 24, 2015 at 3:34 PM, Stefano Forli wrote:
> Hi Matthew,
> I guess something like this could do the trick:
> -
> import gzip
> import pybel
>
> mol = pybel.readfile('sdf', 'filename.sdf').next()
> outfilename = 'exampl
Hi Matthew,
I guess something like this could do the trick:
-
import gzip
import pybel
mol = pybel.readfile('sdf', 'filename.sdf').next()
outfilename = 'example.sdf.gz'
output = gzip.open(outfilename, 'wb')
molString = mol.write(format='sdf')
output.write(molString)
output.