Genomic Coverages

Genomic Coverages Modules

These modules contain functions and classes for working with genomic coverages. It provides utilities for handling and extracting genomic coverages from BigWig or BAM files.

class genomkit.coverages.gcoverages.GCoverages(bin_size: int = 1, load: str = '', windows=None)

GCoverages module

This module contains functions and classes for working with a collection of genomic coverages. It provides utilities for handling and analyzing the interactions of many genomic coverages.

calculate_coverage_GRegions(scores, windows=None, strandness: bool = False)

Calculate the coverage from two GRegions. windows defines the loci for the coverage scores contains the scores loaded into the coverage.

Parameters:
  • windows (GRegions) – Define the windows and the length of the coverage

  • scores (GRegions) – Provide the scores for calculating the coverage

  • strandness (bool, optional) – Make this operation strandness specific, defaults to False

calculate_coverage_GRegions2(scores, windows=None, strandness: bool = False)

Calculate the coverage from two GRegions. windows defines the loci for the coverage scores contains the scores loaded into the coverage.

Parameters:
  • windows (GRegions) – Define the windows and the length of the coverage

  • scores (GRegions) – Provide the scores for calculating the coverage

  • strandness (bool, optional) – Make this operation strandness specific, defaults to False

calculate_coverage_from_bam(filename: str, windows=None)

Calculate coverage from a BAM file.

Parameters:
  • filename (str) – Path to the BAM file.

  • windows (GRegions) – GRegions for extracting the coverage profile

filter_regions_coverage(regions)

Filter regions for their coverages.

Parameters:

regions (GRegions) – GRegions object containing regions.

Returns:

Dictionary where keys are region objects and values are coverage lists.

Return type:

dict

flip_negative_regions()

Flip the coverage arrays which are on the negative strands. If the coverage arrays are calculated by the whole chromosomes, it won’t work.

get_coverage(gregion: str)

Get coverage data for a specific sequence by name. This sequence can be a chromosome or a genomic region.

Parameters:

seq_name (str) – sequence name.

Returns:

Coverage data for the specified sequence.

Return type:

numpy array

get_dataframe()

Return a pandas dataframe concatenating all coverage arrays.

load_coverage_from_bigwig(filename: str, windows=None)

Load coverage data from a bigwig file.

Parameters:
  • filename (str) – Path to the bigwig file.

  • windows (GRegions) – GRegions for extracting the coverage profile

scale_coverage(coefficient)

Scale the coverages by a coefficient.

Parameters:

coefficient (float) – Coefficient to scale the coverages.

total_sequencing_depth()

Calculate the total sequencing depth.

Returns:

Total sequencing depth.

Return type:

float