MACS3.IO.BedGraphIO module

Utilities for reading and writing MACS3 bedGraph files.

This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file LICENSE included with the distribution).

class MACS3.IO.BedGraphIO.bedGraphIO

Bases: object

Helper for loading and writing bedGraph tracks.

read_bedGraph(baseline_value=0.0)

Load bedGraph intervals into the internal bedGraphTrackI.

Parameters:

baseline_value (cython.double) – Value used to fill gaps between defined intervals.

Returns:

Populated track instance.

Return type:

bedGraphTrackI

Example

from MACS3.IO.BedGraphIO import bedGraphIO
bio = bedGraphIO("signal.bdg")
track = bio.read_bedGraph(baseline_value=0)
write_bedGraph(name='', description='', trackline=True)

Persist the current track to self.bedGraph_filename.

Parameters:
  • name (str) – Track name used in the optional header line.

  • description (str) – Track description used in the optional header line.

  • trackline (bool) – Whether to emit a UCSC track header.

Examples

from MACS3.IO.BedGraphIO import bedGraphIO
bio = bedGraphIO("signal_out.bdg")
bio.write_bedGraph(name="Example", description="Demo track")