BWA MEM算法

现在BWA大家基本上只用其mem算法了,无论是二代还是三代比对到参考基因组上,BWA应用得最多的就是在重测序方面。

Aligning sequence reads, clone sequences and assembly contigs with BWA-MEM - arXiv:1303.3997v2

摘要

BWA-MEM is a new alignment algorithm for aligning sequence reads or assembly contigs against a large reference
genome such as human.  MEM是bwa中最新的算法,基本取代了前两种,目的是将测序reads或组装的contig比对到Reference上。

It automatically chooses between local and end-to-end alignments, supports paired-end reads and performs chimeric alignment.   MEM自动选择局部或全局比对,支持paired-end和嵌合体比对。

The algorithm is robust to sequencing errors and applicable to a wide range of sequence lengths from 70bp to a few megabases.   MEM算法很健壮,支持多种错误类型,可以应用到一系列长度的reads比对上,简单来说就是可以比对短reads,又可以比对长的contig,还可以比对长的PB reads,它们的错误率都是不同的。(但是最好是比对到Reference上,而且不能三代比三代,不能二代比三代,也不能二代比二代)

For mapping 100bp sequences, BWA-MEM shows better performance than several state-of-art read aligners to date.

引言

Most short-reads mappers for next-generation sequencing (NGS) data were developed when sequence reads were about 36bp in length. For 36bp reads, it is reasonable to require end-to-end alignment (i.e. every read base to be aligned to the reference) and to only report hits within certain hamming or edit distance.  2013年,大多数的NGS的比对工具都是为了36bp开发的,36bp基本就都是全局比对了,因此只输出特定编辑距离的hits(现在不是了,最少也有50bp吧,长一点的都300bp了)

However, with emerging technologies and improved chemistry, NGS reads are not short any more, which poses new challenges to read alignment. 和现在的PacBio一样,reads的长度一变,比对的工具也要大革新

For 100bp or longer reads, it becomes more important to allow long gaps under the affine-gap penalty and to report multiple nonoverlapping local hits potentially caused by structural variations or misassemblies in the reference genome. 重点来了:对于长reads,在affine-gap penalty(防射空位罚分,即区分了gap open和gap extend) 允许长 gaps 非常重要,而且需要输出SV和Ref错误组装引起的多个不重叠的局部hits。参见:防射空位罚分

之前的许多算法不支持长reads比对,有些成熟的算法支持sanger序列比对,但他们很慢,而且不适合分析大规模的NGS数据,所以急需开发针对NGS的长reads比对。

目前,已有一些long-read alignment algorithms:BWA-SW、Bowtie2、Cushaw2、GEM。但都有不足:

  1. BWA-SW is slower than bowtie2 for 100bp reads at a comparable accuracy and less accurate then Cushaw2 at a comparable speed.
  2. Bowtie2 and Cushaw2 are slower for 600bp reads (see Results).
  3. GEM is both fast and accurate for up to approximately 1000bp reads, it mandates end-to-end alignment and does not perform affine-gap alignment, which limits its uses for long-read alignment.

Even for typical sequence reads ranged from 100bp to 1000bp in length, no mappers work well across the full spectrum.  这就是开发BWA-MEM的目的,全面适应100bp to 1000bp 的reads的比对。

方法

Aligning a single query sequence

1.Seeding and re-seeding

BWA-MEM follows the canonical seed-and-extend paradigm. It initially seeds an alignment with supermaximal exact matches (SMEMs) using an algorithm we found previously (Li, 2012, Algorithm 5), which essentially finds at each query position the longest exact match covering the position.  BWA依旧沿用了之前的 seed-and-extend 策略,它使用之前的算法,用 supermaximal exact matches (SMEMs)来seeds一个比对,找到每个查询位点的 longest exact match 来覆盖该位点。

Exploring single-sample SNP and INDEL calling with whole-genome de novo assembly (SMEMs)

However, occasionally the true alignment may not contain any SMEMs. To reduce mismappings caused by missing seeds, we introduce re-seeding. 然而,真实的比对不一定包含任何SMEMs,为了减少丢失seeds引起的错误比对,我们引入了re-seeding过程。

Suppose we have a SMEM of length l with k occurrences in the reference genome. If l is too large (over 28bp by default), we re-seed with the longest exact matches that cover the middle base of the SMEM and occur at least k + 1 times in the genome. Such seeds can be found by requiring a minimum occurrence in the original SMEM algorithm.  假设我们有一个长l、出现k次的SMEM ,如果l太长,我们会re-seed longest exact matches,使其包含SMEM中间的碱基且最少出现k+1次。这样,seeds就会需要一个最小的出现次数在原来的SMEM算法中。(完全不知所云)

2.Chaining and chain filtering

We call a group of seeds that are colinear and close to each other as a chain. We greedily chain the seeds while seeding and then filter out short chains that are largely contained in a long chain and are much worse than the long chain (by default, both 50% and 38bp shorter than the long chain). Chain filtering aims to reduce unsuccessful seed extension at a later step. Each chain may not always correspond to a final hit. Chains detected here do not need to be accurate.  我们称一群共线性且彼此接近的seeds为一个chain,我们贪婪的将seeds链在一起,在seeding的时候,然后过滤掉短的chains。 过滤chain的目的在于减少下一步中的不成功的seed extension。每一个chain不一定总是对应一个最终的hit。这个时候的chains的检测不一定要非常准确。

3.Seed extension

We rank a seed by the length of the chain it belongs to and then by the seed length. For each seed in the ranked list,
from the best to the worst, we drop the seed if it is already contained in an alignment found before, or extend the seed with a banded affine-gap-penalty dynamic programming (DP) if it potentially leads to a new alignment.

BWA-MEM’s seed extension differs from the standard seed extension in two aspects.

Firstly, suppose at a certain extension step we come to reference position x with the best extension score achieved at query position y. BWAMEM will stop extension if the difference between the best extension score and the score at (x, y) is larger than Z+|x−y|×pgapExt, where pgapExt is the gap extension penalty and Z is an arbitrary cutoff. This heuristic avoids extension through a poorly aligned region with good flanking alignment. It is similar to the X-dropoff heuristic in BLAST (Altschul et al., 1997), but does not penalize long gaps in one of the reference or the query sequences.

Secondly, while extending a seed, BWA-MEM tries to keep track of the best extension score reaching the end of the query sequence. If the difference between the best score reaching the end and the best local alignment score
is below a threshold, the local alignment will be rejected even if it has a higher score. BWA-MEMuses this strategy to automatically choose between local and end-to-end alignments. It may align through true variations towards
the end of a read and thus reduces reference bias, while avoids introducing excessive mismatches and gaps which may happen when we force a chimeric read into an end-to-end alignment.

Paired-end mapping

1.Rescuing missing hits

 

2.Pairing

 

结果和讨论

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值