ALIGNOTH
Alignoth generates alignment plots from BAM files. This wrapper allows specifying BAMs, reference FASTA, VCFs, highlight regions, auxiliary tags, and output options.
URL: https://github.com/alignoth/alignoth
Example
This wrapper can be used in the following way:
rule alignoth_json:
input:
bam="NA12878.bam",
bam_idx="NA12878.bam.bai",
reference="ref.fa",
reference_idx="ref.fa.fai",
vcf="1257A.vcf.gz",
vcf_idx="1257A.vcf.gz.csi"
output:
"out/json_plot.vl.json"
params:
extra="-g 1:50-280 -h coolregion:200-210"
log:
"logs/log.txt"
wrapper:
"v9.4.1/bio/alignoth"
rule alignoth_html:
input:
bam="NA12878.bam",
bam_idx="NA12878.bam.bai",
reference="ref.fa",
reference_idx="ref.fa.fai",
vcf="1257A.vcf.gz",
vcf_idx="1257A.vcf.gz.csi"
output:
"out/plot.html"
params:
extra="-g 1:50-280 -h coolregion:200-210"
log:
"logs/log.txt"
wrapper:
"v9.4.1/bio/alignoth"
rule alignoth_output_dir:
input:
bam="NA12878.bam",
bam_idx="NA12878.bam.bai",
reference="ref.fa",
reference_idx="ref.fa.fai",
vcf="1257A.vcf.gz",
vcf_idx="1257A.vcf.gz.csi"
output:
directory("output-dir/")
params:
extra="-g 1:50-280 -h coolregion:200-210"
log:
"logs/log.txt"
wrapper:
"v9.4.1/bio/alignoth"
Note that input, output and log file paths can be chosen freely.
When running with
snakemake --use-conda
the software dependencies will be automatically deployed into an isolated environment before execution.
Notes
Output needs to end with .html, .json or a directory path.
Software dependencies
alignoth=1.5.1
Input/Output
Input:
bam: Path to indexed BAM filebam_idx: Path to BAM index filereference: Path to indexed reference FASTA filereference_idx: Path to index of reference FASTA filevcf: Path to indexed VCF file (Optional)vcf_idx: Path to index of VCF file (required when VCF is used)bed: Path to BED file (Optional)
Output:
HTML, JSON or directory path
Params
extra: Extra command line arguments to pass directly to alignoth.
Code
__author__ = "Felix Wiegand"
__copyright__ = "Copyright 2025, Felix Wiegand"
__email__ = "felix.wiegand@uni-due.de"
__license__ = "MIT"
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
extra = snakemake.params.get("extra", "")
output = snakemake.output[0]
cmd = ["alignoth"]
# BAM input
if snakemake.input.get("bam", ""):
if snakemake.input.get("bam_idx", ""):
cmd.append(f"-b {snakemake.input.bam}")
else:
raise ValueError("BAM input given without bai index")
else:
raise ValueError("BAM input required")
# Reference
if snakemake.input.get("reference", ""):
if snakemake.input.get("reference_idx", ""):
cmd.append(f"-r {snakemake.input.reference}")
else:
raise ValueError("Reference input given without fai index")
else:
raise ValueError("Reference input required")
# Optional VCF with required csi/tbi index
if snakemake.input.get("vcf", ""):
if snakemake.input.get("vcf_idx", ""):
cmd.append(f"-v {snakemake.input.vcf}")
else:
raise ValueError("VCF input given without csi/tbi index")
# Optional BED
if snakemake.input.get("bed", ""):
cmd.append(f"--bed {snakemake.input.bed}")
cmd.append(f"{extra}")
# HTML output
if output.endswith(".html"):
cmd.append("--html")
shell(f"{' '.join(cmd)} > {output} {log}")
# Default: JSON output to single file via stdout
elif output.endswith(".json"):
shell(f"{' '.join(cmd)} > {output} {log}")
# Assume output is directory
else:
cmd.append(f"-o {output}")
shell(f"{' '.join(cmd)} {log}")