lib5c.util.bedgraph module¶
Module containing utilities for manipulating bedgraph files.
-
lib5c.util.bedgraph.in_boundaries(peak, chrom, boundaries)[source]¶ Checks to see if a given feature on a given chromosome is within the boundaries.
- Parameters
peak (dict) –
The feature to check. This dict should have the following structure:
{ 'start': int, 'end': int }
See lib5c.parsers.bed.load_features().
chrom (str) – The chromosome this feature is on.
boundaries (dict of dicts) –
Information about the region boundaries. The outer keys are region names as strings. The values are dicts describing the boundaries of that region with the following structure:
{ 'chrom': str, 'start': int, 'end': int }
- Returns
True if the feature is in one of the regions, False otherwise.
- Return type
bool
-
lib5c.util.bedgraph.reduce_bedgraph(bedfile, pixelmap)[source]¶ Reduces a bedgraph file by excluding peaks that fall outside of the regions described by a pixelmap.
- Parameters
bedfile (str) – String reference to the bedgraph file to reduce.
pixelmap (dict of lists of dicts) –
The keys of the outer dict are region names. The values are lists, where the
ith entry represents theith bin in that region. Bins are represented as dicts with at least the following structure:{ 'chrom': string, 'start': int, 'end' : int }
See
lib5c.parsers.primers.get_pixelmap().
- Returns
The keys are chromosome names. The values are lists of peaks for that chromosome. The peaks are represented as dicts with at least the following keys:
{ 'start': int, 'end' : int }
- Return type
dict of lists of dicts