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.編譯安裝
tar xvf samtools-1.9.tar.bz2
cd samtools-1.9
./configure --prefix=/opt/samtools1.9
make
make install
4.配置環境變量
gedit ~/.bashrc
#Samtools1.9
export PATH=/opt/samtools1.9/bin:$PATH
source ~/.bashrc
5.運行:samtools
samtools常用命令詳解
1. view
view命令的主要功能是:將sam文件轉換成bam文件;然后對bam文件進行各種操作,比如數據的排序(不屬于本命令的功能)和提取(這些操作是對bam文件進行的,因而當輸入為sam文件的時候,不能進行該操作);最后將排序或提取得到的數據輸出為bam或sam(默認的)格式。
bam文件優點:bam文件為二進制文件,占用的磁盤空間比sam文本文件小;利用bam二進制文件的運算速度快。
view命令中,對sam文件頭部的輸入(-t或-T)和輸出(-h)是單獨的一些參數來控制的。
Usage: samtools view [options]
默認情況下不加 region,則是輸出所有的 region.
Options: -b ? ? ? output BAM
默認下輸出是 SAM 格式文件,該參數設置輸出 BAM 格式
-h ? ? ? print header for the SAM output
默認下輸出的 sam 格式文件不帶 header,該參數設定輸出sam文件時帶 header 信息
-H ? ? ? print header only (no alignments)
-S ? ? ? input is SAM
默認下輸入是 BAM 文件,若是輸入是 SAM 文件,則最好加該參數,否則有時候會報錯。
-u ? ? ? uncompressed BAM output (force -b)
該參數的使用需要有-b參數,能節約時間,但是需要更多磁盤空間。
-c ? ? ? Instead of printing the alignments, only count them and print the
total number. All filter options, such as ‘-f’, ‘-F’ and ‘-q’ ,
are taken into account.
-1 ? ? ? fast compression (force -b)
-x ? ? ? output FLAG in HEX (samtools-C specific)
-X ? ? ? output FLAG in string (samtools-C specific)
-c ? ? ? print only the count of matching records
-L FILE ?output alignments overlapping the input BED FILE [null]
-t FILE ?list of reference names and lengths (force -S) [null]
使用一個list文件來作為header的輸入
-T FILE ?reference sequence file (force -S) [null]
使用序列fasta文件作為header的輸入
-o FILE ?output file name [stdout]
-R FILE ?list of read groups to be outputted [null]
-f INT ? required flag, 0 for unset [0]
-F INT ? filtering flag, 0 for unset [0]
Skip alignments with bits present in INT [0]
數字4代表該序列沒有比對到參考序列上
數字8代表該序列的mate序列沒有比對到參考序列上
-q INT ? minimum mapping quality [0]
-l STR ? only output reads in library STR [null]
-r STR ? only output reads in read group STR [null]
-s FLOAT fraction of templates to subsample; integer part as seed [-1]
-? ? ? ? longer help
更多內容閱讀原文~
CentOS linux
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。