samtools 工具
软件地址:
http://www.htslib.org/
功能三大版块 :
- Samtools
- Reading/writing/editing/indexing/viewing SAM/BAM/CRAM format
- BCFtools
- Reading/writing BCF2/VCF/gVCF files and calling/filtering/summarising SNP and short indel sequence variants
- HTSlib
- A C library for reading/writing high-throughput sequencing data
cd samtools-1.x # and similarly for bcftools and htslib./configure --prefix=/where/to/installmakemake installexport PATH=/where/to/install/bin:$PATH # for sh or bash users
Mapping
To prepare the reference for mapping you must first index ( BWT:Burrows Wheeler Transform 索引算法,耗时较长,安排好时间)
bwa index <ref.fa>
bwa mem -R '@RG\tID:foo\tSM:bar\tLB:library1' <ref.fa> <read1.fa> <read1.fa> > lane.sam
Ensure that the @RG information here is correct as this information is used by later tools. The SM field must be set to the name of the sample being processed, and LB field to the library.
samtools fixmate -O bam <lane.sam> <lane_fixmate.bam>
samtools sort -O bam -o <lane_sorted.bam> -T </tmp/lane_temp> <lane_fixmate.sam>
In order to reduce the number of miscalls of INDELs in your data it is helpful to realign your raw gapped alignment with the Broad’s GATK Realigner.
java -Xmx2g -jar GenomeAnalysisTK.jar -T RealignerTargetCreator -R <ref.fa> -I <lane.bam> -o <lane.intervals> --known <bundle/b38/Mills1000G.b38.vcf>
java -Xmx4g -jar GenomeAnalysisTK.jar -T IndelRealigner -R <ref.fa> -I <lane.bam> -targetIntervals <lane.intervals> --known <bundle/b38/Mills1000G.b38.vcf> -o <lane_realigned.bam>
BQSR from the Broad’s GATK allows you to reduce the effects of analysis artefacts produced by your sequencing machines. It does this in two steps, the first analyses your data to detect covariates and the second compensates for those covariates by adjusting quality scores.
java -Xmx4g -jar GenomeAnalysisTK.jar -T BaseRecalibrator -R <ref.fa> -knownSites >bundle/b38/dbsnp_142.b38.vcf> -I <lane.bam> -o <lane_recal.table>
java -Xmx2g -jar GenomeAnalysisTK.jar -T PrintReads -R <ref.fa> -I <lane.bam> --BSQR <lane_recal.table> -o <lane_recal.bam>
It is helpful at this point to compile all of the reads from each library together into one BAM, which can be done at the same time as marking PCR and optical duplicates. To identify duplicates we currently recommend the use of either the Picard or biobambam’s mark duplicates tool.
java -Xmx2g -jar MarkDuplicates.jar VALIDATION_STRINGENCY=LENIENT INPUT=<lane_1.bam> INPUT=<lane_2.bam> INPUT=<lane_3.bam> OUTPUT=<library.bam>
Once this is done you can perform another merge step to produce your sample BAM files.
samtools merge <sample.bam> <library1.bam> <library2.bam> <library3.bam>
samtools index <sample.bam>
Variant Calling
To convert your BAM file into genomic positions we first use mpileup to produce a BCF file that contains all of the locations in the genome.
bcftools mpileup -Ou -f <ref.fa> <sample1.bam> <sample2.bam> <sample3.bam> | bcftools call -vmO z -o <study.vcf.gz>
To prepare our VCF for querying we next index it using tabix:
tabix -p vcf <study.vcf.gz>
prepare graphs and statistics to assist you in filtering your variants:
bcftools stats -F <ref.fa> -s - <study.vcf.gz> > <study.vcf.gz.stats>
mkdir plots
plot-vcfstats -p plots/ <study.vcf.gz.stats>
filter data
bcftools filter -O z -o <study_filtered..vcf.gz> -s LOWQUAL -i'%QUAL>10' <study.vcf.gz>
Variant filtration is a subject worthy of an article in itself and the exact filters you will need to use will depend on the purpose of your study and quality and depth of the data used to call the variants.
注: 变异过滤要服从具体研究目的以及数据的质量和深度。
samtools 工具的更多相关文章
- the grave of my scripts
不定期更新.......... 1,fetch_seq.py https://github.com/freemao/AHRD/blob/master/fetch_seq.py 提取出你想要得染色体的某 ...
- snakemake使用小结
首先在linux 里配置conda 下载 wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linu ...
- SAM格式 及 比对工具之 samtools 使用方法
参考资料: SAMtools(官网) SAM Spec v1.4 (SAM格式 说明书) (重要) samtools-1.3.1 使用手册 (SAMtools软件说明书) samtools常用命令详解 ...
- samtools常用命令详解
samtools的说明文档:http://samtools.sourceforge.net/samtools.shtmlsamtools是一个用于操作sam和bam文件的工具合集.包含有许多命令.以下 ...
- 安装生物信息学软件-Samtools
装完Bowtie2,官方文档给出的栗子说可以玩一玩samtools,所以我入个坑 参考这篇http://m.010lm.com/roll/2016/0620/2343389.html Step 1: ...
- samtools常用命令详解(转)
转自:samtools常用命令详解 samtools的说明文档:http://samtools.sourceforge.net/samtools.shtml samtools是一个用于操作sam和ba ...
- 可视化工具之 IGV 使用方法
整合基因组浏览器(IGV)是一种高性能的可视化工具,用来交互式地探索大型综合基因组数据.它支持各种数据类型,包括array-based的和下一代测序的数据和基因注释. IGV这个工具很牛,发了NB: ...
- 推荐一个SAM文件或者bam文件中flag含义解释工具
SAM是Sequence Alignment/Map 的缩写.像bwa等软件序列比对结果都会输出这样的文件.samtools网站上有专门的文档介绍SAM文件.具体地址:http://samtools. ...
- SAMTOOLS使用 SAM BAM文件处理
[怪毛匠子 整理] samtools学习及使用范例,以及官方文档详解 #第一步:把sam文件转换成bam文件,我们得到map.bam文件 system"samtools view -bS m ...
随机推荐
- hbase命名空间
在HBase中,namespace命名空间指对一组表的逻辑分组,类似于数据库,便于对表在业务上划分 HBase系统默认定义了两个缺省的namespace hbase:系统内建表,包括namespace ...
- <、>&、<& 重定向符
<.>&.<& 重定向符 这三个命令也是管道命令,但它们一般不常用,你只需要知道一下就ok了,当然如果想仔细研究的话,可以自己查一下资料.(本人已查过,网上也查不到相 ...
- inotify用法简介及结合rsync实现主机间的文件实时同步
一.inotify简介 inotify是Linux内核2.6.13 (June 18, 2005)版本新增的一个子系统(API),它提供了一种监控文件系统(基于inode的)事件的机制,可以监控文件系 ...
- html资源 链接
http://m.aicai.com/index.do?agentId=1&vt=5
- 注释和取消注释 程序中的log日志
有点简单,但也是原创哦..亲测有效,期待指正. 更改了log多行的问题.. 例如//Log Util: 一.注释log import java.io.BufferedReader;import ...
- java中checked和unchecked 异常处理
有两种类型的异常:一种是checked异常一种是unchecked异常,在这篇文章中我们将利用实例来学习这两种异常,checked的异常和unchecked异常最大的区别就是checked去唱是在编译 ...
- Idea多个module下maven的pom.xml失效的问题
今天在Idea中配置spring-cloud时,配置了两个module,结果其中一个module的pom.xml失效了.. 解决方法: 1.点击Idea右侧的Maven Project 2.点击&qu ...
- Linux配置Hadoop 常用的命令
uname -a 看主机位数 ip a 看IP地址 vi /etc/sysconfig/network 改主机的名字 vi /etc/hosts 改映射关系 vi /etc/sysconfig/net ...
- Pie(浮点数二分)
Pie http://poj.org/problem?id=3122 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2454 ...
- 【校招面试 之 C/C++】第12题 C++ 重载、重写和重定义
1.成员函数重载特征: a.相同的范围(在同一个类中): b.函数名字相同: c.参数不同(参数个数不同或者参数类型不同,但是返回值不同不能使重载): d.virtual关键字可有可无. 2.重写 ...