创建项目
cd /data/project
mkdir -p GSE137675 && cd GSE137675
workdir=/data/project/GSE137675
- 下载原始FastQ数据
cd ${workdir}
mkdir -p fq
cd fq
1.1 使用循环创建下载地址文件
for i in {78..89}
do
echo "fasp.sra.ebi.ac.uk:/vol1/fastq/SRR101/0${i}/SRR101397${i}/SRR101397${i}_1.fastq.gz";
echo "fasp.sra.ebi.ac.uk:/vol1/fastq/SRR101/0${i}/SRR101397${i}/SRR101397${i}_2.fastq.gz";
done > fileID
1.2 编写批量下载脚本aspera.sh
cat fileID | while read id
do
~/.aspera/connect/bin/ascp -QT -l 50m -P33001 \
-i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh \
era-fasp@${id} .
done
1.3 运行脚本aspera.sh批量下载FastQ文件
nohup bash aspera.sh 1>../aspera.log 2>&1 &
- 对原始测序FastQ文件进行质量评估
conda activate rna
cd ${workdir}
nohup fastqc -t 6 -o ./qc/ ./fq/*.gz 1>fastqc.log 2>&1 &
multiqc -o ./qc/ ./qc/*
- 对FastQ文件进行过滤
conda activate rna
cd ${workdir}
mkdir clean && cd clean
ln -s /data/project/GSE137675/fq/*.gz ./
3.1 编写批量运行脚本fastp.sh
for i in $(ls *_1.fastq.gz)
do
i=${i%_1.fastq.gz}
fastp -i ${i}_1.fastq.gz -o ${i}_1.fastp.fq.gz \
-I ${i}_2.fastq.gz -O ${i}_2.fastp.fq.gz \
-l 18 -q 20 --compression=6 \
-R ${i} -h ${i}.fastp.html -j ${i}.fastp.json \
1>${i}.fastp.log 2>&1
done
3.2 运行fastp.sh脚本批量修剪过滤
nohup bash fastp.sh 1>../trim.log 2>&1 &
3.3 对fastp修剪过滤后的结果质量评估
conda activate rna
cd ${workdir}
mkdir clean_qc
nohup fastqc -t 6 -o ./clean_qc/ ./clean/*.fastp.fq.gz 1>clean.log 2>&1 &
cd clean_qc
multiqc -o ./ *.zip
- 比对到参考基因组
conda activate rna
cd ${workdir}
makdir -p mapping && cd mapping
ln -s /data/project/GSE137675/clean/*.fastp.fq.gz ./
4.1 编写批量比对脚本hisat2.sh
index=/data/reference/index/hisat2/hg38/hg38/genome
ls *_1.fastp.fq.gz | while read id
do
id=${id/_1.fastp.fq.gz/};
hisat2 -p 6 -x ${index} -1 ${id}_1.fastp.fq.gz \
-2 ${id}_2.fastp.fq.gz 2>${id}.hisat2.log | \
samtools sort -@ 6 -o ${id}.hisat2.sort.bam -
done
4.2 运行hisat2.sh脚本批量比对
nohup bash hisat2.sh 1>../mapping.log 2>&1 &
4.3 文献中存在一个过滤条件比对质量>=20
,编写过滤脚本filter.sh
ls *.sort.bam | while read id
do
id=${id%.hisat2.sort.bam}
samtools view -@ 6 -q 20 -o ${id}.sort.filter.bam ${id}.hisat2.sort.bam
done
4.4 运行filter.sh脚本批量过滤
nohup bash filter.sh 1>../filter.log 2>&1 &
4.5 对bam文件进行统计
ls *.filter.bam | while read id
do
samtools flagstat -@ 6 ${id} > ./flagstat/${id/bam/flagstat}
done
- featureCounts计数
conda activate rna
cd ${workdir}
mkdir -p counts && cd counts/
ln -s /data/project/GSE137675/mapping/*.filter.bam ./
ls *.bam | while read id; do mv ${id} ${id%.sort.filter.bam}; done
gtf=/data/reference/gtf/hg38/gencode.v33.annotation.gtf.gz
nohup featureCounts -T 6 -p \
-t exon -g gene_id \
-a $gtf -o all.id.txt * \
1>../counts.log 2>&1 &
cut -f1,7- all.id.txt > counts.txt
cat counts.txt | less -S