grelu.io.bigwig#

Functions related to reading and writing bigWig files

Functions#

check_bigwig(→ bool)

Check if a given path is a valid bigWig file.

read_bigwig(→ numpy.ndarray)

Read coverage values from a bigwig file

Module Contents#

grelu.io.bigwig.check_bigwig(bw_file: str) bool[source]#

Check if a given path is a valid bigWig file.

Parameters:

bw_file – Path to a bigWig file

Returns:

True if the input is a valid bigWig file, False otherwise.

grelu.io.bigwig.read_bigwig(intervals: pandas.DataFrame, bw_files: str | List[str], bin_size: int | None = None, aggfunc: str | Callable | None = None) numpy.ndarray[source]#

Read coverage values from a bigwig file

Parameters:
  • intervals – A dataframe containing genomic intervals

  • bw_file – Path to a bigWig file, or a list of paths

  • bin_size – Number of consecutive bases to aggregate. If not supplied, it is assumed to be the full sequence length.

  • aggfunc – A function or name of a function to aggregate coverage values over bin_size. Accepted names are “sum”, “mean”, “max” or “min”. If None, no aggragation will be performed.

Returns:

Numpy array of shape (B, T, L) containing coverage values