[Biopython] random access to bgz file

Peter Cock p.j.a.cock at googlemail.com
Wed Apr 9 04:54:55 EDT 2014


Hi Tommy,

This isn't covered in the tutorial, but the module's built in
help is quite extensive (the docstrings). Try:

from Bio import bgzf
help(bgzf)

Or, the HTML rendered version:
http://biopython.org/DIST/docs/api/Bio.bgzf-module.html

(Note to self - that could be made prettier by checking
the markup works, rather than treating it as plain text)

Or, read the source on GitHub etc:
https://github.com/biopython/biopython/blob/master/Bio/bgzf.py

Essentially, like any other Python handle use the seek
and tell methods - however the offsets are BGZF virtual
offets which are ordered but you CANNOT do offset
arithmetic on them. See also:
http://blastedbio.blogspot.co.uk/2011/11/bgzf-blocked-bigger-better-gzip.html

Peter

On Tue, Apr 8, 2014 at 10:24 PM, Tommy Carstensen <tc9 at sanger.ac.uk> wrote:
> I read the Biopython tutorial:
> http://biopython.org/DIST/docs/tutorial/Tutorial.html
>
> It does not explain how to do random access to a bgz file. Can someone point me to a tutorial on how to do this? Thank you.
>
> Best wishes,
> Tommy
>
>
>
>
> --
>  The Wellcome Trust Sanger Institute is operated by Genome Research
>  Limited, a charity registered in England with number 1021457 and a
>  company registered in England with number 2742969, whose registered
>  office is 215 Euston Road, London, NW1 2BE.
>
> _______________________________________________
> Biopython mailing list  -  Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython


More information about the Biopython mailing list