samtools view 和 sort
前者转化文件格式,后者将sam(比对地图)按照header位置或者reads名字排序,一般默认是位置。
下面引用其他人的笔记
samtools view
Usage: samtools view [options] <in.bam>|<in.sam>|<in.cram> [region ...]
Options:
-b output BAM
-C output CRAM (requires -T)
-1 use fast BAM compression (implies -b)
-u uncompressed BAM output (implies -b)
-h include header in SAM output
-H print SAM header only (no alignments)
-c print only the count of matching records
-o FILE output file name [stdout]
-U FILE output reads not selected by filters to FILE [null]
-t FILE FILE listing reference names and lengths (see long help) [null]
-L FILE only include reads overlapping this BED FILE [null]
-r STR only include reads in read group STR [null]
-R FILE only include reads with read group listed in FILE [null]
-q INT only include reads with mapping quality >= INT [0]
-l STR only include reads in library STR [null]
-m INT only include reads with number of CIGAR operations consuming
query sequence >= INT [0]
-f INT only include reads with all of the FLAGs in INT present [0]
-F INT only include reads with none of the FLAGS in INT present [0]
-G INT only EXCLUDE reads with all of the FLAGs in INT present [0]
-s FLOAT subsample reads (given INT.FRAC option value, 0.FRAC is the
fraction of templates/read pairs to keep; INT part sets seed)
-M use the multi-region iterator (increases the speed, removes
duplicates and outputs the reads as they are ordered in the file)
-x STR read tag to strip (repeatable) [null]
-B collapse the backward CIGAR operation
-? print long help, including note about region specification
-S ignored (input format is auto-detected)
--input-fmt-option OPT[=VAL]
Specify a single input file format option in the form
of OPTION or OPTION=VALUE
-O, --output-fmt FORMAT[,OPT[=VAL]]...
Specify output format (SAM, BAM, CRAM)
--output-fmt-option OPT[=VAL]
Specify a single output file format option in the form
of OPTION or OPTION=VALUE
-T, --reference FILE
Reference sequence FASTA FILE [null]
-@, --threads INT
Number of additional threads to use [0]
以上是官方,
Usage: samtools view [options] <in.bam>|<in.sam> [region1 [...]]
默认情况下不加 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
#################################################################
sort
Usage: samtools sort [options...] [in.bam]
Options:
-l INT Set compression level, from 0 (uncompressed) to 9 (best)
-m INT Set maximum memory per thread; suffix K/M/G recognized [768M]
-n Sort by read name
-t TAG Sort by value of TAG. Uses position as secondary index (or read name if -n is set)
-o FILE Write final output to FILE rather than standard output
-T PREFIX Write temporary files to PREFIX.nnnn.bam
--input-fmt-option OPT[=VAL]
Specify a single input file format option in the form
of OPTION or OPTION=VALUE
-O, --output-fmt FORMAT[,OPT[=VAL]]...
Specify output format (SAM, BAM, CRAM)
--output-fmt-option OPT[=VAL]
Specify a single output file format option in the form
of OPTION or OPTION=VALUE
--reference FILE
Reference sequence FASTA FILE [null]
-@, --threads INT
Number of additional threads to use [0]
sort命令格式如下:
samtools sort [-l level] [-m maxMem] [-o out.bam] [-O format] [-n] [-T tmpprefix] [-@ threads] [in.sam|in.bam|in.cram]
参数:
-l INT 设置输出文件压缩等级。0-9,0是不压缩,9是压缩等级最高。不设置此参数时,使用默认压缩等级;
-m INT 设置每个线程运行时的内存大小,可以使用K,M和G表示内存大小。
-n 设置按照read名称进行排序;
-o FILE 设置最终排序后的输出文件名;
-O FORMAT 设置最终输出的文件格式,可以是bam,sam或者cram,默认为bam;
-T PREFIX 设置临时文件的前缀;
-@ INT 设置排序和压缩是的线程数量,默认是单线程。
————————————————
sort
sort对bam文件进行排序。
Usage: samtools sort [-n] [-m <maxMem>] <in.bam> <out.prefix>
-m 参数默认下是 500,000,000 即500M(不支持K,M,G等缩写)。对于处理大数据时,如果内存够用,则设置大点的值,以节约时间。
-n 设定排序方式按short reads的ID排序。默认下是按序列在fasta文件中的顺序(即header)和序列从左往右的位点排序。
samtools view 和 sort相关推荐
- Samtools view转sam为bam报错[main_samview] truncated file.
报错分析:在shell里加nohup &bwa比对出来的sam文件里面有除注释行和比对结果以外的不明信息,转bam格式时会报错 [W::sam_read1] parse error at li ...
- samtools常用命令详解
samtools的说明文档:http://samtools.sourceforge.net/samtools.shtml samtools是一个用于操作sam和bam文件的工具合集.包含有许多命令.以 ...
- Samtools应用指南-处理Sam与Bam文件
安装 去官网下载想要的版本 tar jxvf samtools-1.9.tar.bz2 cd samtools-1.9 ./configure --prefix=全路径/samtools-1.9 ma ...
- samtools 常用命令详解
samtools是一个用于操作sam和bam文件的工具合集.包含有许多命令.以下是常用命令的介绍 1. view view命令的主要功能是:将sam文件转换成bam文件:然后对bam文件进行各种操作, ...
- 生信技能-高通量测序工具bam、samtools、bedtools及conda的下载和安装
一.BWA 1.介绍 简介:用于建立 index:基于 BWT 算法,将 reads 比对到参考基因组:最新版本 bwa-mem2,Intel实验室对计算效率进行了优化. 详情:baw是一款将序列比对 ...
- 关于samtools
http://www.chenlianfu.com/?p=1399 q30.bam 文件是为了对质量进行控制 而过滤是为了去除PCR等重复,既可以使用samtools也可以使用picard Optio ...
- samtools使用
samtools的说明文档:http://samtools.sourceforge.net/samtools.shtml samtools是一个用于操作sam和bam文件的工具合集.包含有许多命令.以 ...
- samtools使用总结
1. view view命令的主要功能是:将sam文件转换成bam文件:然后对bam文件进行各种操作,比如数据的排序(不属于本命令的功能)和提取(这些操作是对bam文件进行的,因而当输入为sam文件的 ...
- ATAC-seq【Harvard FAS Informatics】
ATAC-seq数据质量评估注意 ENCODE的ATACseq数据标准. Uniform Processing Pipeline Restrictions The read length prior ...
最新文章
- jsp实现简单的分页
- 深度学习之单目深度估计:无监督学习篇
- c++ console 取实时输入_灵活使用 console 让 js 调试更简单
- 历史回顾——NLP问题解决方案的演变史
- poj Muddy Fields
- 设置TDSAuthenticationManager属性对DataSnap服务端的接口授权
- netty : websocketx.WebSocketHandshakeException: not a WebSocket handshake request: missing upgrade
- ubuntu自定义分辨率
- AlertDialog用法。
- 基于SSM框架和easyUI框架的简易人事管理系统(六)
- 基于Spark的电影推荐系统(推荐系统~2)
- c盘空间太小怎么办 c盘如何扩展分区
- 华为 2020暑期实习 面试回忆
- maya表情blendshape_【Maya】角色表情绑定-BlendShape的使用技巧
- CentOS配置yum源-本地和在线
- 2014 360校园招聘技术类笔试题
- HarmonyOS应用开发 — HelloWorld应用开发E2E体验
- WAF学习之一——Nginx与反向代理
- 仓库码放要求_仓库货物堆放标准是怎样的?货物堆放原则和方法详解
- 大流量滤芯保安过滤器