Targeted sequencing coverage reporter with CLI and HTML outputs.
Project description
CoverageLens
Targeted sequencing coverage reporter that turns a BAM/CRAM and a BED of target regions into a concise HTML dashboard plus optional TSV/JSON exports.
Features
- Per-region coverage metrics: mean, min, max depth and percent of bases ≥ configurable thresholds.
- PASS/FAIL call per region based on primary threshold and breadth requirement.
- Summary stats: fraction of targets meeting coverage requirements and overall mean depth.
- Static HTML report with interactive charts and a searchable table (filter by gene/region).
- Optional TSV and JSON exports for downstream QC pipelines.
- CRAM support (with external reference) and configurable BED column mappings.
Installation
pip install coveragelens
Or from source:
python -m venv .venv && source .venv/bin/activate
pip install -e .
Quick start
# Generate HTML report
coveragelens sample.bam targets.bed \
--threshold 10 --threshold 20 --threshold 50 \
--html-output coverage_report.html
Open coverage_report.html in your browser to explore summary metrics, charts, and a searchable table by gene or region name.
CLI
coveragelens BAM_OR_CRAM BED \
[--threshold 10 --threshold 20 ...] \
[--primary-threshold 20] \
[--breadth-requirement 0.95] \
[--gene-column 3 --name-column 3] \
[--config config.yaml] \
[--reference reference.fa] \
[--chunk-size 50000] \
[--html-output report.html] \
[--json-output metrics.json] \
[--tsv-output metrics.tsv]
- Coverage breadth is reported as the percent of bases in a region meeting each threshold.
- Regions are considered passing if breadth at the primary threshold is at least the breadth requirement (default 95%); this is shown as a PASS/FAIL pill per region and summarized in the donut chart.
- JSON output includes both per-region metrics and a summary block with
regions_meeting,regions_failing, andfraction_meeting. - Provide
--referencewhen reading CRAM files that do not embed reference sequences.
Example commands
- Panel with typical thresholds:
coveragelens tumor.bam panel.bed \ --threshold 10 20 50 \ --primary-threshold 20 \ --breadth-requirement 0.95 \ --html-output tumor_panel_coverage.html
- CRAM with external reference and JSON export:
coveragelens sample.cram exome_targets.bed \ --reference GRCh38.fa \ --threshold 20 50 \ --json-output sample_coverage.json
Testing
python -m venv .venv && source .venv/bin/activate
pip install -e .[dev]
pytest
Config file
YAML/JSON config to set defaults:
thresholds: [10, 20, 50]
primary_threshold: 20 # default uses the highest threshold
breadth_requirement: 0.95 # fraction of bases
chunk_size: 50000 # bases per count_coverage call
bed_delimiter: "\t"
bed_columns:
chrom: 0
start: 1
end: 2
name: 3
gene: 3
sample_name: "Patient_01"
JSON output schema (high level)
{
"summary": {
"total_regions": 1234,
"primary_threshold": 20,
"breadth_requirement": 0.95,
"regions_meeting": 1200,
"regions_failing": 34,
"fraction_meeting": 0.972,
"mean_depth_overall": 142.3,
"sample_name": "Patient_01"
},
"regions": [
{
"chrom": "chr1",
"start": 100000,
"end": 100150,
"length": 150,
"name": "EXON1",
"gene": "GENE1",
"mean_depth": 135.2,
"min_depth": 52,
"max_depth": 212,
"status": "PASS",
"pct_ge_10": 100.0,
"pct_ge_20": 100.0,
"pct_ge_50": 97.3
}
]
}
Notes
- Coverage is computed with
pysam.count_coveragein chunks to handle large panels efficiently. - BED parsing is tolerant of comments/blank lines and lets you remap gene/region columns via CLI flags or config.
- The HTML report is fully static; no server is required.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coveragelens-0.1.0.tar.gz.
File metadata
- Download URL: coveragelens-0.1.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c3cfd7af46646ce333de3d532e96823532d742bc91b4f18e93a553682b11280
|
|
| MD5 |
d8803cb1a452d0c78fb8f26f35dc130d
|
|
| BLAKE2b-256 |
7023de2ca91337aa1fa73c3baa3c8300b376b5aa182229dfb49473ebae7a024c
|
Provenance
The following attestation bundles were made for coveragelens-0.1.0.tar.gz:
Publisher:
publish.yml on omniscoder/CoverageLens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coveragelens-0.1.0.tar.gz -
Subject digest:
5c3cfd7af46646ce333de3d532e96823532d742bc91b4f18e93a553682b11280 - Sigstore transparency entry: 731263271
- Sigstore integration time:
-
Permalink:
omniscoder/CoverageLens@f6ac5666d173f55e043d6dd024be2e24c8473040 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/omniscoder
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6ac5666d173f55e043d6dd024be2e24c8473040 -
Trigger Event:
push
-
Statement type:
File details
Details for the file coveragelens-0.1.0-py3-none-any.whl.
File metadata
- Download URL: coveragelens-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b2c048c7a4340e929bbecc95f09bfe2624c53092045c4d2899076d19a66abef
|
|
| MD5 |
9f03fcbe46f1c80240fc266c4bf21bd7
|
|
| BLAKE2b-256 |
0d783f5a80dd404285f1904852277b07c80a281b6d25f79adbbd08eb5aafbb02
|
Provenance
The following attestation bundles were made for coveragelens-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on omniscoder/CoverageLens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coveragelens-0.1.0-py3-none-any.whl -
Subject digest:
5b2c048c7a4340e929bbecc95f09bfe2624c53092045c4d2899076d19a66abef - Sigstore transparency entry: 731263274
- Sigstore integration time:
-
Permalink:
omniscoder/CoverageLens@f6ac5666d173f55e043d6dd024be2e24c8473040 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/omniscoder
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6ac5666d173f55e043d6dd024be2e24c8473040 -
Trigger Event:
push
-
Statement type: