Bulk-RNA-seq流程——从测序数据到count文件(AGSdata)

  • 2022-2-11

软件安装

conda的安装和配置

wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod 777 Miniconda3-latest-Linux-x86_64.sh #给执行权限
bash Miniconda3-latest-Linux-x86_64.sh #运行

当命令行前面出现(base)的时候说明现在已经在conda的环境中了

conda config --add channels bioconda
conda config --add channels conda-forge

 清华镜像,哈工大镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/

conda config --add channels https://http://mirrors.hit.edu.cn/anaconda/cloud/
conda config --add channels https://http://mirrors.hit.edu.cn/anaconda/pkgs/free/
conda config --add channels https://http://mirrors.hit.edu.cn/anaconda/pkgs/main/

创建名为rna的环境变量:conda create -n rna python=2(许多软件依赖python2环境)环境退出:conda deactivate

#创建名为rna的环境变量,许多软件依赖python2环境
conda create -n rna python=2

To activate this environment, use
#
#     $ conda activate rna
#
# To deactivate an active environment, use
#
#     $ conda deactivate

conda安装生信软件

conda activate rna
# 很多软件需要python版本较低

conda install multiqc 
conda install trim-galore
conda install hisat2
conda install samtools
conda install RSeQC

测序数据处理

数据下载

axel -a "下载链接"

质控QC

fastqc生成质控报告,multiqc将各个样本的质控报告整合为一个。

#! /bin/bash
#	Used for RNA-seq data by FastQC and multiQC
#Usage
#	fastqc -o [output dir] --(no)extract -f [fastq|bam|sam] -c [contaminant file] seqfile1 .. seqfileN
#简写代码:fastqc -t 8 -o  seqfile1


cd /mnt/AGS_RNA-seq/raw_data

ls *gz | xargs fastqc -t 64
multiqc ./ 

质控报告

Bulk-RNA-seq流程——从测序数据到count文件(AGSdata)_第1张图片

 Bulk-RNA-seq流程——从测序数据到count文件(AGSdata)_第2张图片

 Bulk-RNA-seq流程——从测序数据到count文件(AGSdata)_第3张图片

Bulk-RNA-seq流程——从测序数据到count文件(AGSdata)_第4张图片

Basic Statistics

 从read水平来总览,判断测序质量。
Encoding :测序平台的版本,因为不同版本的 error p的计算方法不一样。
Total sequence:测序深度。一共测序的read数。是质量分析的主要参数。
Sequence length:测序长度。
%GC:GC碱基含量比,一般是物种特异性,比如人类是42%左右。 

Perbase sequence quality

 横坐标: 第1-100个测序得到的碱基
纵坐标: 测序质量评估。这里的Q=-10*lg10(error P),即20%代表1%的错误读取率,30%代表0.1%的错误读取率
箱型图: 红色线,是某个顺序下测序碱基所有测序质量的中位数。黄色块,是测序质量在25%-75%区域。蓝色线,平均数。
一般要求: 测序箱型图10%的线大于Q=20。Q20过滤法。

per tail sequence quality

 横坐标:同上。
纵坐标:tail的index编号。
目的:防止测序过程中某些tail受不可控因素测序质量低。
标准:蓝色表示质量高,浅色或暖色表示质量低,后续的分析可以去除低质量tail
 

trim_galore去除低质量reads

trim_galore的参数

trim_galore [options]
--quality  #设定phred quality阈值。默认20(99%的read质量),如果测序深度较深,可以设定25
--phred33       #设定记分方式,代表Q+33=ASCII码的方式来记分方式
--paired          # 对于双端结果,一对reads中若一个read因为质量或其他原因被抛弃,则对应的另一个read也抛弃。
--output_dir   #输出目录
--length        #设定长度阈值,小于此长度会被抛弃
--strency     #设定可以忍受的前后adapter重叠的碱基数,默认是1
-e  #设定默认质量控制数,默认是0.1,即ERROR rate大于10%的read 会被舍弃,如果添加来--paired参数则会舍弃一对reads

这小东西还挺贼,安装是连字符,运行就成了下划线

#! /bin/bash
cd /mnt/AGS_RNA-seq/clean_data
ls /mnt/AGS_RNA-seq/raw_data/*.R1.fastq.gz >1
ls /mnt/AGS_RNA-seq/raw_data/*.R2.fastq.gz >2
paste 1 2  > config


dir='/mnt/AGS_RNA-seq/clean_data'
cat config |while read id
do
        arr=(${id})
        fq1=${arr[0]}
        fq2=${arr[1]} 
trim_galore -q 20 --phred33 --length 36 --stringency 3 --paired $fq1 $fq2 -o $dir   
done 

数据比较大,2.5G的大概要十来分钟
 

再次QC检验cleandata

#! /bin/bash
ls /mnt/AGS_RNA-seq/clean_data/*gz | xargs fastqc -t 64
multiqc ./ 

mapping 

常用软件有star和HISAT2

下载索引文件

cd /mnt/AGS_RNA-seq/index_hisat2
axel https://genome-idx.s3.amazonaws.com/hisat/grch38_tran.tar.gz
tar zxvf grch38_tran.tar.gz
grch38_tran/
grch38_tran/genome_tran.5.ht2
grch38_tran/genome_tran.2.ht2
grch38_tran/genome_tran.3.ht2
grch38_tran/genome_tran.4.ht2
grch38_tran/make_grch38_tran.sh
grch38_tran/genome_tran.7.ht2
grch38_tran/genome_tran.8.ht2
grch38_tran/genome_tran.1.ht2
grch38_tran/genome_tran.6.ht2

HISAT2用法

HISAT2 version 2.1.0 by Daehwan Kim ([email protected], www.ccb.jhu.edu/people/infphilo)
Usage:
  hisat2 [options]* -x {-1 -2 | -U | --sra-acc } [-S ]

   Index filename prefix (minus trailing .X.ht2).
        Files with #1 mates, paired with files in .
             Could be gzip'ed (extension: .gz) or bzip2'ed (extension: .bz2).
        Files with #2 mates, paired with files in .
             Could be gzip'ed (extension: .gz) or bzip2'ed (extension: .bz2).
         Files with unpaired reads.
             Could be gzip'ed (extension: .gz) or bzip2'ed (extension: .bz2).
         Comma-separated list of SRA accession numbers, e.g. --sra-acc SRR353653,SRR353654.
       File for SAM output (default: stdout)

  , , can be comma-separated lists (no whitespace) and can be
  specified many times.  E.g. '-U file1.fq,file2.fq -U file3.fq'.
 

HISAT2参数


    -x
    参考基因组索引

你可能感兴趣的:(RNA-seq,linux,ubuntu)