BigWig Counter¶
Function that uses pyBigWig to get the average bigwig signal in regions from a bed-file from one or multiple bigwig files.
- BigWig_Counter.bigwig_counts(bed_file, bigwigs, n_cores=1)¶
For a bed file or BedTool object gets the mean signal for each bigwig file. If pyBigWig can’t retrieve a count it will be set to 0, and the region listed in the error list.
- Parameters:
bed_file – Either a BedTools object or a path to a bed-file.
bigwigs – List/dict of bigwigs for which pyBigWig will be used to extract the mean signal for. If a list of files is given, the column in the resulting DataFrame will have the full file path. If a dict {key: file} is given, the columns will be the keys.
- Returns:
region_counts: Will give a dataframe of the bed-file’s regions with a column for each bigwig file and the file name as column.
errors: Dictionary with an entry for each biwgig file holding a DataFrame with the regions that are also part of the bed_regions but failed due to not returning a count or throwing an error of invalid interval bounds. Those have a count of 0. Note, the errors are rather unreliable, the behaviour of the pyBigWig is a bit elusive.
- Return type:
*Bigwig_Counter*