plastid.readers.wiggle module

A single reader for fixedStep wiggle, variableStep wiggle, and bedGraph files. WiggleReader is seldom called directly. Typically it is internally called by GenomeArray and SparseGenomeArray, when their add_from_wiggle() methods are called.

See also

UCSC file format FAQ
UCSC Wiggle and bedGraph file specification
GenomeArray and SparseGenomeArray
Array-like objects that store and index quantitative data over genomes
class plastid.readers.wiggle.WiggleReader(fh)[source]

Bases: object

Read wiggle and bedGraph files line-by-line, returning tuples of (chromosome, start position, stop position, value). Tuple coordinates are zero-indexed and half-open, regardless of whether the file is a wiggle or bedGraph.

See the UCSC file format FAQ for details.

fh : file-like

Open filehandle pointing to wiggle or bedGraph data


next() Yield a tuple of (chromosome, start, stop, value) for each data line.

Yield a tuple of (chromosome, start, stop, value) for each data line. Header lines are processed internally and not exposed to the user.

All coordinates are returned as 0-based, half-open intervals, following Python conventions.


chromosome name


start position, 0-indexed


end position, 0-indexed, half-open


value on chromosome between start and end