minimap2 0.2.28.0 → 0.2.29.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.
@@ -62,6 +62,8 @@ void mm_mapopt_init(mm_mapopt_t *opt)
62
62
 
63
63
  opt->pe_ori = 0; // FF
64
64
  opt->pe_bonus = 33;
65
+
66
+ opt->jump_min_match = 3;
65
67
  }
66
68
 
67
69
  void mm_mapopt_update(mm_mapopt_t *opt, const mm_idx_t *mi)
@@ -164,7 +166,7 @@ int mm_set_opt(const char *preset, mm_idxopt_t *io, mm_mapopt_t *mo)
164
166
  mo->mid_occ = 1000;
165
167
  mo->max_occ = 5000;
166
168
  mo->mini_batch_size = 50000000;
167
- } else if (strncmp(preset, "splice", 6) == 0 || strcmp(preset, "cdna") == 0) {
169
+ } else if (strcmp(preset, "splice") == 0 || strcmp(preset, "splice:hq") == 0 || strcmp(preset, "splice:sr") == 0 || strcmp(preset, "cdna") == 0) {
168
170
  io->flag = 0, io->k = 15, io->w = 5;
169
171
  mo->flag |= MM_F_SPLICE | MM_F_SPLICE_FOR | MM_F_SPLICE_REV | MM_F_SPLICE_FLANK;
170
172
  mo->max_sw_mat = 0;
@@ -172,13 +174,31 @@ int mm_set_opt(const char *preset, mm_idxopt_t *io, mm_mapopt_t *mo)
172
174
  mo->a = 1, mo->b = 2, mo->q = 2, mo->e = 1, mo->q2 = 32, mo->e2 = 0;
173
175
  mo->noncan = 9;
174
176
  mo->junc_bonus = 9;
177
+ mo->junc_pen = 5;
175
178
  mo->zdrop = 200, mo->zdrop_inv = 100; // because mo->a is halved
176
- if (strcmp(preset, "splice:hq") == 0)
179
+ if (strcmp(preset, "splice:hq") == 0) {
180
+ mo->noncan = 5, mo->b = 4, mo->q = 6, mo->q2 = 24;
181
+ } else if (strcmp(preset, "splice:sr") == 0) {
182
+ mo->flag |= MM_F_NO_PRINT_2ND | MM_F_2_IO_THREADS | MM_F_HEAP_SORT | MM_F_FRAG_MODE | MM_F_WEAK_PAIRING | MM_F_SR_RNA;
177
183
  mo->noncan = 5, mo->b = 4, mo->q = 6, mo->q2 = 24;
184
+ mo->min_chain_score = 25;
185
+ mo->min_dp_max = 40;
186
+ mo->min_ksw_len = 20;
187
+ mo->pe_ori = 0<<1|1; // FR
188
+ mo->best_n = 10;
189
+ mo->mini_batch_size = 100000000;
190
+ }
178
191
  } else return -1;
179
192
  return 0;
180
193
  }
181
194
 
195
+ int mm_max_spsc_bonus(const mm_mapopt_t *mo)
196
+ {
197
+ int max_sc = (mo->q2 + 1) / 2 - 1;
198
+ max_sc = max_sc > mo->q2 - mo->q? max_sc : mo->q2 - mo->q;
199
+ return max_sc;
200
+ }
201
+
182
202
  int mm_check_opt(const mm_idxopt_t *io, const mm_mapopt_t *mo)
183
203
  {
184
204
  if (mo->bw > mo->bw_long) {
@@ -233,6 +253,11 @@ int mm_check_opt(const mm_idxopt_t *io, const mm_mapopt_t *mo)
233
253
  fprintf(stderr, "[ERROR]\033[1;31m scoring system violating ({-O}+{-E})+({-O2}+{-E2}) <= 127\033[0m\n");
234
254
  return -1;
235
255
  }
256
+ if (mo->sc_ambi < 0 || mo->sc_ambi >= mo->b) {
257
+ if (mm_verbose >= 1)
258
+ fprintf(stderr, "[ERROR]\033[1;31m --score-N should be within [0,{-B})\033[0m\n");
259
+ return -1;
260
+ }
236
261
  if (mo->zdrop < mo->zdrop_inv) {
237
262
  if (mm_verbose >= 1)
238
263
  fprintf(stderr, "[ERROR]\033[1;31m Z-drop should not be less than inversion-Z-drop\033[0m\n");
@@ -71,13 +71,13 @@ static inline void mm_reset_timer(void)
71
71
  }
72
72
 
73
73
  extern unsigned char seq_comp_table[256];
74
- static inline mm_reg1_t *mm_map_aux(const mm_idx_t *mi, const char *seq1, const char *seq2, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt)
74
+ static inline mm_reg1_t *mm_map_aux(const mm_idx_t *mi, const char* seqname, const char *seq1, const char *seq2, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt)
75
75
  {
76
76
  mm_reg1_t *r;
77
77
 
78
78
  Py_BEGIN_ALLOW_THREADS
79
79
  if (seq2 == 0) {
80
- r = mm_map(mi, strlen(seq1), seq1, n_regs, b, opt, NULL);
80
+ r = mm_map(mi, strlen(seq1), seq1, n_regs, b, opt, seqname);
81
81
  } else {
82
82
  int _n_regs[2];
83
83
  mm_reg1_t *regs[2];
@@ -94,7 +94,7 @@ static inline mm_reg1_t *mm_map_aux(const mm_idx_t *mi, const char *seq1, const
94
94
  seq[1][i] = seq_comp_table[t];
95
95
  }
96
96
  if (len[1]&1) seq[1][len[1]>>1] = seq_comp_table[(uint8_t)seq[1][len[1]>>1]];
97
- mm_map_frag(mi, 2, len, (const char**)seq, _n_regs, regs, b, opt, NULL);
97
+ mm_map_frag(mi, 2, len, (const char**)seq, _n_regs, regs, b, opt, seqname);
98
98
  for (i = 0; i < _n_regs[1]; ++i)
99
99
  regs[1][i].rev = !regs[1][i].rev;
100
100
  *n_regs = _n_regs[0] + _n_regs[1];
@@ -39,7 +39,7 @@ cdef extern from "minimap.h":
39
39
  int transition
40
40
  int sc_ambi
41
41
  int noncan
42
- int junc_bonus
42
+ int junc_bonus, junc_pen
43
43
  int zdrop, zdrop_inv
44
44
  int end_bonus
45
45
  int min_dp_max
@@ -52,6 +52,8 @@ cdef extern from "minimap.h":
52
52
 
53
53
  int pe_ori, pe_bonus
54
54
 
55
+ int jump_min_match;
56
+
55
57
  float mid_occ_frac
56
58
  float q_occ_frac
57
59
  int32_t min_mid_occ
@@ -129,7 +131,7 @@ cdef extern from "cmappy.h":
129
131
 
130
132
  void mm_reg2hitpy(const mm_idx_t *mi, mm_reg1_t *r, mm_hitpy_t *h)
131
133
  void mm_free_reg1(mm_reg1_t *r)
132
- mm_reg1_t *mm_map_aux(const mm_idx_t *mi, const char *seq1, const char *seq2, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt)
134
+ mm_reg1_t *mm_map_aux(const mm_idx_t *mi, const char* seqname, const char *seq1, const char *seq2, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt)
133
135
  char *mappy_fetch_seq(const mm_idx_t *mi, const char *name, int st, int en, int *l)
134
136
  mm_idx_t *mappy_idx_seq(int w, int k, int is_hpc, int bucket_bits, const char *seq, int l)
135
137
 
@@ -3,7 +3,7 @@ from libc.stdlib cimport free
3
3
  cimport cmappy
4
4
  import sys
5
5
 
6
- __version__ = '2.28'
6
+ __version__ = '2.29'
7
7
 
8
8
  cmappy.mm_reset_timer()
9
9
 
@@ -113,7 +113,7 @@ cdef class Aligner:
113
113
  cdef cmappy.mm_idxopt_t idx_opt
114
114
  cdef cmappy.mm_mapopt_t map_opt
115
115
 
116
- def __cinit__(self, fn_idx_in=None, preset=None, k=None, w=None, min_cnt=None, min_chain_score=None, min_dp_score=None, bw=None, bw_long=None, best_n=None, n_threads=3, fn_idx_out=None, max_frag_len=None, extra_flags=None, seq=None, scoring=None):
116
+ def __cinit__(self, fn_idx_in=None, preset=None, k=None, w=None, min_cnt=None, min_chain_score=None, min_dp_score=None, bw=None, bw_long=None, best_n=None, n_threads=3, fn_idx_out=None, max_frag_len=None, extra_flags=None, seq=None, scoring=None, sc_ambi=None, max_chain_skip=None):
117
117
  self._idx = NULL
118
118
  cmappy.mm_set_opt(NULL, &self.idx_opt, &self.map_opt) # set the default options
119
119
  if preset is not None:
@@ -138,6 +138,8 @@ cdef class Aligner:
138
138
  self.map_opt.q2, self.map_opt.e2 = scoring[4], scoring[5]
139
139
  if len(scoring) >= 7:
140
140
  self.map_opt.sc_ambi = scoring[6]
141
+ if sc_ambi is not None: self.map_opt.sc_ambi = sc_ambi
142
+ if max_chain_skip is not None: self.map_opt.max_chain_skip = max_chain_skip
141
143
 
142
144
  cdef cmappy.mm_idx_reader_t *r;
143
145
 
@@ -163,7 +165,7 @@ cdef class Aligner:
163
165
  def __bool__(self):
164
166
  return (self._idx != NULL)
165
167
 
166
- def map(self, seq, seq2=None, buf=None, cs=False, MD=False, max_frag_len=None, extra_flags=None):
168
+ def map(self, seq, seq2=None, name=None, buf=None, cs=False, MD=False, max_frag_len=None, extra_flags=None):
167
169
  cdef cmappy.mm_reg1_t *regs
168
170
  cdef cmappy.mm_hitpy_t h
169
171
  cdef ThreadBuffer b
@@ -185,11 +187,20 @@ cdef class Aligner:
185
187
  km = cmappy.mm_tbuf_get_km(b._b)
186
188
 
187
189
  _seq = seq if isinstance(seq, bytes) else seq.encode()
190
+ if name is not None:
191
+ _name = name if isinstance(name, bytes) else name.encode()
192
+
188
193
  if seq2 is None:
189
- regs = cmappy.mm_map_aux(self._idx, _seq, NULL, &n_regs, b._b, &map_opt)
194
+ if name is None:
195
+ regs = cmappy.mm_map_aux(self._idx, NULL, _seq, NULL, &n_regs, b._b, &map_opt)
196
+ else:
197
+ regs = cmappy.mm_map_aux(self._idx, _name, _seq, NULL, &n_regs, b._b, &map_opt)
190
198
  else:
191
199
  _seq2 = seq2 if isinstance(seq2, bytes) else seq2.encode()
192
- regs = cmappy.mm_map_aux(self._idx, _seq, _seq2, &n_regs, b._b, &map_opt)
200
+ if name is None:
201
+ regs = cmappy.mm_map_aux(self._idx, NULL, _seq, _seq2, &n_regs, b._b, &map_opt)
202
+ else:
203
+ regs = cmappy.mm_map_aux(self._idx, _name, _seq, _seq2, &n_regs, b._b, &map_opt)
193
204
 
194
205
  try:
195
206
  i = 0
@@ -200,11 +211,12 @@ cdef class Aligner:
200
211
  c = h.cigar32[k]
201
212
  cigar.append([c>>4, c&0xf])
202
213
  if cs or MD: # generate the cs and/or the MD tag, if requested
214
+ _cur_seq = _seq2 if h.seg_id > 0 and seq2 is not None else _seq
203
215
  if cs:
204
- l_cs_str = cmappy.mm_gen_cs(km, &cs_str, &m_cs_str, self._idx, &regs[i], _seq, 1)
216
+ l_cs_str = cmappy.mm_gen_cs(km, &cs_str, &m_cs_str, self._idx, &regs[i], _cur_seq, 1)
205
217
  _cs = cs_str[:l_cs_str] if isinstance(cs_str, str) else cs_str[:l_cs_str].decode()
206
218
  if MD:
207
- l_cs_str = cmappy.mm_gen_MD(km, &cs_str, &m_cs_str, self._idx, &regs[i], _seq)
219
+ l_cs_str = cmappy.mm_gen_MD(km, &cs_str, &m_cs_str, self._idx, &regs[i], _cur_seq)
208
220
  _MD = cs_str[:l_cs_str] if isinstance(cs_str, str) else cs_str[:l_cs_str].decode()
209
221
  yield Alignment(h.ctg, h.ctg_len, h.ctg_start, h.ctg_end, h.strand, h.qry_start, h.qry_end, h.mapq, cigar, h.is_primary, h.mlen, h.blen, h.NM, h.trans_strand, h.seg_id, _cs, _MD)
210
222
  cmappy.mm_free_reg1(&regs[i])
@@ -23,7 +23,7 @@ def readme():
23
23
 
24
24
  setup(
25
25
  name = 'mappy',
26
- version = '2.28',
26
+ version = '2.29',
27
27
  url = 'https://github.com/lh3/minimap2',
28
28
  description = 'Minimap2 python binding',
29
29
  long_description = readme(),
@@ -33,7 +33,7 @@ setup(
33
33
  keywords = 'sequence-alignment',
34
34
  scripts = ['python/minimap2.py'],
35
35
  ext_modules = [Extension('mappy',
36
- sources = ['python/mappy.pyx', 'align.c', 'bseq.c', 'lchain.c', 'seed.c', 'format.c', 'hit.c', 'index.c', 'pe.c', 'options.c',
36
+ sources = ['python/mappy.pyx', 'align.c', 'bseq.c', 'lchain.c', 'seed.c', 'format.c', 'hit.c', 'index.c', 'pe.c', 'jump.c', 'options.c',
37
37
  'ksw2_extd2_sse.c', 'ksw2_exts2_sse.c', 'ksw2_extz2_sse.c', 'ksw2_ll_sse.c',
38
38
  'kalloc.c', 'kthread.c', 'map.c', 'misc.c', 'sdust.c', 'sketch.c', 'esterr.c', 'splitidx.c'],
39
39
  depends = ['minimap.h', 'bseq.h', 'kalloc.h', 'kdq.h', 'khash.h', 'kseq.h', 'ksort.h',
data/ext/minimap2.patch CHANGED
@@ -6,13 +6,13 @@
6
6
  CPPFLAGS= -DHAVE_KALLOC
7
7
  INCLUDES=
8
8
  OBJS= kthread.o kalloc.o misc.o bseq.o sketch.o sdust.o options.o index.o \
9
- lchain.o align.o hit.o seed.o map.o format.o pe.o esterr.o splitidx.o \
9
+ lchain.o align.o hit.o seed.o jump.o map.o format.o pe.o esterr.o splitidx.o \
10
10
  - ksw2_ll_sse.o
11
11
  + ksw2_ll_sse.o cmappy.o
12
12
  PROG= minimap2
13
13
  PROG_EXTRA= sdust minimap2-lite
14
14
  LIBS= -lm -lz -lpthread
15
- @@ -134,3 +134,4 @@ sdust.o: kalloc.h kdq.h kvec.h sdust.h
15
+ @@ -135,3 +135,4 @@ sdust.o: kalloc.h kdq.h kvec.h sdust.h
16
16
  seed.o: mmpriv.h minimap.h bseq.h kseq.h kalloc.h ksort.h
17
17
  sketch.o: kvec.h kalloc.h mmpriv.h minimap.h bseq.h kseq.h
18
18
  splitidx.o: mmpriv.h minimap.h bseq.h kseq.h
@@ -54,9 +54,10 @@ module Minimap2
54
54
  fn_idx_out: nil,
55
55
  max_frag_len: nil,
56
56
  extra_flags: nil,
57
- scoring: nil
57
+ scoring: nil,
58
+ sc_ambi: nil,
59
+ max_chain_skip: nil
58
60
  )
59
-
60
61
  @idx_opt = FFI::IdxOpt.new
61
62
  @map_opt = FFI::MapOpt.new
62
63
 
@@ -91,6 +92,8 @@ module Minimap2
91
92
  map_opt[:sc_ambi] = scoring[6] if scoring.size >= 7
92
93
  end
93
94
  end
95
+ map_opt[:sc_ambi] = sc_ambi if sc_ambi
96
+ map_opt[:max_chain_skip] = max_chain_skip if max_chain_skip
94
97
 
95
98
  if fn_idx_in
96
99
  warn "Since fn_idx_in is specified, the seq argument will be ignored." if seq
@@ -134,13 +137,13 @@ module Minimap2
134
137
 
135
138
  def align(
136
139
  seq, seq2 = nil,
140
+ name: nil,
137
141
  buf: nil,
138
142
  cs: false,
139
143
  md: false,
140
144
  max_frag_len: nil,
141
145
  extra_flags: nil
142
146
  )
143
-
144
147
  return if index.null?
145
148
  return if (map_opt[:flag] & 4).zero? && (index[:flag] & 2).zero?
146
149
 
@@ -151,7 +154,7 @@ module Minimap2
151
154
  km = FFI.mm_tbuf_get_km(buf)
152
155
 
153
156
  n_regs_ptr = ::FFI::MemoryPointer.new :int
154
- regs_ptr = FFI.mm_map_aux(index, seq, seq2, n_regs_ptr, buf, map_opt)
157
+ regs_ptr = FFI.mm_map_aux(index, name, seq, seq2, n_regs_ptr, buf, map_opt)
155
158
  n_regs = n_regs_ptr.read_int
156
159
 
157
160
  regs = Array.new(n_regs) do |i|
@@ -174,15 +177,19 @@ module Minimap2
174
177
  cigar = c.map { |x| [x >> 4, x & 0xf] } # 32-bit CIGAR encoding -> Ruby array
175
178
 
176
179
  _cs = ""
177
- if cs
178
- l_cs_str = FFI.mm_gen_cs(km, cs_str, m_cs_str, @index, regs[i], seq, 1)
179
- _cs = cs_str.read_pointer.read_string(l_cs_str)
180
- end
181
-
182
180
  _md = ""
183
- if md
184
- l_cs_str = FFI.mm_gen_md(km, cs_str, m_cs_str, @index, regs[i], seq)
185
- _md = cs_str.read_pointer.read_string(l_cs_str)
181
+ if cs or md
182
+ cur_seq = hit[:seg_id] > 0 && seq2 ? seq2 : seq
183
+
184
+ if cs
185
+ l_cs_str = FFI.mm_gen_cs(km, cs_str, m_cs_str, @index, regs[i], cur_seq, 1)
186
+ _cs = cs_str.read_pointer.read_string(l_cs_str)
187
+ end
188
+
189
+ if md
190
+ l_cs_str = FFI.mm_gen_md(km, cs_str, m_cs_str, @index, regs[i], cur_seq)
191
+ _md = cs_str.read_pointer.read_string(l_cs_str)
192
+ end
186
193
  end
187
194
 
188
195
  alignments << Alignment.new(hit, cigar, _cs, _md)
@@ -41,6 +41,9 @@ module Minimap2
41
41
  SPLICE_OLD = 0x800000000
42
42
  SECONDARY_SEQ = 0x1000000000 # output SEQ field for seqondary alignments using hard clipping
43
43
  OUT_DS = 0x2000000000
44
+ WEAK_PAIRING = 0x4000000000
45
+ SR_RNA = 0x8000000000
46
+ OUT_JUNC = 0x10000000000
44
47
 
45
48
  HPC = 0x1
46
49
  NO_SEQ = 0x2
@@ -99,6 +102,8 @@ module Minimap2
99
102
  :S, :pointer, # 4-bit packed sequence
100
103
  :B, :pointer, # index (hidden)
101
104
  :I, :pointer, # intervals (hidden)
105
+ :spsc, :pointer, # splice score (hidden)
106
+ :J, :pointer, # junctions to create jumps (hidden)
102
107
  :km, :pointer,
103
108
  :h, :pointer
104
109
  end
@@ -160,7 +165,8 @@ module Minimap2
160
165
  :split_inv, 1,
161
166
  :is_alt, 1,
162
167
  :strand_retained, 1,
163
- :dummy, 5
168
+ :is_spliced, 1,
169
+ :dummy, 4
164
170
  end
165
171
 
166
172
  # indexing option
@@ -210,6 +216,7 @@ module Minimap2
210
216
  :transition, :int, # transition mismatch score (A:G, C:T)
211
217
  :sc_ambi, :int, # score when one or both bases are "N"
212
218
  :noncan, :int, # cost of non-canonical splicing sites
219
+ :junc_pen, :int,
213
220
  :junc_bonus, :int,
214
221
  :zdrop, :int, # break alignment if alignment score drops too fast along the diagonal
215
222
  :zdrop_inv, :int,
@@ -223,6 +230,7 @@ module Minimap2
223
230
  :rank_frac, :float,
224
231
  :pe_ori, :int,
225
232
  :pe_bonus, :int,
233
+ :jump_min_match, :int32,
226
234
  :mid_occ_frac, :float, # only used by mm_mapopt_update(); see below
227
235
  :q_occ_frac, :float,
228
236
  :min_mid_occ, :int32,
@@ -7,6 +7,7 @@ module Minimap2
7
7
  %i[int pointer],
8
8
  :int
9
9
 
10
+ # int mm_set_opt(const char *preset, mm_idxopt_t *io, mm_mapopt_t *mo);
10
11
  attach_function \
11
12
  :mm_set_opt_raw, :mm_set_opt,
12
13
  [:pointer, IdxOpt.by_ref, MapOpt.by_ref],
@@ -24,66 +25,204 @@ module Minimap2
24
25
  mm_set_opt_raw(ptr, io, mo)
25
26
  end
26
27
 
28
+ # int mm_check_opt(const mm_idxopt_t *io, const mm_mapopt_t *mo);
29
+ attach_function \
30
+ :mm_check_opt,
31
+ [IdxOpt.by_ref, MapOpt.by_ref],
32
+ :int
33
+
34
+ # void mm_mapopt_update(mm_mapopt_t *opt, const mm_idx_t *mi);
35
+ attach_function \
36
+ :mm_mapopt_update,
37
+ [MapOpt.by_ref, Idx.by_ref],
38
+ :void
39
+
40
+ # void mm_mapopt_max_intron_len(mm_mapopt_t *opt, int max_intron_len);
41
+ attach_function \
42
+ :mm_mapopt_max_intron_len,
43
+ [MapOpt.by_ref, :int],
44
+ :void
45
+
46
+ # mm_idx_reader_t *mm_idx_reader_open(const char *fn, const mm_idxopt_t *opt, const char *fn_out);
27
47
  attach_function \
28
48
  :mm_idx_reader_open,
29
49
  [:string, IdxOpt.by_ref, :string],
30
50
  IdxReader.by_ref
31
51
 
52
+ # mm_idx_t *mm_idx_reader_read(mm_idx_reader_t *r, int n_threads);
32
53
  attach_function \
33
54
  :mm_idx_reader_read,
34
55
  [IdxReader.by_ref, :int],
35
56
  Idx.by_ref
36
57
 
58
+ # void mm_idx_reader_close(mm_idx_reader_t *r);
37
59
  attach_function \
38
60
  :mm_idx_reader_close,
39
61
  [IdxReader.by_ref],
40
62
  :void
41
63
 
64
+ # int mm_idx_reader_eof(const mm_idx_reader_t *r);
42
65
  attach_function \
43
- :mm_idx_destroy,
44
- [Idx.by_ref],
66
+ :mm_idx_reader_eof,
67
+ [IdxReader.by_ref],
68
+ :int
69
+
70
+ # int64_t mm_idx_is_idx(const char *fn);
71
+ attach_function \
72
+ :mm_idx_is_idx,
73
+ [:string],
74
+ :int64_t
75
+
76
+ # mm_idx_t *mm_idx_load(FILE *fp);
77
+ attach_function \
78
+ :mm_idx_load,
79
+ [:pointer], # FILE pointer
80
+ Idx.by_ref
81
+
82
+ # void mm_idx_dump(FILE *fp, const mm_idx_t *mi);
83
+ attach_function \
84
+ :mm_idx_dump,
85
+ [:pointer, Idx.by_ref], # FILE pointer
45
86
  :void
46
87
 
88
+ # mm_idx_t *mm_idx_str(int w, int k, int is_hpc, int bucket_bits, int n, const char **seq, const char **name);
47
89
  attach_function \
48
- :mm_mapopt_update,
49
- [MapOpt.by_ref, Idx.by_ref],
90
+ :mm_idx_str,
91
+ %i[int int int int int pointer pointer],
92
+ Idx.by_ref
93
+
94
+ # void mm_idx_stat(const mm_idx_t *idx);
95
+ attach_function \
96
+ :mm_idx_stat,
97
+ [Idx.by_ref],
50
98
  :void
51
99
 
100
+ # void mm_idx_destroy(mm_idx_t *mi);
52
101
  attach_function \
53
- :mm_idx_index_name,
102
+ :mm_idx_destroy,
54
103
  [Idx.by_ref],
55
- :int
104
+ :void
56
105
 
106
+ # mm_tbuf_t *mm_tbuf_init(void);
57
107
  attach_function \
58
108
  :mm_tbuf_init,
59
109
  [],
60
110
  TBuf.by_ref
61
111
 
112
+ # void mm_tbuf_destroy(mm_tbuf_t *b);
62
113
  attach_function \
63
114
  :mm_tbuf_destroy,
64
115
  [TBuf.by_ref],
65
116
  :void
66
117
 
118
+ # void *mm_tbuf_get_km(mm_tbuf_t *b);
67
119
  attach_function \
68
120
  :mm_tbuf_get_km,
69
121
  [TBuf.by_ref],
70
122
  :pointer
71
123
 
124
+ # mm_reg1_t *mm_map(const mm_idx_t *mi, int l_seq, const char *seq, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *name);
125
+ attach_function \
126
+ :mm_map,
127
+ [Idx.by_ref, :int, :string, :pointer, TBuf.by_ref, MapOpt.by_ref, :string],
128
+ Reg1.by_ref
129
+
130
+ # void mm_map_frag(const mm_idx_t *mi, int n_segs, const int *qlens, const char **seqs, int *n_regs, mm_reg1_t **regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *qname);
131
+ attach_function \
132
+ :mm_map_frag,
133
+ [Idx.by_ref, :int, :pointer, :pointer, :pointer, TBuf.by_ref, MapOpt.by_ref, :string],
134
+ :void
135
+
136
+ # int mm_map_file(const mm_idx_t *idx, const char *fn, const mm_mapopt_t *opt, int n_threads);
137
+ attach_function \
138
+ :mm_map_file,
139
+ [Idx.by_ref, :string, MapOpt.by_ref, :int],
140
+ :int
141
+
142
+ # int mm_map_file_frag(const mm_idx_t *idx, int n_segs, const char **fn, const mm_mapopt_t *opt, int n_threads);
143
+ attach_function \
144
+ :mm_map_file_frag,
145
+ [Idx.by_ref, :int, :pointer, MapOpt.by_ref, :int],
146
+ :int
147
+
148
+ # int mm_gen_cs(void *km, char **buf, int *max_len, const mm_idx_t *mi, const mm_reg1_t *r, const char *seq, int no_iden);
72
149
  attach_function \
73
150
  :mm_gen_cs,
74
151
  [:pointer, :pointer, :pointer, Idx.by_ref, Reg1.by_ref, :string, :int],
75
152
  :int
76
153
 
154
+ # int mm_gen_MD(void *km, char **buf, int *max_len, const mm_idx_t *mi, const mm_reg1_t *r, const char *seq);
77
155
  attach_function \
78
156
  :mm_gen_md, :mm_gen_MD, # Avoid uppercase letters in method names.
79
157
  [:pointer, :pointer, :pointer, Idx.by_ref, Reg1.by_ref, :string],
80
158
  :int
81
159
 
160
+ # int mm_idx_index_name(mm_idx_t *mi);
161
+ attach_function \
162
+ :mm_idx_index_name,
163
+ [Idx.by_ref],
164
+ :int
165
+
166
+ # int mm_idx_name2id(const mm_idx_t *mi, const char *name);
167
+ attach_function \
168
+ :mm_idx_name2id,
169
+ [Idx.by_ref, :string],
170
+ :int
171
+
172
+ # int mm_idx_getseq(const mm_idx_t *mi, uint32_t rid, uint32_t st, uint32_t en, uint8_t *seq);
173
+ attach_function \
174
+ :mm_idx_getseq,
175
+ [Idx.by_ref, :uint32, :uint32, :uint32, :pointer],
176
+ :int
177
+
178
+ # int mm_idx_alt_read(mm_idx_t *mi, const char *fn);
179
+ attach_function \
180
+ :mm_idx_alt_read,
181
+ [Idx.by_ref, :string],
182
+ :int
183
+
184
+ # int mm_idx_bed_read(mm_idx_t *mi, const char *fn, int read_junc);
185
+ attach_function \
186
+ :mm_idx_bed_read,
187
+ [Idx.by_ref, :string, :int],
188
+ :int
189
+
190
+ # int mm_idx_bed_junc(const mm_idx_t *mi, int32_t ctg, int32_t st, int32_t en, uint8_t *s);
191
+ attach_function \
192
+ :mm_idx_bed_junc,
193
+ [Idx.by_ref, :int32, :int32, :int32, :pointer],
194
+ :int
195
+
196
+ # int mm_max_spsc_bonus(const mm_mapopt_t *mo);
197
+ attach_function \
198
+ :mm_max_spsc_bonus,
199
+ [MapOpt.by_ref],
200
+ :int
201
+
202
+ # int32_t mm_idx_spsc_read(mm_idx_t *idx, const char *fn, int32_t max_sc);
203
+ attach_function \
204
+ :mm_idx_spsc_read,
205
+ [Idx.by_ref, :string, :int32],
206
+ :int32
207
+
208
+ # int64_t mm_idx_spsc_get(const mm_idx_t *db, int32_t cid, int64_t st0, int64_t en0, int32_t rev, uint8_t *sc);
209
+ attach_function \
210
+ :mm_idx_spsc_get,
211
+ [Idx.by_ref, :int32, :int64, :int64, :int32, :pointer],
212
+ :int64
213
+
214
+ # void mm_mapopt_init(mm_mapopt_t *opt);
82
215
  attach_function \
83
216
  :mm_mapopt_init,
84
217
  [MapOpt.by_ref],
85
218
  :void
86
219
 
220
+ # mm_idx_t *mm_idx_build(const char *fn, int w, int k, int flag, int n_threads);
221
+ attach_function \
222
+ :mm_idx_build,
223
+ %i[string int int int int],
224
+ Idx.by_ref
225
+
87
226
  # mmpriv.h
88
227
 
89
228
  attach_function \
@@ -73,7 +73,7 @@ module Minimap2
73
73
 
74
74
  attach_function \
75
75
  :mm_map_aux,
76
- [Idx.by_ref, :string, :string, :pointer, TBuf.by_ref, MapOpt.by_ref],
76
+ [Idx.by_ref, :string, :string, :string, :pointer, TBuf.by_ref, MapOpt.by_ref],
77
77
  :pointer # Reg1
78
78
 
79
79
  attach_function \
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minimap2
4
- VERSION = "0.2.28.0"
4
+ VERSION = "0.2.29.0"
5
5
  end
data/lib/minimap2.rb CHANGED
@@ -116,11 +116,11 @@ module Minimap2
116
116
  end
117
117
 
118
118
  def fastx_next(ks, read_comment)
119
- qual = ks[:qual][:s] if (ks[:qual][:l]) > 0
119
+ qual = ks[:qual][:s] if ks[:qual][:l] > 0
120
120
  name = ks[:name][:s]
121
121
  seq = ks[:seq][:s]
122
122
  if read_comment
123
- comment = ks[:comment][:s] if (ks[:comment][:l]) > 0
123
+ comment = ks[:comment][:s] if ks[:comment][:l] > 0
124
124
  [name, seq, qual, comment]
125
125
  else
126
126
  [name, seq, qual]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimap2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.28.0
4
+ version: 0.2.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-29 00:00:00.000000000 Z
11
+ date: 2025-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -69,6 +69,7 @@ files:
69
69
  - ext/minimap2/format.c
70
70
  - ext/minimap2/hit.c
71
71
  - ext/minimap2/index.c
72
+ - ext/minimap2/jump.c
72
73
  - ext/minimap2/kalloc.c
73
74
  - ext/minimap2/kalloc.h
74
75
  - ext/minimap2/kdq.h
@@ -93,7 +94,7 @@ files:
93
94
  - ext/minimap2/minimap2.1
94
95
  - ext/minimap2/misc.c
95
96
  - ext/minimap2/misc/README.md
96
- - ext/minimap2/misc/mmphase.js
97
+ - ext/minimap2/misc/pafcluster.js
97
98
  - ext/minimap2/misc/paftools.js
98
99
  - ext/minimap2/mmpriv.h
99
100
  - ext/minimap2/options.c
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  - !ruby/object:Gem::Version
166
167
  version: '0'
167
168
  requirements: []
168
- rubygems_version: 3.5.3
169
+ rubygems_version: 3.4.19
169
170
  signing_key:
170
171
  specification_version: 4
171
172
  summary: minimap2