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.

Parameters
fhfile-like

Open filehandle pointing to wiggle or bedGraph data

Methods

next()

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

next()[source]

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.

Returns
str

chromosome name

int

start position, 0-indexed

int

end position, 0-indexed, half-open

float

value on chromosome between start and end