CloneArmy
CloneArmy is a modern Python package for analyzing haplotypes from Illumina paired-end amplicon sequencing data. It provides a streamlined workflow for processing FASTQ files, aligning reads, identifying sequence variants, and performing comparative analyses between samples.
Features
- Fast paired-end read processing using BWA-MEM
- Quality-based filtering of bases and alignments
- Haplotype identification and frequency analysis
- Statistical comparison between samples with FDR correction
- Interactive visualization of mutation frequencies
- Rich command-line interface with progress tracking and tabular output
- Comprehensive HTML reports
- Multi-threading support
- Support for full-length sequence analysis
- Real-time progress monitoring with progress bars
- Automatic downsampling of large FASTQ files
- Exportable results in multiple formats (CSV, JSON, Excel)
Installation
pip install clonearmy
Requirements
- Python ≥ 3.8
- BWA (must be installed and available in PATH)
- Samtools (must be installed and available in PATH)
- Seqtk (must be installed and available in PATH)
You can install the required tools using conda:
conda install -c bioconda bwa samtools seqtk
Usage
Command Line Interface
Basic Analysis
# Basic usage with progress tracking
clonearmy run /path/to/fastq/directory reference.fasta
# With all options
clonearmy run /path/to/fastq/directory reference.fasta \
--threads 8 \
--output results \
--min-base-quality 20 \
--min-mapping-quality 30 \
--min-read-count 10 \
--max-file-size 100000000 \ # Target size for downsampling (100MB)
--report # Generate HTML report (default: true)
The --max-file-size option specifies the target size for downsampling large FASTQ files. If your input files are larger than this size, they will be automatically downsampled while maintaining paired-end relationships. This is useful for quick testing or when working with very large datasets. The size is specified in bytes (e.g., 100000000 for 100MB).
Comparative Analysis
# Compare two samples
clonearmy compare \
/path/to/sample1/fastq \
/path/to/sample2/fastq \
reference.fasta \
--threads 8 \
--output comparison_results \
--min-base-quality 20 \
--min-mapping-quality 30 \
--min-read-count 10 \
--max-file-size 100000000 \ # Target size for downsampling (100MB)
--full-length-only # Only consider full-length sequences
Output Examples
Sample Analysis Results
╒════════════════╤══════════╤════════════╤══════════════╕
│ Sample │ Reads │ Haplotypes │ Mutations │
╞════════════════╪══════════╪════════════╪══════════════╡
│ sample1 │ 10000 │ 45 │ 2.3 avg │
│ sample2 │ 12000 │ 52 │ 1.8 avg │
╘════════════════╧══════════╧════════════╧══════════════╛
Comparative Analysis Results
╒══════════╤════════════╤════════════╤═══════════╤═══════════╕
│ Position │ Sample 1 % │ Sample 2 % │ P-value │ FDR │
╞══════════╪════════════╪════════════╪═══════════╪═══════════╡
│ 123 A>T │ 45.2 │ 12.3 │ 0.001 │ 0.003 │
│ 456 G>C │ 33.1 │ 28.9 │ 0.042 │ 0.063 │
╘══════════╧════════════╧════════════╧═══════════╧═══════════╛
Python API
from pathlib import Path
from clone_army.processor import AmpliconProcessor
from clone_army.comparison import run_comparative_analysis
# Initialize processor with automatic downsampling
processor = AmpliconProcessor(
reference_path="reference.fasta",
min_base_quality=20,
min_mapping_quality=30,
min_read_count=10,
max_file_size=100_000_000 # 100MB target size
)
# Process samples
results1 = processor.process_sample(
fastq_r1="sample1_R1.fastq.gz",
fastq_r2="sample1_R2.fastq.gz",
output_dir="results/sample1",
threads=4
)
results2 = processor.process_sample(
fastq_r1="sample2_R1.fastq.gz",
fastq_r2="sample2_R2.fastq.gz",
output_dir="results/sample2",
threads=4
)
# Perform comparative analysis
comparison_results = run_comparative_analysis(
results1=results1,
results2=results2,
reference_seq=ref_seq,
output_path="comparison_results.csv",
full_length_only=False
)
Output Files
Single Sample Analysis
- Sorted BAM file with alignments
{sample}_haplotypes.csvcontaining:- Sequence
- Read count
- Frequency
- Number of mutations
- Full-length status
- Quality metrics
- Interactive HTML report with:
- Summary statistics
- Mutation frequency plots
- Position-based mutation diversity plots
- Mutation spectrum analysis
- Console output with summary statistics
Comparative Analysis
comparison_results.csvwith statistical comparisons:- Mutation positions and types
- Frequencies in each sample
- Statistical significance (p-values)
- FDR-corrected p-values
- Interactive HTML plots:
- Mutation frequency comparison
- Position-based mutation diversity
- Console output with significant mutations
Metadata
Release files for clonearmy 0.2.32
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 |
|---|---|---|---|---|
| clonearmy-0.2.32.tar.gz | 24.8 kB | Without provenance | Details for clonearmy-0.2.32.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clonearmy-0.2.32-py3-none-any.whl | Python 3 | none | any | Details for clonearmy-0.2.32-py3-none-any.whl |
Total release size: 53.0 kB
Release files / clonearmy-0.2.32.tar.gz
| Download URL | clonearmy-0.2.32.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
129c99453b0cb815bf64c3fd5bd671c0d9e43521d6fae06539703e39bda74abb
|
|
BLAKE2b-256 checksum How to use checksums |
6cdb6a2d9f9ada9a9dbb31909ef41ca2e091aedce9c66e0ec319e45da4b935cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / clonearmy-0.2.32-py3-none-any.whl
| Download URL | clonearmy-0.2.32-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e82b6b50e7dd3dbce73ee6e7075799c3fb911006d8f7933bfa21df859de949b9
|
|
BLAKE2b-256 checksum How to use checksums |
9e4c1c4114a23fd3e00167e7f786e50255295ea639a8207c56b2031e24c6080d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Security for clonearmy 0.2.32
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.