Skip to content

Latest commit

 

History

History
334 lines (262 loc) · 10.9 KB

File metadata and controls

334 lines (262 loc) · 10.9 KB

SPAdes Documentation for ATHENA Pipeline

Overview

SPAdes (St. Petersburg genome assembler) is a genome assembly toolkit integrated into the ATHENA bioinformatics pipeline. SPAdes is designed for single-cell and multi-cell bacterial genomes, plasmids, and metagenomic assemblies, making it an ideal choice for comprehensive NGS data analysis workflows.

Features in ATHENA

  • High-Quality Assembly: Produces contigs and scaffolds for bacterial genomes
  • Automatic Parameter Selection: Optimized k-mer selection for different data types
  • Memory Management: User-configurable memory usage for different system capabilities
  • Multi-threading Support: Parallel processing for faster assembly
  • Pipeline Integration: Seamlessly uses trimmed reads from ATHENA's preprocessing steps
  • Comprehensive Output: Generates contigs, scaffolds, assembly graphs, and detailed logs

Command-Line Usage

Standalone SPAdes Command

./athena spades [OPTIONS]

Required Parameters

  • -1, --input1 FILE: First input FASTQ file (for paired-end data)
  • -2, --input2 FILE: Second input FASTQ file (for paired-end data)
  • -o, --output DIR: Output directory for SPAdes results

Optional Parameters

  • -r, --report: Generate and display assembly statistics in the terminal
  • -v, --verbose: Enable verbose output for debugging and monitoring assembly progress

Example Usage

Basic Paired-End Assembly

./athena spades -1 sample_R1.fastq -2 sample_R2.fastq -o assembly_output/

Assembly with Trimmed Data

./athena spades -1 trimmed_R1.fastq.gz -2 trimmed_R2.fastq.gz -o assembly_output/

With Verbose Output

./athena spades -1 sample_R1.fastq -2 sample_R2.fastq -o assembly_output/ -v

With Assembly Report

./athena spades -1 sample_R1.fastq -2 sample_R2.fastq -o assembly_output/ -r

Integration with ATHENA Pipeline

SPAdes is automatically executed in the ATHENA pipeline through the start command:

./athena start -1 input_R1.fastq -2 input_R2.fastq -o output_directory/

Pipeline Workflow

  1. Quality Assessment: FastQC analyzes raw reads
  2. Read Preprocessing: Trimmomatic cleans and filters reads
  3. Post-Trim QC: FastQC validates trimmed read quality
  4. Genome Assembly: SPAdes assembles the cleaned reads
  5. Assembly QC: QUAST evaluates assembly quality

Assembly Process

Interactive Configuration

When running SPAdes, ATHENA prompts for configuration:

Enter number of threads (default 4): 8
Enter memory limit in GB (default 16): 32

K-mer Selection

SPAdes automatically selects optimal k-mer sizes based on:

  • Read length
  • Coverage depth
  • Data quality
  • Assembly complexity

Typical k-mer ranges: 21, 33, 55, 77, 99, 127

Assembly Stages

  1. Error Correction: BayesHammer corrects sequencing errors
  2. K-mer Graph Construction: Builds de Bruijn graphs for multiple k-mer sizes
  3. Contig Assembly: Generates initial contigs
  4. Scaffolding: Links contigs using paired-end information
  5. Gap Filling: Fills gaps in scaffolds when possible

Output Files

Directory Structure

output_directory/04_spades/
├── contigs.fasta           # Final assembled contigs
├── scaffolds.fasta         # Scaffolded sequences (with gaps)
├── assembly_graph.gfa      # Assembly graph in GFA format
├── assembly_graph_with_scaffolds.gfa  # Scaffolded graph
├── spades.log              # Detailed assembly log
├── params.txt              # Assembly parameters used
├── dataset.info            # Input dataset information
├── input_dataset.yaml      # SPAdes configuration file
├── corrected/              # Error-corrected reads
├── K21/                    # K-mer specific directories
├── K33/
├── K55/
├── K77/
├── K99/
├── K127/
├── misc/                   # Miscellaneous files
└── tmp/                    # Temporary files

Key Output Files

contigs.fasta

  • Description: Final assembled contigs without gaps
  • Content: High-confidence assembled sequences
  • Usage: Primary assembly output for downstream analysis
  • Quality: Usually higher quality than scaffolds

scaffolds.fasta

  • Description: Scaffolded sequences with gap regions (N's)
  • Content: Contigs linked by paired-end information
  • Usage: Provides longer sequences with gap information
  • Quality: May contain gaps but gives better genome structure

assembly_graph.gfa

  • Description: Assembly graph in Graphical Fragment Assembly format
  • Content: Graph representation of the assembly
  • Usage: Visualization and analysis of assembly complexity
  • Tools: Can be viewed with Bandage, AGB, or other graph viewers

spades.log

  • Description: Comprehensive assembly log
  • Content: All assembly stages, statistics, and potential issues
  • Usage: Troubleshooting and assembly quality assessment
  • Information: Memory usage, timing, k-mer statistics

Assembly Statistics

Basic Metrics

  • Total contigs: Number of assembled contigs
  • Total length: Total assembled genome size
  • Largest contig: Size of the longest contig
  • N50: Statistical measure of assembly contiguity
  • GC content: Overall GC percentage

Quality Indicators

  • Coverage depth: Average sequencing coverage
  • Assembly completeness: Percentage of genome assembled
  • Misassemblies: Potential assembly errors
  • Gaps: Number and total length of gaps in scaffolds

Performance Considerations

Memory Requirements

  • Bacterial genomes: 4-16 GB RAM typically sufficient
  • Large genomes: May require 32-64 GB RAM
  • Metagenomes: Can require 100+ GB RAM
  • User configuration: Adjustable during execution

Threading Performance

  • CPU cores: Scales well with available cores
  • Optimal range: 4-16 threads for most datasets
  • Diminishing returns: >16 threads may not provide significant speedup
  • Memory bandwidth: Can become limiting factor

Processing Time

  • Small bacterial genomes: 10-30 minutes
  • Large bacterial genomes: 30-120 minutes
  • Complex assemblies: Several hours
  • Factors: Genome size, coverage, complexity, system specifications

Best Practices

Input Data Preparation

  • Use trimmed reads: ATHENA automatically uses Trimmomatic output
  • Quality filtering: Remove low-quality reads before assembly
  • Coverage assessment: Optimal coverage is 30-100x for bacterial genomes
  • Read length: Longer reads generally produce better assemblies

Parameter Selection

  • Memory allocation: Set to 70-80% of available system RAM
  • Thread count: Use number of available CPU cores minus 2-4
  • k-mer selection: Let SPAdes auto-select for best results

Quality Control

  • Always run QUAST: Automated in ATHENA pipeline
  • Check assembly statistics: Review N50, contig count, total length
  • Validate with reference: If reference genome available
  • Look for contamination: Unusual GC content or phylogenetic markers

Troubleshooting

Common Issues

Insufficient Memory

Error: Not enough memory allocated

Solution: Increase memory allocation or use a system with more RAM

Low Coverage

Warning: Low coverage detected

Solution: Check input data quality, consider additional sequencing

Fragmented Assembly

Warning: High number of short contigs

Solution:

  • Verify input data quality
  • Check for contamination
  • Consider different assembly parameters

Assembly Failure

Error: SPAdes terminated unexpectedly

Solution:

  • Check spades.log for specific error messages
  • Verify input file integrity
  • Ensure sufficient disk space

Verbose Mode

Enable verbose mode (-v) to monitor:

  • Assembly progress in real-time
  • Memory usage patterns
  • K-mer statistics
  • Error correction results
  • Detailed timing information

Log Analysis

The spades.log file contains:

  • Command line parameters
  • Input data statistics
  • Error correction results
  • Assembly stage progress
  • Final assembly statistics
  • Warning and error messages

Assembly Validation

Automatic Validation (via QUAST)

When used in the ATHENA pipeline, assemblies are automatically validated using QUAST, which provides:

  • Assembly statistics comparison
  • Misassembly detection
  • Gene prediction and annotation
  • Comparative analysis with reference genomes

Manual Validation

Additional validation can be performed using:

  • BUSCO: Assess completeness using universal single-copy orthologs
  • CheckM: Estimate genome completeness and contamination
  • Kraken2: Taxonomic classification and contamination detection
  • Bandage: Assembly graph visualization

Advanced Usage

Custom Parameters

For advanced users, SPAdes parameters can be customized by modifying the source code in src/spades/spades.cpp:

// Example parameter modifications
std::string spades_cmd = "spades.py --pe1-1 " + input1 + " --pe1-2 " + input2;
spades_cmd += " -o " + output_dir;
spades_cmd += " --threads " + std::to_string(threads);
spades_cmd += " --memory " + std::to_string(memory);
// Add custom parameters here
spades_cmd += " --careful";  // Reduces mismatches and indels
spades_cmd += " --cov-cutoff auto";  // Automatic coverage cutoff

Specialized Assembly Modes

SPAdes supports various specialized modes:

  • --isolate: For bacterial isolate genomes
  • --sc: For single-cell assemblies
  • --meta: For metagenomic assemblies
  • --plasmid: For plasmid assemblies
  • --rna: For RNA-seq assemblies

Integration with Downstream Analysis

QUAST Integration

ATHENA automatically runs QUAST on SPAdes output for:

  • Assembly quality assessment
  • Statistical analysis
  • Comparative genomics (if reference provided)
  • HTML report generation

File Format Compatibility

SPAdes outputs are compatible with:

  • Annotation tools: Prokka, RAST, NCBI PGAP
  • Comparative genomics: MUMmer, progressiveMauve
  • Phylogenetic analysis: FastANI, dDDH
  • Visualization: IGV, Artemis, JBrowse

Version Compatibility

SPAdes Versions

  • Minimum required: SPAdes v3.13.0
  • Recommended: SPAdes v3.15.x or newer
  • Compatibility: ATHENA works with all modern SPAdes versions

Input Format Support

  • FASTQ: Compressed (.gz) and uncompressed
  • FASTA: For preprocessed reads
  • Quality encoding: Phred+33 (standard Illumina)
  • Read types: Paired-end, mate-pair, single-end

Support and Further Information

For additional information about SPAdes capabilities and advanced usage:

This documentation covers SPAdes as integrated within the ATHENA pipeline. For standalone SPAdes usage with custom parameters, refer to the official SPAdes documentation.