Skip to main content

Easily configure and run a pipeline to build a tree of virus genomes using UShER

Project description

viral_usher

viral_usher is a command-line tool to set up and run a pipeline to build an UShER tree for a new viral species (or type, subtype, etc.) using genomes downloaded from NCBI.


🔧 Features

  • Subcommands:
    • init: Generate a config file (interactive or via command line options)
    • build: Download sequences and build a tree, guided by the config file
  • Uses Docker for portability to laptops, servers, or cloud platforms

📦 Installation

  1. Install prerequisites (if not already installed)
  1. Install with pip (again, we highly recommended using an environment manager):
    pip install viral_usher
    

🚀 Quickstart

Create a config file with viral_usher init

If you want to start by just naming a virus, and let viral_usher interactively help you identify the right reference sequence, Taxonomy ID etc., then simply run

viral_usher init

and reply to the prompts.

Alternatively, if you already know your parameters, then you can skip the interactive stuff by passing in command line options. Run viral_usher --help to get a listing of options. Here is an example that builds a tree for the Chikungunya virus using RefSeq NC_004162.2, all genomes available from GenBank for the Taxonomy ID associated with NC_004162.2 (Taxonomy ID 37124), plus additional sequences from example/hypothetical_chikungunya.fasta (in this repository):

git clone https://github.com/AngieHinrichs/viral_usher.git
cd viral_usher
viral_usher init \
    --refseq NC_004162.2 \
    --workdir chikungunya \
    --fasta example/hypothetical_chikungunya.fasta \
    --config chikungunya/config.toml

Build a tree using config file with viral_usher build:

Continuing the Chikungunya virus example:

viral_usher build --config chikungunya/config.toml

That's all! viral_usher will create the following files in workdir (chikungunya in our example):

  • a tree in UShER protobuf format (optimized.pb.gz)
  • a metadata file in TSV format (metadata.tsv.gz)
  • a Taxonium tree file that you can view using https://taxonium.org/ (tree.jsonl.gz)

To view the example Chikungunya virus tree in Taxonium, click here. Type or copy-paste "hypothetical" into Taxonium's Name search input to find the sequences from example/hypothetical_chikungunya.fasta.


🛠️ Troubleshooting

MacOS Docker virtualization framework settings

If your viral_usher build ... command fails on MacOS with this error message:

usher-sampled failed, see usher-sampled.err.log
Failed command: usher-sampled -A -e 5 -t empty_tree.nwk -v msa.vcf.gz -o usher_sampled.pb.gz --optimization_radius 0 --batch_size_per_process 100
docker container angiehinrichs/viral_usher:v0.9.0 failed with exit code 1

and the file usher-sampled.err.log ends with this error:

assertion failed [rem_idx != -1]: Unable to find existing allocation for shared memory segment to unmap

then your Docker virtualization settings might need to be changed. In the Docker app, click on the settings icon (gear), select the "General" category in the left column, and scroll down to the Virtual Machine Options section. Under "Choose Virtual Machine Manager (VMM)", change the selection from "Apple Virtualization Framework" to "Docker VMM". Then try running your viral_usher build ... command again. For more on this topic see issue #24 .


🧪 Development

# Clone the repo
git clone https://github.com/AngieHinrichs/viral_usher.git
cd viral_usher

# Install dev dependencies
pip install -e .[dev]

# Run tests
pytest

# Run build with a locally modified docker image
docker build --platform linux/amd64 -t viral_usher_test . \
    && viral_usher build --docker_image viral_usher_test --config path/to/config.toml

# Get a shell in the locally modified docker image to try out different commands
docker run --platform linux/amd64 --rm -it -u $(id -u):$(id -g) --net=host \
    -v $(pwd):/data \
    viral_usher_test

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

viral_usher-0.10.1.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

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

viral_usher-0.10.1-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file viral_usher-0.10.1.tar.gz.

File metadata

  • Download URL: viral_usher-0.10.1.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for viral_usher-0.10.1.tar.gz
Algorithm Hash digest
SHA256 12680e5b5756fd1b4e2de3adaf184b293c71697c61227d35ca13ccf6aca80171
MD5 39ae8a81eb79314512e0fbade8e3bd78
BLAKE2b-256 58761839e73738e05a14bfaf48205bad1a6b24e4242b5e724ed14cd44c82b601

See more details on using hashes here.

Provenance

The following attestation bundles were made for viral_usher-0.10.1.tar.gz:

Publisher: python-publish.yml on AngieHinrichs/viral_usher

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

File details

Details for the file viral_usher-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: viral_usher-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for viral_usher-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e88480192cd69a6ae89d9bce98e71b59ef577e11c4c064454bd74119ec44ad7f
MD5 71f3d351c3caa13ac15e6830fe06d934
BLAKE2b-256 0865834588a4645fa650428e3666e95cc25af3afec3c08f30663cd43e0b05249

See more details on using hashes here.

Provenance

The following attestation bundles were made for viral_usher-0.10.1-py3-none-any.whl:

Publisher: python-publish.yml on AngieHinrichs/viral_usher

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