打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Samtools(CentOS Linux)安装及常用命令详解

序列比对(将测序reads与已知序列信息的基因或基因组进行比对)是高通量测序数据分析中最重要的一环,无论是转录组还是重测序都是基于比对结果来进行后续各项分析的,比对结果格式比较常见的是sam和bam文件,例如转录组Tophat分析软件输出的比对结果为.bam文件,而重测序中BWA、bowtie等比对软件则主要输出为.sam文件。

samtools是一个用于操作sam和bam文件的工具软件,能够对比对文件进行二进制查看、格式转换、排序及合并等,结合sam格式中的flag、tag等信息,还可以完成比对结果的统计汇总,是处理sam和bam文件不可或缺的神器!


1.下载安装包

http://www.htslib.org/download/

2. 安装依赖

yum install bzip2-devel ncurses-libs ncurses-devel xz-devel zlib-devel

3.编译安装

  1. tar xvf samtools-1.9.tar.bz2

  2. cd samtools-1.9

  3. ./configure --prefix=/opt/samtools1.9

  4. make

  5. make install

4.配置环境变量

  1. gedit ~/.bashrc

  2. #Samtools1.9

  3. export PATH=/opt/samtools1.9/bin:$PATH

  4. source ~/.bashrc

5.运行:samtools

samtools常用命令详解

1. view

view命令的主要功能是:将sam文件转换成bam文件;然后对bam文件进行各种操作,比如数据的排序(不属于本命令的功能)和提取(这些操作是对bam文件进行的,因而当输入为sam文件的时候,不能进行该操作);最后将排序或提取得到的数据输出为bam或sam(默认的)格式。

bam文件优点:bam文件为二进制文件,占用的磁盘空间比sam文本文件小;利用bam二进制文件的运算速度快。

view命令中,对sam文件头部的输入(-t或-T)和输出(-h)是单独的一些参数来控制的。

  1. Usage: samtools view [options] <in.bam>|<in.sam> [region1 [...]]

  2. 默认情况下不加 region,则是输出所有的 region.

  3. Options: -b       output BAM

  4.                  默认下输出是 SAM 格式文件,该参数设置输出 BAM 格式

  5.         -h       print header for the SAM output

  6.                  默认下输出的 sam 格式文件不带 header,该参数设定输出sam文件时带 header 信息

  7.         -H       print header only (no alignments)

  8.         -S       input is SAM

  9.                  默认下输入是 BAM 文件,若是输入是 SAM 文件,则最好加该参数,否则有时候会报错。

  10.         -u       uncompressed BAM output (force -b)

  11.                  该参数的使用需要有-b参数,能节约时间,但是需要更多磁盘空间。

  12.         -c       Instead of printing the alignments, only count them and print the

  13.                  total number. All filter options, such as '-f’, '-F and '-q ,

  14.                  are taken into account.

  15.         -1       fast compression (force -b)

  16.         -x       output FLAG in HEX (samtools-C specific)

  17.         -X       output FLAG in string (samtools-C specific)

  18.         -c       print only the count of matching records

  19.         -L FILE  output alignments overlapping the input BED FILE [null]

  20.         -t FILE  list of reference names and lengths (force -S) [null]

  21.                  使用一个list文件来作为header的输入

  22.         -T FILE  reference sequence file (force -S) [null]

  23.                  使用序列fasta文件作为header的输入

  24.         -o FILE  output file name [stdout]

  25.         -R FILE  list of read groups to be outputted [null]

  26.         -f INT   required flag, 0 for unset [0]

  27.         -F INT   filtering flag, 0 for unset [0]

  28.                  Skip alignments with bits present in INT [0]

  29.                  数字4代表该序列没有比对到参考序列上

  30.                  数字8代表该序列的mate序列没有比对到参考序列上

  31.         -q INT   minimum mapping quality [0]

  32.         -l STR   only output reads in library STR [null]

  33.         -r STR   only output reads in read group STR [null]

  34.         -s FLOAT fraction of templates to subsample; integer part as seed [-1]

  35.         -?       longer help


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
啥?在 windows 下用 samtools,对SAM排序得到Pos.Sorted.BAM ?
[samtools]sort命令简介
软件介绍之Samtools
生信分析过程中这些常见文件的格式以及查看方式你都知道吗?
转录组学习五(reads比对)
Biostar:课程19、20
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服