RNA-Seq

Protocal for quality control and cut adaptor of RNA sequence

1. 数据预处理

1.1 FastQC质控

FastQC - A high throughput sequence QC analysis tool
FastQC reads a set of sequence files and produces from each one a quality control report consisting of a number of different modules, each one of which will help to identify a different potential type of problem in your data.

usage: fastqc [-o output dir] [--(no)extract] [-f fastq|bam|sam] [-c contaminant file] seqfile1 .. seqfileN

-o --outdir
Create all output files in the specified output directory. Please note that this directory must exist as the program will not create it. If this option is not set then the output file for each sequence file is created in the same directory as the sequence file which was processed.

mkdir fastqc_result.raw     #(建立输出文件夹)  
fastqc -q -t 3 -o ../fastqc_result.raw/ *.fq.gz &
fastqc -t 3 -o ./fastqc_result.raw/ *.fq.gz
#(使用fastqc质控软件,对所有raw_data进行质控检测)  

1.2 MultiQC整合质控文件

MultiQC aggregates results from bioinformatics analyses across many samples into a single report.
It searches a given directory for analysis logs and compiles a HTML report. It's a general use tool, perfect for summarising the output from numerous bioinformatics tools.

usage: multiqc [OPTIONS] <analysis directory>

-o, --outdir TEXT
Create report in the specified output directory.

For tips for MultiQC, please visit the following website: https://www.youtube.com/watch?v=qPbIlO_KWN0

multiqc -o ./MultiQC ./
#(这一步就是对 fastqc_reault 文件夹下所有文件进行整合)

1.3 FASTX-Toolkit

根据质控结果,去除不良序列
The FASTX-Toolkit is a collection of command line tools for Short-Reads FASTA/FASTQ files preprocessing. Detailed information was provided in http://hannonlab.cshl.edu/fastx_toolkit/.

This section used the 'FASTQ/A Trimmer' function of FASTX-Toolkit/FASTX-Toolkit.

usage: fastx_trimmer [-h] [-f N] [-l N] [-z] [-v] [-i INFILE] [-o OUTFILE]

[-f N] = First base to keep. Default is 1 (=first base).
[-l N] = Last base to keep. Default is entire read.
[-z] = Compress output with GZIP.
[-i INFILE] = FASTA/Q input file. default is STDIN.
[-o OUTFILE] = FASTA/Q output file. default is STDOUT.

fastx_trimmer命令不支持压缩格式的输入文件,因此需要先zcat处理
Tips: | 为管道函数

zcat hela_ctrl_rep1_R1.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_ctrl_rep1_R1.fq.gz &  
zcat hela_ctrl_rep2_R1.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_ctrl_rep2_R1.fq.gz &  
zcat hela_ctrl_rep2_R2.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_ctrl_rep2_R2.fq.gz &  
zcat hela_ctrl_rep1_R2.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_ctrl_rep1_R2.fq.gz &  
zcat hela_treat_rep1_R1.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_treat_rep1_R1.fq.gz &  
zcat hela_treat_rep1_R2.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_treat_rep1_R2.fq.gz &  
zcat hela_treat_rep2_R1.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_treat_rep2_R1.fq.gz &  
zcat hela_treat_rep2_R2.fq.gz  | fastx_trimmer -f 11 -l 140 -z -o out_treat_rep2_R2.fq.gz &  

1.4 Cutadapt

去掉read两端的adaptor
Install: python3 -m pip install --user --upgrade cutadapt
Detailed information was provided in: https://cutadapt.readthedocs.io/en/stable/guide.html#basic-usage

Usage: cutadapt -a ADAPTER [options] [-o output.fastq] input.fastq

Tips: nohup:不挂断地运行命令
--times 1 一条序列只去一次Adaptor
-e 0.1 在匹配时可以有10%的错误率
-o 3 adaptor序列必须和测序序列有3个碱基以上的overlap才可以
-quality-cutoff 常用6
-m 50如果处理之后低于50的话就扔掉序列,短序列测序质量可能不是很好;
-a和-A是 Illumina 常用的通用引物,之所以输入两个,是因为是一个双端测序的结果,需要对两个文件内容进行分别去除,
-a对应 reads1
-A对应 reads2
-o 上一步输出 fastq1
-p 上一步输出 fastq2

nohup cutadapt --times 1 -e 0.1 -o 3 --quality-cutoff 6 -m 50 -a AGATCGGAAGAGC -A AGATCGGAAGAGC -o cut_out_ctrl_rep1_R1.fq.gz -p cut_out_ctrl_rep1_R2.fq.gz out_ctrl_rep1_R1.fq.gz out_ctrl_rep1_R2.fq.gz &  
nohup cutadapt --times 1 -e 0.1 -o 3 --quality-cutoff 6 -m 50 -a AGATCGGAAGAGC -A AGATCGGAAGAGC -o cut_out_ctrl_rep2_R1.fq.gz -p cut_out_ctrl_rep2_R2.fq.gz out_ctrl_rep2_R1.fq.gz out_ctrl_rep2_R2.fq.gz &  
nohup cutadapt --times 1 -e 0.1 -o 3 --quality-cutoff 6 -m 50 -a AGATCGGAAGAGC -A AGATCGGAAGAGC -o cut_out_treat_rep1_R1.fq.gz -p cut_out_treat_rep1_R2.fq.gz out_treat_rep1_R1.fq.gz out_treat_rep1_R2.fq.gz &  
nohup cutadapt --times 1 -e 0.1 -o 3 --quality-cutoff 6 -m 50 -a AGATCGGAAGAGC -A AGATCGGAAGAGC -o cut_out_treat_rep2_R1.fq.gz -p cut_out_treat_rep2_R2.fq.gz out_treat_rep2_R1.fq.gz out_treat_rep2_R2.fq.gz &  

2. STAR 建立 index

install: conda install -c bioconda star
Usage:
STAR [options]... --genomeDir /path/to/genome/index/ --readFilesIn R1.fq R2.fq

2.1 STAR align标准用法

STAR --runThreadN 6 --runMode genomeGenerate --genomeDir ./STARindex --genomeFastaFiles ./Homo_sapiens.GRCh38.dna.primary_assembly.fa  --sjdbGTFfile ./Homo_sapiens.GRCh38.104.gtf --sjdbOverhang 100

详解:

STAR 
--runThreadN 8 #线程数
--runMode genomeGenerate
--genomeDir ./STARindex #index输出的路径
--genomeFastaFiles ./Homo_sapiens.GRCh38.dna.primary_assembly.fa  #参考基因组
--sjdbGTFfile ./Homo_sapiens.GRCh38.104.gtf #参考基因组注释文件
--sjdbOverhang 100 #reads长度的最大值减1,默认是100,一般为reads长度-1(150-1)

2.2 STAR align 简单版本

STAR --runThreadN 8 \
--genomeDir ./STARindex \
--readFilesCommand zcat \
--readFilesIn hela_treat_rep2_R1.fq.gz hela_treat_rep2_R2.fq.gz \
--outFileNamePrefix ./Alignment/treat_rep2_ \
--outSAMtype BAM SortedByCoordinate \
--outBAMsortingThreadN 8 \
--quantMode TranscriptomeSAM GeneCounts 

详解

STAR 
--runThreadN 10 
--genomeDir ./STARindex #索引目录
--readFilesCommand zcat #执行解压缩
--readFilesIn cut_out_ctrl_rep1_R1.fq.gz cut_out_ctrl_rep1_R2.fq.gz #输入paired reads文件
--outFileNamePrefix ./Alignment/sample1_  #输出文件加前缀
--outSAMtype BAM SortedByCoordinate #表示输出默认排序的bam文件
--outBAMsortingThreadN 5 #设置排序中的线程数
--quantMode TranscriptomeSAM GeneCounts #将上面基因组比对的信息转化为转录本比对的信息,count

2.3 samtools

samtools (Tools for alignments in the SAM format)
查看bam 文件,每个基因上有多少个reads 的统计信息的bam文件,从原始的read信息到比对文件的过程

samtools view sample2_Aligned.sortedByCoord.out.bam |head

3. 表达定量

3.1 RSEM + featurecount

3.1.1 RSEM

转录组数据计算表达定量

RSEM is a software package for estimating gene and isoform expression levels from RNA-Seq data. The RSEM package provides an user-friendly interface, supports threads for parallel computation of the EM algorithm, single-end and paired-end read data, quality scores, variable-length reads and RSPD estimation. In addition, it provides posterior mean and 95% credibility interval estimates for expression levels. For visualization, It can generate BAM and Wiggle files in both transcript-coordinate and genomic-coordinate. Genomic-coordinate files can be visualized by both UCSC Genome browser and Broad Institute's Integrative Genomics Viewer (IGV). Transcript-coordinate files can be visualized by IGV. RSEM also has its own scripts to generate transcript read depth plots in pdf format. The unique feature of RSEM is, the read depth plots can be stacked, with read depth contributed to unique reads shown in black and contributed to multi-reads shown in red. In addition, models learned from data can also be visualized. Last but not least, RSEM contains a simulator.

Install: conda install -c bioconda rsem

Rsem prepare reference
从参考基因组中提取原始准备文件

rsem-prepare-reference --gtf \
./Homo_sapiens.GRCh38.104.gtf \ ./Homo_sapiens.GRCh38.dna.primary_assembly.fa \
./arab_RSEM/arab_rsem #保存位置
rsem-calculate-expression --paired-end --no-bam-output --alignments -p 8 -q ./Alignment/treat_rep2_Aligned.toTranscriptome.out.bam ./arab_RSEM/arab_rsem rsem_out/treat_rep2_1rsem

3.1.2 featurecount

install conda install -c bioconda subread

featureCounts 
-p #双端
-a ../00ref/Araport11_GFF3_genes_transposons.201606.gtf #基因组注释文件
-o out_counts.txt #输出文件
-T 8 #使用的线程数
-t exon #通过什么来进行定量,输出什么结果   所有要定量的文件
-g gene_id sample*Aligned.sortedByCoord.out.bam
featureCounts -p -a ././Homo_sapiens.GRCh38.104.gtf -o out_counts.txt -T 8 -t exon -g gene_id ./Alignment/*Aligned.sortedByCoord.out.bam

featureCounts -p -a ../00ref/genes.gtf -o Z-13-1_out_counts.txt -T 10 -t exon -g *L1*dm6_Aligned.sortedByCoord.out.bam

featureCounts -p -a ../00ref/genes.gtf -o out_counts.txt -T 20 -t exon -g gene_id

featureCounts -p -a ../00ref/genes.gtf -o out_counts.txt -T 6 -t exon -g gene_id zgq-*_accepted_hits.bam

构建表达矩阵

mkdir 06deseq_out
rsem-generate-data-matrix *rsem.genes.results > output.matrix

#删除未检测到表达的基因
awk 'BEGIN{printf "geneid\ta1\ta2\tb1\tb2\n"}{if($2+$3+$4+$5>0)print $0}' output.matrix > deseq2_input.txt

#查看文件的行数
wc -l output.matrix 
wc -l deseq2_input.txt 

mv deseq2_input.txt ../06deseq_out/
mv deseq2.r ../06deseq_out/

abundance_estimates_to_matrix.pl
run_DE_analysis.pl

3.2 kallisto

install conda install -c bioconda kallisto
不比对,直接定量

先构建索引 index,/arab_kallisto目录下
kallisto index -i arab_kallisto ./arab_RSEM/arab_rsem.transcripts.fa

kallisto进行定量

kallisto quant -i Dro_kallisto/Dro_kallisto -o 05kallisto_out/sample2 02clean_data/R1.gz 02clean_data/R2.gz
kallisto quant -i Dro_kallisto/Dro_kallisto -o 05kallisto_out/Z-1 ../../Data_cy/20181018-embryo-RIP-seq\ data/Z-13-1_L1_310310.R1.clean.fastq.gz ../../Data_cy/20181018-embryo-RIP-seq\ data/Z-13-1_L1_310310.R2.clean.fastq.gz 
#abundance.tsv    列:gene   counts   TPM

参考: https://www.jianshu.com/p/ad605d4fa6f6

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,132评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,802评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,566评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,858评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,867评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,695评论 1 282
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,064评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,705评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,915评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,677评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,796评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,432评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,041评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,992评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,223评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,185评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,535评论 2 343

推荐阅读更多精彩内容