Skip to main content

ChromoRetriever

PyPI DOI Socket Downloads License: MIT

ChromoRetriever is a lightweight Python library and CLI for retrieving chromosome-level sequence metadata from the NCBI Datasets API and exporting it to CSV or TSV. It is designed for bioinformatics workflows that need a simple way to pull chromosome tables for one or many genome assemblies.

Features

  • Retrieve chromosome-level sequence reports from NCBI Datasets
  • Support single-accession and batch workflows
  • Export to CSV or TSV
  • Filter out unplaced assembled sequences by default
  • Preserve clean chromosome ordering for common naming conventions
  • Use as either a Python library or a command-line tool

Installation

From a local checkout

pip install .

Development install

pip install -e .[dev]

Command-line usage

Single accession

chromoretriever GCF_000001735.4

This writes GCF_000001735.4_chromosomes.csv in the current directory.

Batch mode

chromoretriever --file examples/genomes.txt --output chromosomes.csv

Include unplaced assembled sequences

chromoretriever GCF_000001735.4 --include-unplaced

Export as TSV

chromoretriever GCF_000001735.4 --format tsv

Exclude columns

chromoretriever GCF_000001735.4 --exclude-col refseq "gc_content_percent"

Python usage

from chromoretriever import NCBIDatasetsClient, export_records

client = NCBIDatasetsClient()
result = client.fetch_chromosome_table("GCF_000001735.4")

print(result.organism_name)
print(len(result.records))

export_records(result.records, "arabidopsis.csv")

Batch processing from Python

from chromoretriever import process_genome_ids

results = process_genome_ids(
    genome_ids=["GCF_000001735.4", "GCF_009914755.1"],
    output_path="chromosomes.tsv",
    fmt="tsv",
)

for result in results:
    print(result.genome_id, result.organism_name, len(result.records))

Output columns

  • genome_id
  • taxon
  • hromosome
  • genbank
  • refseq
  • size_bp
  • gc_content_percent

Project structure

ChromoRetriever/
├── src/chromoretriever/
│   ├── __init__.py
│   ├── api.py
│   ├── cli.py
│   ├── export.py
│   ├── models.py
│   └── utils.py
├── tests/
├── examples/
├── pyproject.toml
└── README.md

API notes

The current implementation uses these NCBI Datasets endpoints:

  • /genome/accession/{accession}/sequence_reports
  • /genome/accession/{accession}/dataset_report

If NCBI changes the API contract, the client may need to be adjusted.

Development

Run tests:

pytest

Build distributions:

python -m build

License

MIT License. See LICENSE.

Metadata

Release files for ChromoRetriever 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ChromoRetriever 0.1.2
File Size Uploaded
chromoretriever-0.1.2.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ChromoRetriever 0.1.2
File Interpreter ABI Platform
chromoretriever-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / chromoretriever-0.1.2.tar.gz

Download URL chromoretriever-0.1.2.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b58b93b9ead611438fc512522cec225bf152ff21183225323703908660257f63
BLAKE2b-256 checksum
How to use checksums
3fee17c80afdacd690839feb6fc050e866f0b9541fcab42160a7c6f4abda8c53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / chromoretriever-0.1.2-py3-none-any.whl

Download URL chromoretriever-0.1.2-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
926bd7013234994b427ba1d1ae2eba796f2d11dd3aeacad8f676c5d597241a46
BLAKE2b-256 checksum
How to use checksums
89edacd95e9fb2f69cb6908191f7d2c9c855502d9d3bcfc9ad525c4c534b2961
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page