针对三代测序的比对工具,在原程序基础之上,做一些并行优化
 
 
 
 
 
 
Go to file
Heng Li f4fee60188 r217: ignore tandem seeds during alignment
This helps a tiny bit.
2017-07-28 12:26:56 -04:00
misc added first-only and all-primary modes to eval 2017-07-26 19:32:26 -04:00
test added test data 2017-07-04 10:56:48 -04:00
.gitignore make sdust working with kalloc 2017-04-06 15:51:36 -04:00
LICENSE.txt added license 2017-07-01 11:39:19 -04:00
Makefile update dependency; delete minimap2-lite on clean 2017-07-18 14:48:46 -04:00
README.md added algorithm overview 2017-07-27 18:50:39 -04:00
align.c r217: ignore tandem seeds during alignment 2017-07-28 12:26:56 -04:00
bseq.c r188: renamed bseq* to mm_bseq* 2017-07-19 09:26:46 -04:00
bseq.h r188: renamed bseq* to mm_bseq* 2017-07-19 09:26:46 -04:00
chain.c r215: bring back a log gap component 2017-07-28 00:17:19 -04:00
example.c migrated minimap/example.c here. 2017-07-18 14:43:43 -04:00
format.c r188: renamed bseq* to mm_bseq* 2017-07-19 09:26:46 -04:00
hit.c r216: a bit cleanup; identical output to r215 2017-07-28 11:54:18 -04:00
index.c r197: allocate index seq names from kalloc 2017-07-24 19:36:05 -04:00
kalloc.c number of allocated units must be an even number 2017-06-26 23:15:30 -04:00
kalloc.h Homopolymer-compressed k-mer sketch 2017-04-06 15:37:34 -04:00
kdq.h make sdust working with kalloc 2017-04-06 15:51:36 -04:00
khash.h index can be compiled; not tested yet 2017-04-07 15:30:30 -04:00
kseq.h Homopolymer-compressed k-mer sketch 2017-04-06 15:37:34 -04:00
ksort.h chaining 2017-05-03 20:47:29 +08:00
ksw2.h r188: renamed bseq* to mm_bseq* 2017-07-19 09:26:46 -04:00
ksw2_extd2_sse.c r189: sync with ksw2 (no effective changes) 2017-07-19 09:28:25 -04:00
ksw2_extz2_sse.c r189: sync with ksw2 (no effective changes) 2017-07-19 09:28:25 -04:00
kthread.c index can be compiled; not tested yet 2017-04-07 15:30:30 -04:00
kthread.h index can be compiled; not tested yet 2017-04-07 15:30:30 -04:00
kvec.h Homopolymer-compressed k-mer sketch 2017-04-06 15:37:34 -04:00
main.c r217: ignore tandem seeds during alignment 2017-07-28 12:26:56 -04:00
map.c r216: a bit cleanup; identical output to r215 2017-07-28 11:54:18 -04:00
minimap.h r197: allocate index seq names from kalloc 2017-07-24 19:36:05 -04:00
minimap2.1 added algorithm overview 2017-07-27 18:50:39 -04:00
misc.c r149: introduced debugging flags on CLI 2017-07-03 11:02:32 -04:00
mmpriv.h r216: a bit cleanup; identical output to r215 2017-07-28 11:54:18 -04:00
sdust.c fixed memory leaks 2017-06-06 21:45:55 -04:00
sdust.h r188: renamed bseq* to mm_bseq* 2017-07-19 09:26:46 -04:00
sketch.c wrong HPC 2017-05-04 17:45:19 +08:00

README.md

Getting Started

git clone https://github.com/lh3/minimap2
cd minimap2 && make
# long reads against a reference genome
./minimap2 -ax map10k test/MT-human.fa test/MT-orang.fa > test.sam
# create an index first and then map
./minimap2 -x map10k -d MT-human.mmi test/MT-human.fa
./minimap2 -ax map10k MT-human.mmi test/MT-orang.fa > test.sam
# long-read overlap (no test data)
./minimap2 -x ava-pb your-reads.fa your-reads.fa > overlaps.paf
# man page
man ./minimap2.1

Introduction

Minimap2 is a fast sequence mapping and alignment program that can find overlaps between long noisy reads, or map long reads or their assemblies to a reference genome optionally with detailed alignment (i.e. CIGAR). At present, it works efficiently with query sequences from a few kilobases to ~100 megabases in length at an error rate ~15%. Minimap2 outputs in the PAF or the SAM format. On limited test data sets, minimap2 is over 20 times faster than most other long-read aligners. It will replace BWA-MEM for long reads and contig alignment.

Minimap2 is the successor of minimap. It uses a similar minimizer-based indexing and seeding algorithm, and improves the original minimap with homopolyer-compressed k-mers (see also SMARTdenovo and longISLND), better chaining and the ability to produce CIGAR with fast extension alignment (see also libgaba and ksw2) and piece-wise affine gap cost.

Installation

For modern x86-64 CPUs, just type make in the source code directory. This will compile a binary minimap2 which you can copy to your desired location. If you see compilation errors, try make sse2only=1 to disable SSE4. Minimap2 will run a little slower. At present, minimap2 does not work with non-x86 CPUs or ancient CPUs that do not support SSE2. SSE2 is critical to the performance of minimap2.

Algorithm Overview

In the following, minimap2 command line options have a dash ahead and are highlighted in bold.

  1. Read -I [=4G] reference bases, extract (-k,-w)-minimizers and index them in a hash table.

  2. Read -K [=200M] query bases. For each query sequence, do step 3 through 7:

  3. For each (-k,-w)-minimizer on the query, check against the reference index. If a reference minimizer is not among the top -f [=2e-4] most frequent, collect its the occurrences in the reference, which are called seeds.

  4. Sort seeds by position in the reference. Chain them with dynamic programming. Each chain represents a potential mapping. For read overlapping, report all chains and then go to step 8. For reference mapping, do step 5 through 7:

  5. Let P be the set of primary mappings, which is an empty set initially. For each chain from the best to the worst according to their chaining scores: if on the query, the chain overlaps with a chain in P by --mask-level [=0.5] or higher fraction of the shorter chain, mark the chain as secondary to the chain in P; otherwise, add the chain to P.

  6. Retain all primary mappings. Also retain up to -N [=5] top secondary mappings if their chaining scores are higher than -p [=0.8] of their corresponding primary mappings.

  7. If alignment is requested, filter out an internal seed if it potentially leads to both a long insertion and a long deletion. Extend from the left-most seed. Perform global alignments between internal seeds. Split the chain if the accumulative score along the global alignment drops by -z [=400], disregarding long gaps. Extend from the right-most seed. Output chains and their alignments.

  8. If there are more query sequences in the input, go to step 2 until no more queries are left.

  9. If there are more reference sequences, reopen the query file from the start and go to step 1; otherwise stop.

Limitations

  • At the alignment phase, minimap2 performs global alignments between minimizer hits. If the positions of these minimizer hits are incorrect, the final alignment may be suboptimal or unnecessarily fragmented. This should happen rarely with the latest version.

  • Minimap2 may produce poor alignments that may need post-filtering. We are still exploring a reliable and consistent way to report good alignments.

  • Minimap2 does not work well with Illumina short reads as of now.

  • Minimap2 requires SSE2 instructions to compile. It is possible to add non-SSE2 support, but it would make minimap2 slower by several times.

In general, minimap2 is a young project with most code written since June, 2017. It may have bugs and room for improvements. Bug reports and suggestions are warmly welcomed.