NanoFetch
Extract gene regions from BAM and CRAM files, offline.
NanoFetch turns gene symbols into genomic intervals and extracts overlapping alignments, with configurable padding. It bundles versioned annotations for GRCh37, GRCh38, and T2T-CHM13v2.0 and detects the assembly from chromosome lengths. No annotation downloads are needed at runtime.
Install
Requires Python 3.9 or newer.
python -m pip install nanofetch
For an isolated command-line installation, use pipx install nanofetch.
pysam is the only runtime dependency; a separate samtools installation is
not required. For development, see Contributing.
Quick start
Use your own coordinate-sorted, indexed BAM or CRAM file:
nanofetch tumor.bam EGFR --index
This writes EGFR.bam and EGFR.bam.bai in the current directory and reports
the detected assembly, annotation version, and number of extracted alignments.
Preview the region and check output conflicts with nanofetch tumor.bam EGFR --dry-run.
| Default | Behavior |
|---|---|
| Region | Gene interval plus 1 Mb on each side; use --padding 0 for the gene alone |
| Records | Overlapping alignments; secondary and supplementary records excluded |
| Output | One BAM per gene in the current directory |
| Indexing | Opt in with --index |
| Existing files | Protected unless --force is supplied |
Common workflows
One gene, with output in a sample directory:
nanofetch tumor.bam EGFR --output-dir results/tumor --index
A panel, with one BAM per gene:
nanofetch tumor.bam --panel cns --output-dir results/tumor-cns --index
One combined BAM, with overlapping regions deduplicated:
nanofetch tumor.bam EGFR CDK4 PDGFRA --combined results/tumor-panel.bam --index
--output-dir applies only to per-gene BAMs and their indexes. For a combined
BAM or reports, provide the full desired path, such as
--manifest results/tumor/regions.tsv. Relative paths start in your current
working directory. See output locations.
Coverage overview
Extract a gene and create a self-contained SVG plot:
nanofetch tumor.bam EGFR --output-dir results/egfr-qc --index \
--plot results/egfr-qc/coverage.svg
The plot marks the gene body and shows the bin size. Mean depth includes the padded region; maximum depth is a bin average.
Documentation and support
- Usage guide: custom panels, CRAM references, BED export, coverage summaries, manifests, and alignment selection.
- Troubleshooting: installation, indexes, assembly detection, gene names, and empty outputs.
- Annotation provenance: pinned sources and checksums.
- Changelog and contribution guide.
- Report a bug or request a feature.
Run nanofetch --help for all options or nanofetch --list-panels for installed
panel names and descriptions. The built-in CNS panel is a convenience set, not
a validated clinical assay.
NanoFetch extracts overlapping alignments. It does not retrieve distant mates or every segment of a read, accept custom GTF annotations, or write CRAM output.
License
MIT. T2T consortium data are released under CC0; see the upstream CHM13 data reuse policy.
Metadata
Release files for nanofetch 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nanofetch-0.3.1.tar.gz | 4.2 MB | With provenance | Details for nanofetch-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nanofetch-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for nanofetch-0.3.1-py3-none-any.whl |
Total release size: 8.5 MB
Release files / nanofetch-0.3.1.tar.gz
| Download URL | nanofetch-0.3.1.tar.gz |
|---|---|
| Size | 4.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7b31efaab49b09d292784b1e97d9a53e9ff796138779c23dfacdca9c9a1b458
|
|
BLAKE2b-256 checksum How to use checksums |
fa58d478af4c62bef6363567cfefbd598b18e767329d1d3fa87387397526a401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / nanofetch-0.3.1-py3-none-any.whl
| Download URL | nanofetch-0.3.1-py3-none-any.whl |
|---|---|
| Size | 4.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44a6a8dba469fb30eea36b7b0c41df3e638609ba61d3f52d91c155dc22671b66
|
|
BLAKE2b-256 checksum How to use checksums |
1c4ce7f448f235454887d2ac1f72bcbbabeaffeae7657ff5b391b54aa21da749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logSecurity for nanofetch 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for nanofetch-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.