No sections match your search.
Aviary
Comprehensive Snakemake-based metagenomics pipeline: assembly β binning β annotation β dereplication. Supports short-read, long-read, and hybrid workflows. Each module runs independently or as a chained pipeline.
01Installation
# Set conda channels first (required)
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
# Option A β Bioconda
conda create -n aviary -c bioconda aviary
# OR into an existing environment:
conda install -c bioconda aviary
# Option B β Pip
pip install aviary-genome
# Option C β Source with pixi (recommended for development)
git clone https://github.com/rhysnewell/aviary.git
cd aviary
pixi run postinstall # installs all dependencies
# Editable install for development
pip install -e .
02Quick Reference β Subcommands
aviary --version # show installed version
aviary --help # top-level help
aviary <subcommand> --help # help for a specific subcommand
aviary assembleQC + de novo assembly (short, long, or hybrid reads)
aviary recoverMAG recovery from an assembly using multiple binning algorithms
aviary annotateFunctional (EggNOG) + taxonomic (GTDB-tk) annotation of MAGs
aviary completeRuns assemble β recover β annotate in sequence
aviary batchRuns the full pipeline on every sample listed in a batch TSV/CSV
aviary clusterDereplicate and combine MAGs across multiple Aviary runs
aviary diversityStrain diversity analysis using Lorikeet
aviary isolateIsolate (single-organism) hybrid assembly
aviary configureSet database paths and environment variables
03Required Databases
| Database | Tool | Size | Required? |
|---|---|---|---|
| GTDB | GTDB-tk (taxonomy) | ~85 GB | Yes β for taxonomy in recover/annotate |
| EggNOG | EggNOG-mapper | ~50 GB | Yes β for functional annotation |
| CheckM2 | CheckM2 (quality) | ~3 GB | Yes β for MAG QC |
| SingleM | SingleM (profiling) | ~14 GB | Yes β for recovery assessment |
| Metabuli | TaxVAMB binner | varies | Optional β only for taxvamb binner |
Use aviary configure --download to auto-install all databases.
Environment variable paths
export GTDBTK_DATA_PATH=/path/to/gtdb/db/
export EGGNOG_DATA_DIR=/path/to/eggnog/
export SINGLEM_METAPACKAGE_PATH=/path/to/singlem.smpkg/
export CHECKM2DB=/path/to/checkm2db/
export CONDA_ENV_PATH=/path/to/conda/envs/
Tip: PointGTDBTK_DATA_PATHto thedb/folder inside the GTDB download directory, not the download root itself.
04Configure
aviary configure \
-o logs/ \
--eggnog-db-path /path/to/eggnog/ \
--gtdb-path /path/to/gtdb/ \
--checkm2-db-path /path/to/checkm2/ \
--singlem-metapackage-path /path/to/singlem/ \
--metabuli-db-path /path/to/metabuli/ \ # optional, for taxvamb
--download # auto-download missing databases
# Set a persistent tmpdir
aviary configure --tmpdir /scratch/tmp/
| Flag | Description |
|---|---|
-o | Output / log directory |
--eggnog-db-path | EggNOG functional annotation database path |
--gtdb-path | GTDB taxonomy database path |
--checkm2-db-path | CheckM2 quality assessment database path |
--singlem-metapackage-path | SingleM marker gene database path |
--metabuli-db-path | Metabuli database (optional; required for taxvamb) |
--download | Auto-download all missing databases |
--tmpdir | Persist a custom TMPDIR for all future runs |
05Assemble
QC runs automatically before assembly unless --skip-qc is set.
# Short-read only (metaSPAdes by default)
aviary assemble -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16
# Short-read with MEGAHIT (faster, lower memory)
aviary assemble -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 --use-megahit
# Long-read only (myloasm default)
aviary assemble -l sample.fastq.gz -z ont -o output_dir/ --n-cores 16
# Long-read with Flye
aviary assemble -l sample.fastq.gz -z ont --long-read-assembler flye -o output_dir/ --n-cores 16
# Hybrid (short + long reads)
aviary assemble -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -l sample.fastq.gz -z ont -o output_dir/ --n-cores 16
# Host contamination removal
aviary assemble -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -r host_genome.fasta -o output_dir/ --n-cores 16
# Co-assembly of multiple samples
aviary assemble -1 s1_R1.fq.gz s2_R1.fq.gz -2 s1_R2.fq.gz s2_R2.fq.gz --coassemble -o output_dir/ --n-cores 16
Read input flags
| Flag | Description |
|---|---|
-1 PATH .. | Forward short reads |
-2 PATH .. | Reverse short reads |
-i / --interleaved PATH .. | Interleaved short read files |
-c / --coupled PATH .. | Coupled forward/reverse list |
-l / --longreads PATH .. | Nanopore or PacBio reads |
-z / --longread-type TYPE | ont | ont_hq | rs | sq | ccs | hifi (default: ont) |
Assembly flags
| Flag | Description | Default |
|---|---|---|
--long-read-assembler | myloasm | flye | myloasm |
--use-megahit | Use MEGAHIT instead of metaSPAdes for short reads | off |
--use-unicycler | Use Unicycler for metaSPAdes reassembly | off |
--coassemble | Co-assemble multiple input read sets | off |
-k / --kmer-sizes | Kmer sizes for SPAdes (odd integers <128) | auto |
Contig filtering flags (applied post-assembly)
| Flag | Description | Default |
|---|---|---|
--min-cov-long | Minimum long read coverage for contigs | 5 |
--min-cov-short | Minimum short read coverage for contigs | 5 |
--exclude-contig-cov | Exclude contigs with coverage β€ this value | 10 |
--exclude-contig-size | Exclude contigs shorter than this bp | 2500 |
--include-contig-size | Always include contigs longer than this bp | 10000 |
Expected outputs
final_contigs.fasta β assembled contigs (use as --assembly for recover)
www/
assembly_stats.txt β assembly summary statistics
rastqc/ β RastQC short-read QC reports
nanoplot/ β NanoPlot long-read QC reports
06QC / Read Filtering Flags
Applies to assemble, recover, and complete. QC runs automatically β use these flags to tune or skip it.
| Flag | Description | Default |
|---|---|---|
--skip-qc | Skip all QC steps | off |
-r / --host-filter PATH .. | Host reference fasta(s) to remove host reads | β |
--min-read-size INT | Minimum long read size for Filtlong | 100 |
--min-mean-q FLOAT | Minimum long read mean quality | 10 |
--min-short-read-length INT | Minimum short read length to keep | 15 |
--max-short-read-length INT | Maximum short read length (0 = no max) | 0 |
--disable-adapter-trimming | Disable fastp adapter trimming | off |
--unqualified-percent-limit FLOAT | Max % bases allowed unqualified | 40 |
--quality-cutoff INT | Short read quality threshold | 15 |
--extra-fastp-params STR | Extra params passed to fastp as string | β |
07Recover β Extract MAGs
Default binners
| Binner | Type | GPU? | Notes |
|---|---|---|---|
| Rosella | short+long | No | CoverM-based differential coverage binner (default lead binner) |
| MetaBAT2 | short | No | Coverage-based |
| MaxBin2 | short | No | Coverage + tetra-nucleotide frequency |
| CONCOCT | short | No | Gaussian mixture model |
| SemiBin2 | short+long | Yes | Deep learning, self-supervised |
DAS_Tool is always run to produce a final consensus bin set from all binner outputs.
# Short reads only
aviary recover --assembly assembly.fasta -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 --max-threads 32
# With long reads for coverage (improves binning)
aviary recover --assembly assembly.fasta -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -l sample.fastq.gz -z ont -o output_dir/ --n-cores 16
# GPU-accelerated binners (taxvamb, comebin, semibin)
aviary recover --assembly assembly.fasta -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 --request-gpu
# Add extra binners beyond defaults
aviary recover --assembly assembly.fasta -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 --extra-binners taxvamb comebin
# Skip specific binners
aviary recover --assembly assembly.fasta -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 --skip-binners concoct maxbin
# Binning only β skip annotation
aviary recover --assembly assembly.fasta -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 --binning-only
# Target a specific Snakemake rule
aviary recover --assembly assembly.fasta -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ -w rosella --max-threads 12
Recover flags
| Flag | Description | Default |
|---|---|---|
--assembly PATH | Input assembled contigs (.fasta) β required | β |
-1 / -2 | Short reads for coverage calculation | β |
-l / --longreads | Long reads for coverage calculation | β |
--request-gpu | Enable GPU-accelerated binners (taxvamb, comebin, semibin) | off |
--binning-only | Stop after binning; skip quality check and annotation | off |
--strict | Fail immediately if any binner errors | off |
--extra-binners LIST | Add extra binners: maxbin | concoct | comebin | taxvamb | β |
--skip-binners LIST | Skip specific binners from the default set | β |
--min-contig-size INT | Minimum contig size for binning (bp) | 1500 |
--min-bin-size INT | Minimum MAG size (bp) | 200000 |
--semibin-model NAME | SemiBin2 environment model | global |
--skip-abundances | Skip CoverM post-binning abundance calculations | off |
--skip-taxonomy | Skip GTDB-tk taxonomy assignment | off |
--skip-singlem | Skip SingleM recovery assessment | off |
-w / --workflow RULE | Target a specific Snakemake rule (all prerequisites still run) | β |
Expected outputs
final_bins/ β final consensus MAG FASTA files
bin_info.tsv β taxonomy, QC, size, N50 for all MAGs
checkm_minimal.tsv β minimal CheckM2 summary
coverm_abundances.tsv β CoverM relative abundance per MAG per sample
diversity/singlem_out/ β SingleM read-based community profiling
taxonomy/ β GTDB-tk raw output
benchmarks/ β Snakemake rule benchmarks
logs/ β Rule-level logs β check here first on errors
08Annotate
aviary annotate \
-d recover/bins/final_bins/ \
-o output_dir/ \
--n-cores 16
| Flag | Description | Default |
|---|---|---|
-d / --genome-fasta-directory | Directory containing MAG FASTA files | β |
-x / --fasta-extension | File extension of MAG files | fna |
Note: The default extension is.fna, not.fasta. If your bins have a different extension (e.g..fa,.fasta), always set-xaccordingly.
Expected outputs
eggnog/ β EggNOG-mapper functional annotation output
gtdbtk/ β GTDB-tk taxonomic classification output
09Complete β Assemble + Recover + Annotate
Note:completedoes NOT includecluster(dereplication). Run that separately after all samples.
# Short reads only
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16
# Hybrid with myloasm (default)
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -l sample.fastq.gz -z ont -o output_dir/ --n-cores 16
# Hybrid with Flye
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -l sample.fastq.gz -z ont --long-read-assembler flye -o output_dir/ --n-cores 16
# With GPU binners
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -l sample.fastq.gz -z ont -o output_dir/ --n-cores 16 --request-gpu
# Preview the workflow without running
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --dry-run
10Cluster β Dereplicate MAGs
Run this once, after all samples are processed, to dereplicate the combined MAG set.
aviary cluster \
-i run1/ run2/ run3/ \
-o cluster_output/ \
--n-cores 16
| Flag | Description | Default |
|---|---|---|
-i / --input-runs PATH .. | Space-separated previous Aviary output directories | β |
--ani FLOAT | ANI threshold for dereplication | 97 |
--precluster-ani FLOAT | Minimum ANI for preclustering | 95 |
--precluster-method NAME | Rough ANI method: dashing | finch | dashing |
--min-completeness FLOAT | Exclude genomes below this completeness % | β |
--max-contamination FLOAT | Exclude genomes above this contamination % | β |
--use-checkm2-scores | Use CheckM2 scores for representative selection | off |
Expected outputs
11Batch β Multiple Samples
aviary batch \
--batch-file samples.tsv \
-o batch_output/ \
--n-cores 16
The batch file is a TSV or CSV with one sample per row. Aviary will run each sample individually and then cluster the final output. See format example at https://rhysnewell.github.io/aviary/examples/example_batch.tsv.
12Diversity β Strain Analysis
aviary diversity \
-d bins/final_bins/ \
-1 sample_R1.fastq.gz \
-2 sample_R2.fastq.gz \
-o output_dir/ \
--n-cores 16
Runs Lorikeet for strain-resolved variant calling and genotyping.
13Isolate β Single-Organism Assembly
Separate workflow from metagenomics β for isolated pure culture sequencing.
aviary isolate \
-1 sample_R1.fastq.gz \
-2 sample_R2.fastq.gz \
-l sample.fastq.gz \
-z ont \
-o output_dir/ \
--n-cores 16
| Flag | Description | Default |
|---|---|---|
--genome-size | Approximate genome size in bp | 5000000 |
--guppy-model | Guppy model for Medaka polishing | r941_min_high_g360 |
14Common Flags
These flags apply across most subcommands.
| Flag | Description | Default |
|---|---|---|
-n / --n-cores INT | Max CPU cores (total for Snakemake) | 16 |
--max-threads INT | Max threads for any single process | 8 |
-m / --max-memory INT | Max memory in GB | 250 |
-p / --pplacer-threads INT | Threads for pplacer (avoid high values β deadlock risk) | 8 |
-o / --output PATH | Output directory | ./ |
--request-gpu | Enable GPU-accelerated steps (taxvamb, comebin, semibin) | off |
--dry-run | Show workflow steps without executing | off |
-w / --workflow RULE | Target a specific Snakemake rule (all prerequisites still run) | β |
--snakemake-cmds STR | Extra arguments passed directly to Snakemake | β |
--snakemake-profile NAME/PATH | Snakemake cluster profile for HPC submission | β |
--local-cores INT | Max cores for local-only steps | 16 |
--cluster-retries INT | Retry failed cluster jobs N times (memory/time auto-scaled) | 0 |
--tmpdir PATH | Directory for temporary files | /tmp |
--clean | Clean up temp files after run | True |
--rerun-triggers VALUE | What triggers rule reruns | mtime |
Thread control explained
-t / --threadsβ threads per program (how many each tool gets)-n / --n-coresβ total cores Snakemake can use; if >--threads, multiple rules run in parallel-p / --pplacer-threadsβ pplacer gets its own limit (deadlocks on too many threads)
Unlock a directory after a crash
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --snakemake-cmds '--unlock'
Resume an interrupted run
Snakemake automatically skips completed steps. Just re-run the exact same command.
15HPC / Cluster Job Submission
PBS / qsub (e.g. aqua cluster)
# Inline qsub submission β note the trailing space inside the quotes (argparse quirk)
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 \
--snakemake-cmds '--cluster "qsub -V" '
# Using a named Snakemake profile
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 \
--snakemake-profile aqua \
--cluster-retries 2
Example PBS profile ~/.config/snakemake/aqua/config.yaml
cluster: qsub
cluster-status: qstat
jobs: 10000
cluster-cancel: qdel
PBS quirk: Add-Vto your qsub command to pass environment variables to jobs. Without-V, pysam fails to activate properly in submitted jobs.
SLURM
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16 \
--snakemake-profile /path/to/slurm-profile/
Example SLURM wrapper script
#!/bin/bash
#SBATCH --job-name=aviary
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=16
#SBATCH --mem=64G
#SBATCH --time=48:00:00
#SBATCH --output=aviary_%j.log
conda activate aviary
aviary complete -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -o output_dir/ --n-cores 16
sbatch submit_aviary.sh
Cluster retry behaviour
With --cluster-retries N, failed jobs are automatically resubmitted up to N times. Each retry increases the requested memory and wall time. Set --max-memory and --max-threads to cap these values.
Note on job resources: Job CPU and memory requirements were empirically derived from 1,000 Aviary runs. Binner rules are standardised at 24 CPUs. Memory is set to the nearest power of 2 above max RSS. These are capped by--max-memory/--max-threads.
16Full Workflow Walkthrough
Step-by-step (maximum control)
# Step 1 β Configure databases (once per system)
aviary configure -o logs/ \
--eggnog-db-path /path/to/db/eggnog/ \
--gtdb-path /path/to/db/gtdb/ \
--checkm2-db-path /path/to/db/checkm2/ \
--singlem-metapackage-path /path/to/db/singlem/ \
--download
# Step 2 β QC + Assembly
aviary assemble -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz -l sample.fastq.gz -z ont -o 01_assemble/ --n-cores 16
# Step 3 β MAG Recovery
aviary recover \
--assembly 01_assemble/assembly/final_contigs.fasta \
-1 sample_R1.fastq.gz -2 sample_R2.fastq.gz \
-l sample.fastq.gz -z ont \
-o 02_recover/ --n-cores 16 --max-threads 32 --request-gpu
# Step 4 β Annotate MAGs
aviary annotate -d 02_recover/bins/final_bins/ -o 03_annotate/ --n-cores 16
# Step 5 β Dereplicate (after all samples are done)
aviary cluster -i 02_recover/ run2/ run3/ -o 04_cluster/ --n-cores 16
Single-command alternative (steps 2β4)
aviary complete \
-1 sample_R1.fastq.gz -2 sample_R2.fastq.gz \
-l sample.fastq.gz -z ont \
-o output_dir/ --n-cores 16 --request-gpu
# Then run cluster (step 5) separately after all samples are done
aviary cluster -i output_dir/ run2/ run3/ -o cluster/ --n-cores 16
17Key Output Files
After assemble
After recover
output_dir/bins/bin_info.tsv β taxonomy, completeness, contamination, size, N50
output_dir/bins/checkm_minimal.tsv β minimal CheckM2 QC summary
output_dir/bins/coverm_abundances.tsv β relative abundance per MAG per sample
output_dir/diversity/singlem_out/ β SingleM community profiling
output_dir/taxonomy/ β raw GTDB-tk output
output_dir/benchmarks/ β per-rule resource benchmarks
output_dir/logs/ β per-rule logs β always check here first on errors
After annotate
output_dir/annotation/gtdbtk/ β GTDB-tk taxonomic annotation
After cluster
18Debugging & Testing
Finding error messages
All log files are in output_dir/logs/. Each file is named after the rule that generated it.
# Example: SPAdes ran out of memory
cat output_dir/logs/run_spades.log
# List all log files
ls output_dir/logs/
run_tests_at_cmr β full expensive test suite
Must be run from a GPU interactive session. Start one with: mqinteractive gpu
# Recommended: submit via mqsub to control resources
mqsub -t 32 -m 250 --hours 12 pixi run run-tests-at-cmr
# OR: run directly (each test still submits its own job)
pixi run run-tests-at-cmr
- β’ Collects all
@expensiveand@qsubpytest tests - β’ Submits each as a separate
mqsubjob (16 threads, 64 GB, 4 h) - β’ GPU tests (taxvamb, comebin, semibin) are submitted with
--A100 - β’ Waits for all jobs and reports failures
run_samples_at_cmr β benchmark across 9 real samples
pixi run -e dev postinstall # install dev environment
pixi run -e dev aviary build # build aviary in dev environment
pixi run -e dev python test/run_samples_at_cmr
- β’ Runs
aviary recover --binning-onlyon 9 samples (Gut/Soil/Ocean) with both MEGAHIT and MetaSPAdes - β’ Jobs dispatched via GNU parallel (
-j 18) with aqua Snakemake profile - β’ Output: timestamped directory per git commit under
$PIXI_PROJECT_ROOT/aviary_test_samples/<COMMIT>/ - β’ Summary:
{OUTPUT_DIR}/summary.tsv(columns: Env, Sample, Assembler, Score, Genomes) - β’ Quality threshold:
completeness β (5 Γ contamination) β₯ 50
Running tests locally
pixi run -e dev pytest test/ # standard tests only
pixi run -e dev pytest test/ --run-expensive # include expensive tests
pixi run -e dev pytest test/ --run-qsub # include qsub tests
pixi run -e dev pytest test/ --profile /path/to/snakemake-profile/ # use a cluster profile
19Tips, Gotchas & Common Errors
- 01/tmp filling up is the most common error (
Error in prepare_binning_files). CoverM mapping during binning uses/tmp. Fix:--tmpdir /scratch/tmp/oraviary configure --tmpdir /scratch/tmp/. - 02SPAdes "Error code: -9" almost always means out of memory. Increase with
-m(GB). - 03qsub + pysam ModuleNotFoundError: Add
-Vto your qsub command to pass environment variables:--snakemake-cmds '--cluster "qsub -V" ' - 04Trailing space in
--snakemake-cmds: The space afterqsubin'--cluster qsub 'is required due to a Python argparse quirk. - 05
--request-gpuon a local machine: First install thecudapackage into your conda environment. GPU-capable programs will detect it automatically. - 06Resuming a run: Snakemake automatically skips completed rules. Just re-run the exact same command with the same
-ooutput directory. - 07Default fasta extension for
annotateis.fna, not.fasta. If your bins have a different extension, always specify-x. - 08
aviary completedoes NOT runcluster. You must always runaviary clusterseparately after all samples have been processed. - 09
--binning-onlyin recover skips CheckM2 QC and GTDB-tk β useful when you want fast MAG binning and plan to runaviary annotateseparately. - 10
--cluster-retriesis highly recommended on HPC. Failed jobs are retried with progressively more memory and time, up to--max-memory/--max-threadscaps. - 11Setting GTDB path: Point
GTDBTK_DATA_PATHto thedb/folder inside the GTDB download directory, not the download root itself. - 12GPU binners require a GPU node. If using
--request-gpuwith a PBS/SLURM profile, ensure the profile is configured to submit GPU jobs to a GPU partition/queue.