open_compressed in bx-python does this already (for bz2 as well).
On Jul 8, 2013, at 5:58 PM, Peter Cock <p.j.a.cock(a)googlemail.com> wrote:
On Mon, Jul 8, 2013 at 10:24 PM, Robert Baertsch
> Peter and Dan,
> I like the idea of replacing all open() with galaxy_open() in all tools. You
> can tell the format by looking at the first 4 byes (see C code below from
> the UCSC browser team). Is there some pythonic way of overriding open?
There is monkey patching (replace the current 'open' function with
your modified version), but that is not a good idea in general.
In any case, this would only affect the small number of Python
tools which happen to use the Galaxy parsing libraries - which
is a very small fraction of the tools in Galaxy. Most of the tools
in Galaxy are compiled programs and are entirely separate.
Please keep all replies on the list by using "reply all"
in your mail client. To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
To search Galaxy mailing lists use the unified search at: