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.close()
-------------------------
I didn't tested but I don't see why it shouldn't work(TM)

S


On 04/24/2015 03:12 PM, Matthew Lardy wrote:
> Hi all,
>
> Does anyone have a route to write compressed sdf.gz files that are compatible 
> with
> pybel.Outputfile?
>
> Thanks in advance!
> Matthew

-- 
  Stefano Forli, PhD

  Staff Scientist
  Molecular Graphics Laboratory
  Dept. of Integrative Structural
   and Computational Biology, MB-112F
  The Scripps Research Institute
  10550  North Torrey Pines Road
  La Jolla,  CA 92037-1000,  USA.

     tel: +1 (858)784-2055
     fax: +1 (858)784-2860
     email: fo...@scripps.edu
     http://www.scripps.edu/~forli/

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to