这个脚本将演示如何使用 Salmon 这种极其高效的“准比对”(Quasi-mapping)工具来直接对转录组进行定量。
这个脚本会自动化执行:构建索引、序列定量以及结果整理。
 

#!/bin/bash
#pp -nodes 100
# 1. Setting Variables
SAMPLE=$1
THREADS=8
INDEX_DIR="../references/transcripts_index"
TRANSCRIPTS="../references/target_transcripts.fa.gz"
FASTQ_DIR="../raw_data"
OUTPUT_DIR="../quants"
echo "--- Processing Sample: $SAMPLE ---"
# 2. Build Index (Only if it doesn't exist)
# Salmon requires a mapping index of the transcriptome
if [ ! -d "$INDEX_DIR" ]; then
    echo "[Step 1/2] Building Salmon index..."
    salmon index -t $TRANSCRIPTS -i $INDEX_DIR
else
    echo "[Skip] Index already exists, moving to quantification."
fi
# 3. Run Quantification
# Using paired-end reads; -l A automatically detects library type
echo "[Step 2/2] Running quantification (Salmon)..."
salmon quant -i $INDEX_DIR -l A \
         -1 ${FASTQ_DIR}/${SAMPLE}_1.fastq.gz \
         -2 ${FASTQ_DIR}/${SAMPLE}_2.fastq.gz \
         -p $THREADS \
         --validateMappings \
         -o ${OUTPUT_DIR}/${SAMPLE}_quant
# 4. Completion Summary
echo "--------------------------------------"
echo "Quantification for $SAMPLE finished."
echo "Results saved in: ${OUTPUT_DIR}/${SAMPLE}_quant/quant.sf"

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐