minimap2 0.2.30.3 → 1.2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -63
  3. data/ext/minimap2/Makefile +1 -1
  4. data/ext/minimap2/format.c +12 -2
  5. data/ext/minimap2/hit.c +19 -8
  6. data/ext/minimap2/ksw2_ll_sse.c +2 -2
  7. data/ext/minimap2/minimap.h +2 -1
  8. data/ext/minimap2/pe.c +7 -2
  9. data/ext/ruby_minimap2/extconf.rb +47 -0
  10. data/ext/ruby_minimap2/native_main.c +15 -0
  11. data/ext/ruby_minimap2/ruby_minimap2.c +1134 -0
  12. data/lib/minimap2/aligner.rb +66 -374
  13. data/lib/minimap2/alignment.rb +22 -11
  14. data/lib/minimap2/version.rb +2 -1
  15. data/lib/minimap2.rb +39 -110
  16. metadata +8 -89
  17. data/ext/Rakefile +0 -60
  18. data/ext/cmappy/cmappy.c +0 -134
  19. data/ext/cmappy/cmappy.h +0 -46
  20. data/ext/minimap2/FAQ.md +0 -46
  21. data/ext/minimap2/MANIFEST.in +0 -10
  22. data/ext/minimap2/Makefile.simde +0 -97
  23. data/ext/minimap2/NEWS.md +0 -989
  24. data/ext/minimap2/README.md +0 -428
  25. data/ext/minimap2/code_of_conduct.md +0 -30
  26. data/ext/minimap2/cookbook.md +0 -243
  27. data/ext/minimap2/minimap2.1 +0 -844
  28. data/ext/minimap2/misc/README.md +0 -180
  29. data/ext/minimap2/misc/pafcluster.js +0 -241
  30. data/ext/minimap2/misc/paftools.js +0 -3734
  31. data/ext/minimap2/pyproject.toml +0 -2
  32. data/ext/minimap2/python/README.rst +0 -198
  33. data/ext/minimap2/python/cmappy.h +0 -152
  34. data/ext/minimap2/python/cmappy.pxd +0 -156
  35. data/ext/minimap2/python/mappy.pyx +0 -289
  36. data/ext/minimap2/python/minimap2.py +0 -41
  37. data/ext/minimap2/setup.py +0 -55
  38. data/ext/minimap2/test/MT-human.fa +0 -278
  39. data/ext/minimap2/test/MT-orang.fa +0 -276
  40. data/ext/minimap2/test/q-inv.fa +0 -4
  41. data/ext/minimap2/test/q2.fa +0 -2
  42. data/ext/minimap2/test/t-inv.fa +0 -127
  43. data/ext/minimap2/test/t2.fa +0 -2
  44. data/ext/minimap2/test/x3s-aln.txt +0 -5
  45. data/ext/minimap2/test/x3s-qry.fa +0 -5
  46. data/ext/minimap2/test/x3s-ref.fa +0 -10
  47. data/ext/minimap2/tex/Makefile +0 -21
  48. data/ext/minimap2/tex/bioinfo.cls +0 -930
  49. data/ext/minimap2/tex/blasr-mc.eval +0 -17
  50. data/ext/minimap2/tex/bowtie2-s3.sam.eval +0 -28
  51. data/ext/minimap2/tex/bwa-s3.sam.eval +0 -52
  52. data/ext/minimap2/tex/bwa.eval +0 -55
  53. data/ext/minimap2/tex/eval2roc.pl +0 -33
  54. data/ext/minimap2/tex/graphmap.eval +0 -4
  55. data/ext/minimap2/tex/hs38-simu.sh +0 -10
  56. data/ext/minimap2/tex/minialign.eval +0 -49
  57. data/ext/minimap2/tex/minimap2.bib +0 -460
  58. data/ext/minimap2/tex/minimap2.tex +0 -724
  59. data/ext/minimap2/tex/mm2-s3.sam.eval +0 -62
  60. data/ext/minimap2/tex/mm2-update.tex +0 -240
  61. data/ext/minimap2/tex/mm2.approx.eval +0 -12
  62. data/ext/minimap2/tex/mm2.eval +0 -13
  63. data/ext/minimap2/tex/natbib.bst +0 -1288
  64. data/ext/minimap2/tex/natbib.sty +0 -803
  65. data/ext/minimap2/tex/ngmlr.eval +0 -38
  66. data/ext/minimap2/tex/roc.gp +0 -60
  67. data/ext/minimap2/tex/snap-s3.sam.eval +0 -62
  68. data/ext/minimap2.patch +0 -19
  69. data/lib/minimap2/ffi/constants.rb +0 -267
  70. data/lib/minimap2/ffi/functions.rb +0 -239
  71. data/lib/minimap2/ffi/mappy.rb +0 -104
  72. data/lib/minimap2/ffi.rb +0 -27
@@ -1,243 +0,0 @@
1
- ## Table of Contents
2
-
3
- - [Introduction & Installation](#intro)
4
- - [Mapping Genomic Reads](#map-reads)
5
- * [Mapping long reads](#map-pb)
6
- * [Mapping Illumina paired-end reads](#map-sr)
7
- * [Evaluating mapping accuracy with simulated reads (for developers)](#mapeval)
8
- - [Mapping Long RNA-seq Reads](#map-rna)
9
- * [Mapping Nanopore 2D cDNA reads](#map-ont-cdna-2d)
10
- * [Mapping Nanopore direct-RNA reads](#map-direct-rna)
11
- * [Mapping PacBio Iso-seq reads](#map-iso-seq)
12
- - [Full-Genome Alignment](#genome-aln)
13
- * [Intra-species assembly alignment](#asm-to-ref)
14
- * [Cross-species full-genome alignment](#x-species)
15
- * [Eyeballing alignment](#view-aln)
16
- * [Calling variants from assembly-to-reference alignment](#asm-var)
17
- * [Constructing self-homology map](#hom-map)
18
- * [Lift Over (for developers)](#liftover)
19
- - [Read Overlap](#read-overlap)
20
- * [Long-read overlap](#long-read-overlap)
21
- * [Evaluating overlap sensitivity (for developers)](#ov-eval)
22
-
23
- ## <a name="intro"></a>Introduction & Installation
24
-
25
- This cookbook walks you through a variety of applications of minimap2 and its
26
- companion script `paftools.js`. All data here are freely available from the
27
- minimap2 release page at version tag [v2.10][v2.10]. Some examples only work
28
- with v2.10 or later.
29
-
30
- To acquire the data used in this cookbook and to install minimap2 and paftools,
31
- please follow the command lines below:
32
- ```sh
33
- # install minimap2 executables
34
- curl -L https://github.com/lh3/minimap2/releases/download/v2.30/minimap2-2.30_x64-linux.tar.bz2 | tar jxf -
35
- cp minimap2-2.30_x64-linux/{minimap2,k8,paftools.js} . # copy executables
36
- export PATH="$PATH:"`pwd` # put the current directory on PATH
37
- # download example datasets
38
- curl -L https://github.com/lh3/minimap2/releases/download/v2.10/cookbook-data.tgz | tar zxf -
39
- ```
40
-
41
- ## <a name="map-reads"></a>Mapping Genomic Reads
42
-
43
- ### <a name="map-pb"></a>Mapping long reads
44
- ```sh
45
- minimap2 -ax map-pb -t4 ecoli_ref.fa ecoli_p6_25x_canu.fa > mapped.sam
46
- ```
47
- Alternatively, you can create a minimap2 index first and then map:
48
- ```sh
49
- minimap2 -x map-pb -d ecoli-pb.mmi ecoli_ref.fa # create an index
50
- minimap2 -ax map-pb ecoli-pb.mmi ecoli_p6_25x_canu.fa > mapped.sam
51
- ```
52
- This will save you a couple of minutes when you map against the human genome.
53
- **HOWEVER**, key algorithm parameters such as the k-mer length and window
54
- size can't be changed after indexing. Minimap2 will give you a warning if
55
- parameters used in a pre-built index doesn't match parameters on the command
56
- line. **Please always make sure you are using an intended pre-built index.**
57
-
58
- ### <a name="map-sr"></a>Mapping Illumina paired-end reads:
59
- ```sh
60
- minimap2 -ax sr -t4 ecoli_ref.fa ecoli_mason_1.fq ecoli_mason_2.fq > mapped-sr.sam
61
- ```
62
-
63
- ### <a name="mapeval"></a>Evaluating mapping accuracy with simulated reads (for developers)
64
- ```sh
65
- minimap2 -ax sr ecoli_ref.fa ecoli_mason_1.fq ecoli_mason_2.fq | paftools.js mapeval -
66
- ```
67
- The output is:
68
- ```
69
- Q 60 19712 0 0.000000000 19712
70
- Q 0 282 219 0.010953286 19994
71
- U 6
72
- ```
73
- where a `U`-line gives the number of unmapped reads (for SAM input only); a
74
- `Q`-line gives:
75
-
76
- 1. Mapping quality (mapQ) threshold
77
- 2. Number of mapped reads between this threshold and the previous mapQ threshold.
78
- 3. Number of wrong mappings in the same mapQ interval
79
- 4. Accumulative mapping error rate
80
- 5. Accumulative number of mappings
81
-
82
- For `paftools.js mapeval` to work, you need to encode the true read positions
83
- in read names in the right format. For [pbsim2][pbsim] and [mason2][mason2], we
84
- provide scripts to generate the right format. Simulated reads in this cookbook
85
- were created with the following command lines:
86
- ```sh
87
- # in the pbsim2 source code directory:
88
- src/pbsim --depth 1 --length-min 5000 --length-mean 20000 --accuracy-mean 0.95 --hmm_model data/R94.model ../ecoli_ref.fa
89
- paftools.js pbsim2fq ../ecoli_ref.fa.fai sd_0001.maf > ../ecoli_pbsim.fa
90
-
91
- # mason2 simulation
92
- mason_simulator --illumina-prob-mismatch-scale 2.5 -ir ecoli_ref.fa -n 10000 -o tmp-l.fq -or tmp-r.fq -oa tmp.sam
93
- paftools.js mason2fq tmp.sam | seqtk seq -1 > ecoli_mason_1.fq
94
- paftools.js mason2fq tmp.sam | seqtk seq -2 > ecoli_mason_2.fq
95
- ```
96
-
97
-
98
-
99
- ## <a name="map-rna"></a>Mapping Long RNA-seq Reads
100
-
101
- ### <a name="map-ont-cdna-2d"></a>Mapping Nanopore 2D cDNA reads
102
- ```sh
103
- minimap2 -ax splice SIRV_E2.fa SIRV_ont-cdna.fa > aln.sam
104
- ```
105
- You can compare the alignment to the true annotations with:
106
- ```sh
107
- paftools.js junceval SIRV_E2C.gtf aln.sam
108
- ```
109
- It gives the percentage of introns found in the annotation. For SIRV data, it
110
- is possible to achieve higher junction accuracy with
111
- ```sh
112
- minimap2 -ax splice --splice-flank=no SIRV_E2.fa SIRV_ont-cdna.fa | paftools.js junceval SIRV_E2C.gtf
113
- ```
114
- This is because minimap2 models one additional evolutionarily conserved base
115
- around a canonical junction, but SIRV doesn't honor this signal. Option
116
- `--splice-flank=no` asks minimap2 no to model this additional base.
117
-
118
- In the output a tag `ts:A:+` indicates that the read strand is the same as the
119
- transcript strand; `ts:A:-` indicates the read strand is opposite to the
120
- transcript strand. This tag is inferred from the GT-AG signal and is thus only
121
- available to spliced reads.
122
-
123
- ### <a name="map-direct-rna"></a>Mapping Nanopore direct-RNA reads
124
- ```sh
125
- minimap2 -ax splice -k14 -uf SIRV_E2.fa SIRV_ont-drna.fa > aln.sam
126
- ```
127
- Direct-RNA reads are noisier, so we use a shorter k-mer for improved
128
- sensitivity. Here, option `-uf` forces minimap2 to map reads to the forward
129
- transcript strand only because direct-RNA reads are stranded. Again, applying
130
- `--splice-flank=no` helps junction accuracy for SIRV data.
131
-
132
- ### <a name="map-iso-seq"></a>Mapping PacBio Iso-seq reads
133
- ```sh
134
- minimap2 -ax splice -uf -C5 SIRV_E2.fa SIRV_iso-seq.fq > aln.sam
135
- ```
136
- Option `-C5` reduces the penalty on non-canonical splicing sites. It helps
137
- to align such sites correctly for data with low error rate such as Iso-seq
138
- reads and traditional cDNAs. On this example, minimap2 makes one junction
139
- error. Applying `--splice-flank=no` fixes this alignment error.
140
-
141
- Note that the command line above is optimized for the final Iso-seq reads.
142
- PacBio's Iso-seq pipeline produces intermediate sequences at varying quality.
143
- For example, some intermediate reads are not stranded. For these reads, option
144
- `-uf` will lead to more errors. Please revise the minimap2 command line
145
- accordingly.
146
-
147
-
148
-
149
- ## <a name="genome-aln"></a>Full-Genome Alignment
150
-
151
- ### <a name="asm-to-ref"></a>Intra-species assembly alignment
152
- ```sh
153
- # option "--cs" is recommended as paftools.js may need it
154
- minimap2 -cx asm5 --cs ecoli_ref.fa ecoli_canu.fa > ecoli_canu.paf
155
- ```
156
- Here `ecoli_canu.fa` is the Canu assembly of `ecoli_p6_25x_canu.fa`. This
157
- command line outputs alignments in the [PAF format][paf]. Use `-a` instead of
158
- `-c` to get output in the SAM format.
159
-
160
- ### <a name="x-species"></a>Cross-species full-genome alignment
161
- ```sh
162
- minimap2 -cx asm20 --cs ecoli_ref.fa ecoli_O104:H4.fa > ecoli_O104:H4.paf
163
- sort -k6,6 -k8,8n ecoli_O104:H4.paf | paftools.js call -f ecoli_ref.fa -L10000 -l1000 - > out.vcf
164
- ```
165
- Minimap2 has three presets for full-genome alignment: "asm5" for sequence
166
- divergence below 1%, "asm10" for divergence around a couple of percent and
167
- "asm20" for divergence not more than 10%. In theory, with the right setting,
168
- minimap2 should work for sequence pairs with sequence divergence up to ~15%,
169
- but this has not been carefully evaluated.
170
-
171
- ### <a name="view-aln"></a>Eyeballing alignment
172
- ```sh
173
- # option "--cs" required; minimap2-r741 or higher required for the "asm20" preset
174
- minimap2 -cx asm20 --cs ecoli_ref.fa ecoli_O104:H4.fa | paftools.js view - | less -S
175
- ```
176
- This prints the alignment in a BLAST-like format.
177
-
178
- ### <a name="asm-var"></a>Calling variants from assembly-to-reference alignment
179
- ```sh
180
- # don't forget the "--cs" option; otherwise it doesn't work
181
- minimap2 -cx asm5 --cs ecoli_ref.fa ecoli_canu.fa \
182
- | sort -k6,6 -k8,8n \
183
- | paftools.js call -f ecoli_ref.fa - > out.vcf
184
- ```
185
- Without option `-f`, `paftools.js call` outputs in a custom format. In this
186
- format, lines starting with `R` give the regions covered by one contig only.
187
- This information is not available in the VCF output.
188
-
189
- ### <a name="hom-map"></a>Constructing self-homology map
190
- ```sh
191
- minimap2 -DP -k19 -w19 -m200 ecoli_ref.fa ecoli_ref.fa > out.paf
192
- ```
193
- Option `-D` asks minimap2 to ignore anchors from perfect self match and `-P`
194
- outputs all chains. For large nomes, we don't recommend to perform base-level
195
- alignment (with `-c`, `-a` or `--cs`) when `-P` is applied. This is because
196
- base-alignment is slow and occasionally gives wrong alignments close to the
197
- diagonal of a dotter plot. For E. coli, though, base-alignment is still fast.
198
-
199
- ### <a name="liftover"></a>Lift over (for developers)
200
- ```sh
201
- minimap2 -cx asm5 --cs ecoli_ref.fa ecoli_canu.fa > ecoli_canu.paf
202
- echo -e 'tig00000001\t200000\t300000' | paftools.js liftover ecoli_canu.paf -
203
- ```
204
- This lifts over a region on query sequences to one or multiple regions on
205
- reference sequences. Note that this paftools.js command may not be efficient
206
- enough to lift millions of regions.
207
-
208
-
209
-
210
- ## <a name="read-overlap"></a>Read Overlap
211
-
212
- ### <a name="long-read-overlap"></a>Long read overlap
213
- ```sh
214
- # For pacbio reads:
215
- minimap2 -x ava-pb ecoli_p6_25x_canu.fa ecoli_p6_25x_canu.fa > overlap.paf
216
- # For Nanopore reads (ava-ont also works with PacBio but not as good):
217
- minimap2 -x ava-ont -r 10000 ecoli_p6_25x_canu.fa ecoli_p6_25x_canu.fa > overlap.paf
218
- # If you have miniasm installed:
219
- miniasm -f ecoli_p6_25x_canu.fa overlap.paf > asm.gfa
220
- ```
221
- Here we explicitly applied `-r 10000`. We are considering to set this as the
222
- default for the `ava-ont` mode as this seems to improve the contiguity for
223
- nanopore read assembly (Loman, personal communication).
224
-
225
- *Minimap2 doesn't work well with short-read overlap.*
226
-
227
- ### <a name="ov-eval"></a>Evaluating overlap sensitivity (for developers)
228
-
229
- ```sh
230
- # read to reference mapping
231
- minimap2 -cx map-pb ecoli_ref.fa ecoli_p6_25x_canu.fa > to-ref.paf
232
- # evaluate overlap sensitivity
233
- sort -k6,6 -k8,8n to-ref.paf | paftools.js ov-eval - overlap.paf
234
- ```
235
- You can see that for PacBio reads, minimap2 achieves higher overlap sensitivity
236
- with `-x ava-pb` (99% vs 93% with `-x ava-ont`).
237
-
238
-
239
-
240
- [pbsim]: https://github.com/yukiteruono/pbsim2
241
- [mason2]: https://github.com/seqan/seqan/tree/master/apps/mason2
242
- [paf]: https://github.com/lh3/miniasm/blob/master/PAF.md
243
- [v2.10]: https://github.com/lh3/minimap2/releases/tag/v2.10