[meta]
name = "spades"
category = "assembly"
description = "De novo genome assembly tool for small genomes, single-cell data, metagenomes, and plasmids"
tags = ["assembly", "de-novo", "genome", "metagenome", "plasmid", "single-cell", "ngs", "illumina"]
author = "oxo-call built-in"
source_url = "https://github.com/ablab/spades"

[context]
concepts = [
    "SPAdes assembles genomes from short reads using de Bruijn graphs; key modes: genomic, metagenomic (--meta), plasmid (--plasmid).",
    "Use -1 and -2 for paired-end reads; -s for single-end reads; --pe-12 for interleaved paired-end.",
    "SPAdes automatically selects k-mer values; use -k to specify custom k-mers (e.g., -k 21,33,55,77).",
    "Use -o for output directory; --threads N for parallelism; --memory N (GB) to limit RAM usage.",
    "Output files: scaffolds.fasta (final assembly), contigs.fasta, assembly_graph.fastg.",
    "For metagenomes, use --meta flag; for single-cell (MDA), use --sc flag.",
    "Use --careful mode to reduce mismatches in final assemblies (slower, recommended for small genomes).",
    "SPAdes also has rnaSPAdes for RNA assembly and hybridSPAdes for hybrid assembly.",
]

pitfalls = [
    "SPAdes requires significant RAM — human genome assembly needs ~250 GB RAM; for bacteria use 16-32 GB.",
    "For metagenomes, --meta flag is required — running without it gives poor metagenome assemblies.",
    "The --careful option is NOT compatible with --meta mode.",
    "SPAdes creates a large output directory with intermediate files — ensure sufficient disk space.",
    "Input reads should be trimmed before SPAdes for better assembly quality.",
    "Do NOT mix different insert size libraries without specifying separate library groups (--pe1-1, --pe2-1, etc.).",
]

[[examples]]
task = "assemble a bacterial genome from paired-end reads"
args = "-1 R1.fastq.gz -2 R2.fastq.gz -o spades_output/ --threads 16 --memory 32 --careful"
explanation = "--careful reduces mismatches; --threads 16 cores; --memory 32 limits RAM to 32 GB"

[[examples]]
task = "assemble a metagenome from paired-end reads"
args = "--meta -1 R1.fastq.gz -2 R2.fastq.gz -o metaspades_output/ --threads 32 --memory 128"
explanation = "--meta enables metaSPAdes mode for metagenomic assembly; higher memory for diverse communities"

[[examples]]
task = "assemble plasmids from paired-end reads"
args = "--plasmid -1 R1.fastq.gz -2 R2.fastq.gz -o plasmidspades_output/ --threads 8 --memory 16"
explanation = "--plasmid mode for plasmid assembly and recovery from whole-genome sequencing data"

[[examples]]
task = "assemble single-cell MDA amplified data"
args = "--sc -1 R1.fastq.gz -2 R2.fastq.gz -o sc_spades_output/ --threads 8 --memory 32"
explanation = "--sc mode handles uneven coverage typical of single-cell amplified data"

[[examples]]
task = "resume interrupted SPAdes assembly"
args = "-o spades_output/ --continue"
explanation = "--continue resumes from the last successfully completed stage; requires the same output directory"

[[examples]]
task = "assemble with both paired-end and long reads (hybrid assembly)"
args = "-1 short_R1.fastq.gz -2 short_R2.fastq.gz --nanopore long_reads.fastq.gz -o hybrid_output/ --threads 16 --memory 64"
explanation = "--nanopore provides ONT long reads for hybrid assembly; SPAdes integrates short and long reads"
