专栏名称: 生信媛
生信媛,从1人分享,到8人同行。坚持分享生信入门方法与课程,持续记录生信相关的分析pipeline, python和R在生物信息学中的利用。内容涵盖服务器使用、基因组转录组分析以及群体遗传。
目录
相关文章推荐
51好读  ›  专栏  ›  生信媛

一个超简单的转录组项目全过程--iMac+RNA-Seq(四)featureCounts

生信媛  · 公众号  · 生物  · 2019-07-05 17:06

正文

请到「今天看啥」查看全文



前期文章

一个超简单的转录组项目全过程--iMac+RNA-Seq(一)

一个超简单的转录组项目全过程--iMac+RNA-Seq(二)QC

一个超简单的转录组项目全过程--iMac+RNA-Seq(三)Alignment 比对

4 featureCounts

比对结束后需要进行计数咯!

老规矩,先看说明书。

  1. featureCounts -h ## 好像发现了什么不得了的

  2. $featureCounts -h

  3. featureCounts: invalid option -h

Version 1.6.2

Usage: featureCounts [options] -a -o input file1 [input file2] ...

-T number of threads

-p If specified, fragments (or templates) will be counted instead of reads. This option is only applicable for paired-end reads .

-t Specify feature type in GTF annotation. 'exon' by default . Features used for read counting will be extracted from annotation using the provided value.

-g Specify attribute type in GTF annotation. ' gene_id' by default . Meta-features used for read counting will be extracted from annotation using the provided value.

-a Name of an annotation file. GTF/GFF format by defaul t. See -F option for more format information. Inbuilt annotations (SAF format) is available in 'annotation' directory of the package. Gzipped file is also accepted.

-o N ame of the output file including read counts . A separate file including summary statistics of counting results is also included in the output (' .summary')

用法一

  1. ## 教程代码,使用for循环

  2. mkdir $wkd/align #这样会生成单个的,每个都有自己的名字

  3. cd $wkd/align


  4. source activate rna

  5. for fn in {512..520}

  6. do

  7. featureCounts -T 4 -p -t exon -g gene_id \

  8. -a /Users/bioinformatic/reference/hg38/hg38.gtf \

  9. -o counts.SRR1039$fn.txt /home/rna/clean/SRR1039$fn.hisat.bam

  10. done

  11. source deactivate

用法二:酷酷的

  1. vim count.sh ## 创建一个脚本叫做count


  2. #!/bin/bash

  3. set -e

  4. set -u

  5. set -o pipefail


  6. # set PATH 设置路径

  7. HUMAN=/Users/bioinformatic/reference/hg38

  8. OUTDIR =/Users/Desktop/project/clean/align


  9. # source activate rna

  10. cd $OUTDIR # 打开目标文件夹


  11. pwd ## 显示当前路径


  12. ls *bam | cut -d"_" -f 1| sort -u |\

  13. while read id

  14. do # 用echo语句来提示脚本运行进度

  15. echo "processing ${id}_combined.hisat.bam"

  16. if [ ! -f ${id}.hisat.done ]

  17. then

  18. featureCounts -T 4 -p \

  19. -t exon -g gene_id -a $HUMAN/hg38 .gtf \

  20. -o counts.${id}.txt \

  21. $OUTDIR/${id}_combined.hisat.bam && touch ${id}.hisat.done

  22. fi


  23. done


  24. # source deactivate

Note:脚本很长的时候,记得使用“\”符号加回车,让行文变得整洁易读。

运行脚本

nohup bash count.sh &

查看结果

cat nohup.out就可以看到featureCounts的运行日志,请注意以下两个数据

  1. 26834745 (92.89%) aligned concordantly exactly 1 time

  2. 97.89% overall alignment rate

小结:本章所需知识背景和技能

(1)基因表达量的计算到底在算什么?

(2)TPM, RPKM, FPKM这几个计量方式的区别

(3)学会查看帮助文档,了解软件用法

(4)nohup是什么,nohup和&的区别等等

用法二的知识点

在酷酷的用法二里面有几个很酷的地方:

  1. #!/bin/bash

  2. set -e

  3. set -u

  4. set -o pipefail


  5. # touch的用法


  6. # if then fi 语句的使用

shell脚本和正则表达式:必学








请到「今天看啥」查看全文