SPAdes

Descrição

De acordo com a Documentação do SPAdes, SPAdes (St. Petersburg genome assembler) é um algoritmo de montagem de genomas desenvolvido para dados de sequenciamento de próxima geração (NGS), particularmente Illumina.

Versões Disponíveis

  • spades/3.15.5 (default)

Carregando o Módulo

# Carregar SPAdes
module load spades/3.15.5

# Verificar instalação
spades.py --version

Montagem Básica

submit_spades_basic.sh
#!/bin/bash
#SBATCH -J spades_basic
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 48:00:00
#SBATCH --mem=32G

export INPUT="reads_1.fastq reads_2.fastq"
export OUTPUT="spades_assembly/"

module load spades/3.15.5

job-nanny spades.py -1 reads_1.fastq -2 reads_2.fastq \
                 -o spades_assembly \
                 --threads $SLURM_CPUS_PER_TASK \
                 --memory $(($SLURM_MEM_PER_NODE / 1024))

Montagem com Cuidado (Careful)

submit_spades_careful.sh
#!/bin/bash
#SBATCH -J spades_careful
#SBATCH -N 1
#SBATCH -c 16
#SBATCH -t 72:00:00
#SBATCH --mem=64G

export INPUT="reads_1.fastq reads_2.fastq"
export OUTPUT="spades_careful/"

module load spades/3.15.5

job-nanny spades.py -1 reads_1.fastq -2 reads_2.fastq \
                 -o spades_careful \
                 --threads $SLURM_CPUS_PER_TASK \
                 --memory $(($SLURM_MEM_PER_NODE / 1024)) \
                 --careful

Montagem com Múltiplas Bibliotecas

submit_spades_multiple.sh
#!/bin/bash
#SBATCH -J spades_multiple
#SBATCH -N 1
#SBATCH -c 16
#SBATCH -t 96:00:00
#SBATCH --mem=64G

export INPUT="lib1_1.fastq lib1_2.fastq lib2_1.fastq lib2_2.fastq"
export OUTPUT="spades_multiple/"

module load spades/3.15.5

job-nanny spades.py \
     --pe1-1 lib1_1.fastq --pe1-2 lib1_2.fastq \
     --pe2-1 lib2_1.fastq --pe2-2 lib2_2.fastq \
     -o spades_multiple \
     --threads $SLURM_CPUS_PER_TASK \
     --memory $(($SLURM_MEM_PER_NODE / 1024)) \
     --careful

Montagem Single-end

submit_spades_single.sh
#!/bin/bash
#SBATCH -J spades_single
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 48:00:00
#SBATCH --mem=32G

export INPUT="reads.fastq"
export OUTPUT="spades_single/"

module load spades/3.15.5

job-nanny spades.py -s reads.fastq \
                 -o spades_single \
                 --threads $SLURM_CPUS_PER_TASK \
                 --memory $(($SLURM_MEM_PER_NODE / 1024))

Montagem com Isolamento (Meta)

submit_spades_meta.sh
#!/bin/bash
#SBATCH -J spades_meta
#SBATCH -N 1
#SBATCH -c 16
#SBATCH -t 96:00:00
#SBATCH --mem=64G

export INPUT="metagenome_1.fastq metagenome_2.fastq"
export OUTPUT="metaspades/"

module load spades/3.15.5

job-nanny spades.py -1 metagenome_1.fastq -2 metagenome_2.fastq \
                 -o metaspades \
                 --meta \
                 --threads $SLURM_CPUS_PER_TASK \
                 --memory $(($SLURM_MEM_PER_NODE / 1024))

Montagem com RNA-seq (rnaSPAdes)

submit_spades_rna.sh
#!/bin/bash
#SBATCH -J spades_rna
#SBATCH -N 1
#SBATCH -c 16
#SBATCH -t 72:00:00
#SBATCH --mem=64G

export INPUT="rnaseq_1.fastq rnaseq_2.fastq"
export OUTPUT="rnaspades/"

module load spades/3.15.5

job-nanny spades.py -1 rnaseq_1.fastq -2 rnaseq_2.fastq \
                 -o rnaspades \
                 --rna \
                 --threads $SLURM_CPUS_PER_TASK \
                 --memory $(($SLURM_MEM_PER_NODE / 1024))

Job Array para Múltiplas Amostras

submit_spades_array.sh
#!/bin/bash
#SBATCH -J spades_array
#SBATCH --array=1-10
#SBATCH -N 1
#SBATCH -c 16
#SBATCH -t 72:00:00
#SBATCH --mem=64G

SAMPLES=(
    "sample1"
    "sample2"
    "sample3"
    "sample4"
    "sample5"
    "sample6"
    "sample7"
    "sample8"
    "sample9"
    "sample10"
)

SAMPLE=${SAMPLES[$SLURM_ARRAY_TASK_ID-1]}
export INPUT="${SAMPLE}_1.fastq ${SAMPLE}_2.fastq"
export OUTPUT="${SAMPLE}_assembly/"

module load spades/3.15.5

job-nanny spades.py -1 ${SAMPLE}_1.fastq -2 ${SAMPLE}_2.fastq \
                 -o ${SAMPLE}_assembly \
                 --threads $SLURM_CPUS_PER_TASK \
                 --memory $(($SLURM_MEM_PER_NODE / 1024)) \
                 --careful

Análise de Resultados

analyze_spades.sh
#!/bin/bash
#SBATCH -J analyze_spades
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 04:00:00
#SBATCH --mem=8G

module load quast/5.0.2  # Se disponível

# Estatísticas básicas
for sample in sample*_assembly; do
    echo "=== $sample ===" >> assembly_stats.txt

    # Número de contigs
    grep -c "^>" ${sample}/contigs.fasta >> assembly_stats.txt

    # Tamanho total
    grep -v "^>" ${sample}/contigs.fasta | wc -c >> assembly_stats.txt

    # N50 (cálculo simples)
    awk '/^>/ {if (seqlen) print seqlen; seqlen=0; next}
         {seqlen+=length($0)} END {print seqlen}' \
        ${sample}/contigs.fasta | sort -rn > lengths.txt

    total=$(awk '{sum+=$1} END {print sum}' lengths.txt)
    half=$((total/2))
    sum=0
    while read len; do
        sum=$((sum+len))
        if [ $sum -ge $half ]; then
            echo "N50: $len" >> assembly_stats.txt
            break
        fi
    done < lengths.txt

    echo "" >> assembly_stats.txt
done

# QUAST (se disponível)
if command -v quast.py &> /dev/null; then
    quast.py -o quast_report sample*/contigs.fasta
fi

Referências

Ver também