Salmon

Descrição

De acordo com a página do Salmon, Salmon é uma ferramenta para quantificação rápida de transcriptomas a partir de dados RNA-seq. Requer um conjunto de transcritos alvo (referência ou montagem de novo) e arquivos FASTA/FASTQ com as reads.

Versões Disponíveis

  • salmon/0.14.0 (default)

Carregando o Módulo

# Carregar Salmon
module load salmon/0.14.0

# Verificar instalação
salmon --version

Indexação do Transcriptoma

submit_salmon_index.sh
#!/bin/bash
#SBATCH -J salmon_index
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 06:00:00
#SBATCH --mem=32G

export INPUT="transcripts.fasta"
export OUTPUT="transcripts_index/"

module load salmon/0.14.0

job-nanny salmon index -t transcripts.fasta -i transcripts_index -k 31

Quantificação (modo mapping-based)

submit_salmon_quant.sh
#!/bin/bash
#SBATCH -J salmon_quant
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 24:00:00
#SBATCH --mem=16G

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

module load salmon/0.14.0

job-nanny salmon quant -i transcripts_index -l A \
                 -1 reads_1.fastq -2 reads_2.fastq \
                 --validateMappings -o sample_quant \
                 -p $SLURM_CPUS_PER_TASK

Quantificação com Single-end

submit_salmon_single.sh
#!/bin/bash
#SBATCH -J salmon_single
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 12:00:00
#SBATCH --mem=8G

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

module load salmon/0.14.0

job-nanny salmon quant -i transcripts_index -l A \
                 -r reads.fastq \
                 --validateMappings -o sample_quant \
                 -p $SLURM_CPUS_PER_TASK

Processamento em Lote com Script

submit_salmon_batch.sh
#!/bin/bash
#SBATCH -J salmon_batch
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 72:00:00
#SBATCH --mem=16G

export INPUT="samples.txt"
export OUTPUT="all_quant/"

module load salmon/0.14.0

mkdir -p all_quant

# Criar script de execução
cat > run_salmon.sh << 'EOF'
#!/bin/bash

while IFS= read -r sample; do
    echo "Processando amostra: $sample"

    if [ -f "${sample}_1.fastq" ] && [ -f "${sample}_2.fastq" ]; then
        # Paired-end
        salmon quant -i transcripts_index -l A \
            -1 ${sample}_1.fastq -2 ${sample}_2.fastq \
            --validateMappings -o all_quant/${sample} \
            -p $SLURM_CPUS_PER_TASK
    elif [ -f "${sample}.fastq" ]; then
        # Single-end
        salmon quant -i transcripts_index -l A \
            -r ${sample}.fastq \
            --validateMappings -o all_quant/${sample} \
            -p $SLURM_CPUS_PER_TASK
    else
        echo "Arquivos não encontrados para $sample"
    fi
done < samples.txt
EOF

chmod +x run_salmon.sh
job-nanny ./run_salmon.sh
samples.txt
sample1
sample2
sample3
sample4
sample5

Job Array para Múltiplas Amostras

submit_salmon_array.sh
#!/bin/bash
#SBATCH -J salmon_array
#SBATCH --array=1-10
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 24:00:00
#SBATCH --mem=16G

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="quant/${SAMPLE}/"

module load salmon/0.14.0

mkdir -p quant/${SAMPLE}

if [ -f "${SAMPLE}_1.fastq" ] && [ -f "${SAMPLE}_2.fastq" ]; then
    job-nanny salmon quant -i transcripts_index -l A \
                     -1 ${SAMPLE}_1.fastq -2 ${SAMPLE}_2.fastq \
                     --validateMappings -o quant/${SAMPLE} \
                     -p $SLURM_CPUS_PER_TASK
else
    job-nanny salmon quant -i transcripts_index -l A \
                     -r ${SAMPLE}.fastq \
                     --validateMappings -o quant/${SAMPLE} \
                     -p $SLURM_CPUS_PER_TASK
fi

Detecção de Tipo de Biblioteca

submit_salmon_infer.sh
#!/bin/bash
#SBATCH -J salmon_infer
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 06:00:00
#SBATCH --mem=8G

export INPUT="reads_1.fastq reads_2.fastq"
export OUTPUT="lib_type.txt"

module load salmon/0.14.0

job-nanny salmon quant -i transcripts_index -l A \
                 -1 reads_1.fastq -2 reads_2.fastq \
                 --validateMappings -o lib_test \
                 -p $SLURM_CPUS_PER_TASK

# Extrair tipo de biblioteca detectado
grep "Library type" lib_test/logs/salmon_quant.log > lib_type.txt

Análise de Resultados

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

module load R/4.0.2

# Criar matriz de quantificação
cat > create_matrix.R << 'EOF'
library(tximport)
library(rhdf5)
library(ggplot2)

# Listar arquivos de quantificação
files <- list.files(path="quant", pattern="quant.sf",
                    recursive=TRUE, full.names=TRUE)
names(files) <- basename(dirname(files))

# Importar com tximport
txi <- tximport(files, type="salmon", txOut=TRUE)

# Matriz de contagem
counts <- txi$counts
tpm <- txi$abundance

write.table(counts, "counts_matrix.txt", sep="\t", quote=FALSE)
write.table(tpm, "tpm_matrix.txt", sep="\t", quote=FALSE)

# Estatísticas resumidas
stats <- data.frame(
    Sample = colnames(counts),
    Total_Counts = colSums(counts),
    Total_TPM = colSums(tpm),
    Detected = colSums(counts > 0)
)

write.table(stats, "summary_stats.txt",
            sep="\t", quote=FALSE, row.names=FALSE)

# PCA
pca <- prcomp(t(log2(tpm + 1)))
pca_df <- data.frame(pca$x[,1:2], Sample=colnames(tpm))

ggplot(pca_df, aes(x=PC1, y=PC2, label=Sample)) +
    geom_point() +
    geom_text(vjust=1, hjust=1) +
    theme_minimal() +
    labs(title="PCA das amostras")
ggsave("pca_plot.png", width=8, height=6)
EOF

Rscript create_matrix.R

Referências

Ver também