Skip to content

blobtk depth

Richard Challis edited this page Dec 22, 2023 · 5 revisions

Calculate sequencing coverage depth

Command line

Calculate sequencing coverage depth. Called as `blobtk depth`

Usage: blobtk depth [OPTIONS]

Options:
  -i, --list <TXT>           Path to input file containing a list of sequence IDs
  -b, --bam <BAM>            Path to BAM file
  -c, --cram <CRAM>          Path to CRAM file
  -a, --fasta <FASTA>        Path to assembly FASTA input file (required for CRAM)
  -s, --bin-size <BIN_SIZE>  Bin size for coverage calculations (use 0 for full contig length) [default: 0]
  -O, --bed <BED>            Output bed file name
  -h, --help                 Print help

Examples

blobtk depth -b test/test.bam -O test/test.bed
blobtk depth -b test/test.bam -s 1000 -O test/test.1000.bed

Python module

from blobtk import depth

Examples

Generate a bed file of coverage depths

depth.bam_to_bed(bam="test/test.bam", bed="test/pytest.bed")
depth.bam_to_bed(bam="test/test.bam", bin_size=1000, bed="test/pytest.1000.bed")

Read coverage data

binned_covs = depth.bam_to_depth(bam="test/test.bam")
for cov in binned_covs:
    print({cov.seq_name: cov.bins[0]})
Clone this wiki locally