Skip to main content

Earth Hologenome Initiative Toolkit

Project description

EHItk logo

CI Python

The Earth Hologenome Initiative ToolKit (EHItk) is a command-line tool for finding, summarising and downloading data from EHI specimens, hologenomes and MAGs.

It is designed for two common workflows:

  • find datasets by metadata
  • download matching shotgun sequencing datasets and MAG FASTA files

Features

  • Query hologenomes by host metadata, sample type, biome, and release
  • Query hologenomes by host metadata, geography, specimen measurements, sample type, biome, and release
  • Query MAGs by taxonomy, parent hologenome, release, derived quality class, host taxonomy, geography, and specimen measurements
  • Query specimens directly, including specimen measurement ranges
  • Quantify available hologenome data volume (GB) in overview and stats outputs
  • Use friendly filters or an advanced --where SQL predicate
  • Download paired hologenome reads and MAG FASTA files
  • Show Rich progress bars with filename, progress, speed, and size
  • Append every fetch outcome to manifest.jsonl

Installation

EHItk requires Python 3.10 or newer.

Install from PyPI:

pip install ehitk

Install the latest development version from GitHub:

pip install git+https://github.com/earthhologenome/ehitk

Show the top-level help:

ehitk --help

Show the installed version:

ehitk --version

Use a specific SQLite database file:

ehitk --db /path/to/ehitk.sqlite --help
ehitk hologenomes query --db /path/to/ehitk.sqlite --limit 5

By default, EHItk uses the bundled SQLite catalog that ships with the installed package version. This means package updates also update the default catalog unless you explicitly override it with --db.

Command Structure

[ehitk]
├─ * specimens *
│  ├─ query
│  ├─ values
│  └─ stats
├─ * hologenomes *
│  ├─ query
│  ├─ values
│  ├─ stats
│  └─ fetch
└─ * mags *
   ├─ query
   ├─ values
   ├─ stats
   └─ fetch

Quick Start

Query specimens:

ehitk specimens query --host-species "Podarcis muralis" --limit 5

Explore specimen filter values:

ehitk specimens values --field host_species --limit 10

Query hologenomes:

ehitk hologenomes query --host-species "Podarcis muralis" --limit 5

Explore hologenome values:

ehitk hologenomes values --field country --limit 10
ehitk hologenomes values --field data --limit 10

Query MAGs:

ehitk mags query --genus Escherichia --limit 5

Explore MAG values:

ehitk mags values --field genus --limit 10

Summarize MAGs:

ehitk mags stats --quality high --species "Escherichia coli"

Fetch one hologenome:

ehitk hologenomes fetch --host-lineage Reptilia --limit 1

Write a hologenome batch download script instead of downloading immediately:

ehitk hologenomes fetch --host-lineage Reptilia --limit 1 --batch hologenomes.sh

Fetch one MAG:

ehitk mags fetch --species "Escherichia coli" --limit 1

Write a MAG batch download script instead of downloading immediately:

ehitk mags fetch --species "Escherichia coli" --limit 1 --batch mags.sh

Querying Hologenomes

Supported hologenome filters:

  • --hologenome-id
  • --host-taxid
  • --host-species
  • --host-lineage
  • --sample-type
  • --biome
  • --country
  • --data-min
  • --data-max
  • --latitude-min
  • --latitude-max
  • --longitude-min
  • --longitude-max
  • --weight-min
  • --weight-max
  • --length-min
  • --length-max
  • --release
  • --columns
  • --where
  • --limit

Examples:

ehitk hologenomes query --hologenome-id EHI00001
ehitk hologenomes query --host-taxid 64176
ehitk hologenomes query --host-species "Podarcis muralis"
ehitk hologenomes query --host-lineage Reptilia
ehitk hologenomes query --sample-type Faecal --biome "1000221 - Temperate woodland"
ehitk hologenomes query --data-min 5 --data-max 25
ehitk hologenomes query --country Italy --latitude-min 42.7 --latitude-max 42.8
ehitk hologenomes query --weight-min 3.0 --weight-max 6.0 --length-min 55 --length-max 65
ehitk hologenomes query --hologenome-id EHI00001,EHI00002

Most exact-match filters accept comma-separated values. For example, --hologenome-id EHI00001,EHI00002 or --host-species "Homo sapiens,Mus musculus" matches any of the listed values.

--host-lineage matches exactly against:

  • host_species
  • host_genus
  • host_family
  • host_order
  • host_class

Hologenome summary statistics:

ehitk hologenomes stats --host-species "Podarcis muralis"

Hologenome and MAG statistics include available hologenome data totals in gigabases (GB).

Hologenome value summaries:

ehitk hologenomes values --field host_species
ehitk hologenomes values --field country --limit 20

Querying MAGs

Supported MAG filters:

  • --mag-id
  • --quality
  • --genus
  • --species
  • --host-taxid
  • --host-species
  • --host-lineage
  • --country
  • --release
  • --hologenome-id
  • --latitude-min
  • --latitude-max
  • --longitude-min
  • --longitude-max
  • --weight-min
  • --weight-max
  • --length-min
  • --length-max
  • --columns
  • --where
  • --limit

Examples:

ehitk mags query --quality high
ehitk mags query --quality high,medium
ehitk mags query --mag-id EHM00001
ehitk mags query --genus Escherichia
ehitk mags query --species "Escherichia coli"
ehitk mags query --host-species "Sciurus carolinensis"
ehitk mags query --hologenome-id EHI00392
ehitk mags query --country Italy --weight-min 630 --weight-max 690
ehitk mags query --mag-id EHM00001,EHM00002

MAG taxonomy values in the catalog may use GTDB-style prefixes such as g__ and s__. EHItk normalizes those during filtering and display, so --genus Escherichia matches g__Escherichia.

Derived MAG quality classes are defined as:

  • high: completeness >= 90 and contamination <= 5
  • medium: completeness >= 50 and contamination <= 10
  • low: everything else

MAG summary statistics:

ehitk mags stats --quality high --species "Escherichia coli"
ehitk mags stats --host-species "Sciurus carolinensis"

MAG value summaries:

ehitk mags values --field genus
ehitk mags values --field quality

Querying Specimens

Supported specimen filters:

  • --specimen-id
  • --host-taxid
  • --host-species
  • --host-lineage
  • --sex
  • --weight-min
  • --weight-max
  • --length-min
  • --length-max
  • --columns
  • --where
  • --limit

Examples:

ehitk specimens query --specimen-id SD00508
ehitk specimens query --host-species "Podarcis muralis"
ehitk specimens query --host-lineage Mammalia --sex Female
ehitk specimens query --weight-min 8 --weight-max 9 --length-min 40 --length-max 41

For weight and length, the catalog may store multiple recorded values per specimen. Range filters match when any recorded value falls within the requested interval.

Specimen summary statistics:

ehitk specimens stats --host-lineage Reptilia

Specimen value summaries:

ehitk specimens values --field host_order
ehitk specimens values --field sex --csv specimen-sex-values.csv

values prints distinct values with counts for a chosen field after applying any other filters. For MAGs, --field genus, --field species, and --field quality are supported aliases.

Controlling Query Columns

All query commands support --columns:

  • --columns default: use the configured default columns for that command
  • --columns all: include every available column in the query target
  • --columns url: use the URL-focused preset for hologenomes and mags
  • --columns a,b,c: include only the named columns

These examples are equivalent:

ehitk hologenomes query --host-species "Podarcis muralis"
ehitk hologenomes query --host-species "Podarcis muralis" --columns default

Examples:

ehitk specimens query --columns specimen_id,host_species,sex --csv specimens.csv
ehitk hologenomes query --columns url --csv hologenome_urls.csv
ehitk mags query --columns all --limit 1
ehitk mags query --columns url --tsv mag_urls.tsv
ehitk mags query --columns mag_id,host_species,mag_genus --limit 5

Column presets are configured in src/ehitk/data/custom_columns.json.

The default hologenome preset includes the data column so dataset size is visible without requesting extra columns.

The default MAG preset includes the derived quality column, and --columns all includes quality as well.

The url preset is only available for:

  • hologenomes
  • mags

It is not available for specimens.

Advanced SQL Filtering

Power users can add an extra SQL predicate with --where.

Examples:

ehitk mags query --where "completeness >= 90 AND contamination <= 5"
ehitk hologenomes query --where "latitude > 40 AND longitude < 10"
ehitk specimens query --where "weight IS NOT NULL"

The --where string is appended to the generated SQL query after validation.

For safety, EHItk rejects predicates containing:

  • ;
  • DROP
  • DELETE
  • INSERT
  • UPDATE
  • ALTER
  • ATTACH
  • PRAGMA
  • SQL comment markers such as -- and /* ... */

Fetching Data

Hologenomes

ehitk hologenomes fetch downloads paired-end reads from url1 and url2.

  • records with missing read URLs are skipped
  • files are written under downloads/hologenomes/<hologenome_id>/

Example:

ehitk hologenomes fetch --host-species "Podarcis muralis" --limit 1

MAGs

ehitk mags fetch downloads the MAG FASTA from url.

  • files are written under downloads/mags/<mag_id>/
  • MAG selection can include host taxonomy filters because host metadata is resolved through specimens

Example:

ehitk mags fetch --host-lineage Mammalia --quality high --limit 3

Output Options

Both fetch commands support:

  • --output-dir PATH
  • --batch PATH
  • --manifest-path PATH
  • --accept-terms
  • --overwrite
  • --limit

Examples:

ehitk mags fetch --genus Escherichia --limit 2 --output-dir results
ehitk hologenomes fetch --release EHR01 --limit 1 --overwrite
ehitk mags fetch --quality high --limit 10 --batch mags-downloads.sh

When --batch is used, EHItk writes an executable shell script with curl commands and does not download files or append manifest entries at generation time.

Before any fetch operation, EHItk displays the EHI data usage terms and asks for confirmation. Use --accept-terms to suppress the prompt once you have read and accepted the terms.

Download Manifest

Every fetch attempt appends a JSON object to manifest.jsonl.

Typical fields:

{
  "timestamp": "2026-03-06T15:49:23.422576Z",
  "type": "hologenome",
  "hologenome_id": "EHI00366",
  "url": null,
  "path": null,
  "checksum": null,
  "status": "missing_url"
}

The identifier field is entity-specific:

  • hologenome entries use hologenome_id
  • MAG entries use mag_id

Possible statuses include:

  • downloaded
  • skipped_existing
  • missing_url
  • failed

Checksums are SHA-256 digests of the downloaded local file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ehitk-1.0.5.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ehitk-1.0.5-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file ehitk-1.0.5.tar.gz.

File metadata

  • Download URL: ehitk-1.0.5.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ehitk-1.0.5.tar.gz
Algorithm Hash digest
SHA256 dcc951e876e80837ae6bb022edc4896196973dacfd3137d6396103244499b4e8
MD5 09f9e433ff62df814e148508ffb9cb53
BLAKE2b-256 c7bad8f8c00f7661ff308d6d26dfb32a8ddd71448993791d05eb4c94adc3a798

See more details on using hashes here.

Provenance

The following attestation bundles were made for ehitk-1.0.5.tar.gz:

Publisher: release.yml on earthhologenome/ehitk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ehitk-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: ehitk-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ehitk-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0fe22ce8eea1871baf31d8b88ddd56728760348df1c16a8a44f34e92cc397b22
MD5 d35a3dab0320ad15a2b2d75ce7a50e1f
BLAKE2b-256 3ca19f61ff0dce72e17c396876ff3511cb59cd6b39b749c1d34ed348f3629fb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ehitk-1.0.5-py3-none-any.whl:

Publisher: release.yml on earthhologenome/ehitk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page