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
data/lib/minimap2.rb CHANGED
@@ -1,137 +1,66 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # dependencies
4
- require "ffi"
5
-
6
- # modules
7
- require_relative "minimap2/aligner"
8
- require_relative "minimap2/alignment"
9
- require_relative "minimap2/version"
10
-
11
- # Minimap2 mapper for long read sequences
12
- # https://github.com/lh3/minimap2
13
- # Li, H. (2018). Minimap2: pairwise alignment for nucleotide sequences. Bioinformatics, 34:3094-3100.
14
- # doi:10.1093/bioinformatics/bty191
15
3
  module Minimap2
16
4
  class Error < StandardError; end
5
+ end
17
6
 
18
- class << self
19
- attr_accessor :ffi_lib
20
- end
7
+ begin
8
+ require "minimap2/minimap2_ext"
9
+ rescue LoadError => e
10
+ # Allow running directly from a source checkout after `rake compile`.
11
+ extension = File.expand_path("../ext/ruby_minimap2/minimap2_ext", __dir__)
12
+ raise e unless Dir["#{extension}.{so,bundle,dylib,dll}"].any?
21
13
 
22
- lib_name = ::FFI.map_library_name("minimap2")
23
- self.ffi_lib = if ENV["MINIMAPDIR"]
24
- File.expand_path(lib_name, ENV["MINIMAPDIR"])
25
- else
26
- File.expand_path("../vendor/#{lib_name}", __dir__)
27
- end
14
+ require extension
15
+ end
28
16
 
29
- # friendlier error message
30
- autoload :FFI, "minimap2/ffi"
17
+ require_relative "minimap2/alignment"
18
+ require_relative "minimap2/aligner"
19
+ require_relative "minimap2/version"
31
20
 
32
- # methods from mappy
21
+ # Ruby bindings for the minimap2 sequence aligner.
22
+ module Minimap2
33
23
  class << self
34
- # Execute minimap2 comannd with given options.
35
- # @overload execute(arg0,arg1,...)
36
- # @param [String] arg minimap2 command option.
37
- # @example Get minimap2 version
38
- # Minimap2.execute('--version')
39
-
40
- def execute(*rb_argv)
41
- str_ptrs = []
42
- # First argument is the program name.
43
- str_ptrs << ::FFI::MemoryPointer.from_string("minimap2")
44
- rb_argv.each do |arg|
45
- arg.to_s.split(/\s+/).each do |s|
46
- str_ptrs << ::FFI::MemoryPointer.from_string(s)
47
- end
48
- end
49
- str_ptrs << nil
50
-
51
- # Load all the pointers into a native memory block
52
- argv = ::FFI::MemoryPointer.new(:pointer, str_ptrs.length)
53
- str_ptrs.each_with_index do |p, i|
54
- argv[i].put_pointer(0, p)
55
- end
56
-
57
- FFI.main(str_ptrs.length - 1, argv)
24
+ # Run minimap2's command entry point. Each Ruby argument is one argv item.
25
+ def execute(*arguments)
26
+ Native.execute(*arguments)
58
27
  end
59
28
 
60
- # Get verbosity level.
61
- # @return [Integer] verbosity level.
62
-
63
29
  def verbose
64
- FFI.mm_verbose_level(-1)
30
+ Native.verbose
65
31
  end
66
32
 
67
- # Set verbosity level.
68
- # @param [Integer] verbosity level
69
- # @return [Integer] verbosity level.
70
-
71
33
  def verbose=(level)
72
- FFI.mm_verbose_level(level)
34
+ Native.verbose = level
73
35
  end
74
36
 
75
- # Read fasta/fastq file.
76
- # @param [String] file_path
77
- # @param [Boolean] comment If True, the comment will be read.
78
- # @yield [name, seq, qual, comment]
79
- # @return [Enumerator] enum Return Enumerator if not block given.
80
- # Note: You can BioRuby instead of this method.
81
-
82
- def fastx_read(file_path, comment: false, &block)
83
- path = File.expand_path(file_path)
84
-
85
- # raise error in Ruby because ks.null? is false even if file not exist.
86
- raise ArgumentError, "File not found: #{path}" unless File.exist?(path)
87
-
88
- ks = FFI.mm_fastx_open(path)
37
+ # Read records from a FASTA or FASTQ file.
38
+ def fastx_read(file_path, comment: false)
39
+ path = file_path.to_s == "-" ? "-" : File.expand_path(file_path)
40
+ raise Error, "Cannot open FASTA/FASTQ file: #{path}" unless path == "-" || File.file?(path)
89
41
 
42
+ reader = Native::FastxReader.new(path)
90
43
  if block_given?
91
- fastx_each(ks, comment, &block)
44
+ begin
45
+ while (record = reader.next_record(comment))
46
+ yield record
47
+ end
48
+ ensure
49
+ reader.close
50
+ end
92
51
  else
93
- Enumerator.new do |y|
94
- # rewind not work
95
- fastx_each(ks, comment) { |r| y << r }
52
+ Enumerator.new do |yielder|
53
+ while (record = reader.next_record(comment))
54
+ yielder << record
55
+ end
56
+ ensure
57
+ reader.close
96
58
  end
97
59
  end
98
60
  end
99
61
 
100
- # Reverse complement sequence.
101
- # @param [String] seq
102
- # @return [string] seq
103
-
104
- def revcomp(seq)
105
- l = seq.size
106
- bseq = ::FFI::MemoryPointer.new(:char, l)
107
- bseq.put_bytes(0, seq)
108
- p = FFI.mappy_revcomp(l, bseq)
109
- return "" if p.nil? || p.null?
110
-
111
- begin
112
- p.read_string(l)
113
- ensure
114
- FFI.mappy_free(p) unless p.nil? || p.null?
115
- end
116
- end
117
-
118
- private
119
-
120
- def fastx_each(ks, comment)
121
- yield fastx_next(ks, comment) while FFI.kseq_read(ks) >= 0
122
- FFI.mm_fastx_close(ks)
123
- end
124
-
125
- def fastx_next(ks, read_comment)
126
- qual = ks[:qual][:s] if ks[:qual][:l] > 0
127
- name = ks[:name][:s]
128
- seq = ks[:seq][:s]
129
- if read_comment
130
- comment = ks[:comment][:s] if ks[:comment][:l] > 0
131
- [name, seq, qual, comment]
132
- else
133
- [name, seq, qual]
134
- end
62
+ def revcomp(sequence)
63
+ Native.revcomp(sequence)
135
64
  end
136
65
  end
137
66
  end
metadata CHANGED
@@ -1,68 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimap2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.30.3
4
+ version: 1.2.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: ffi
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: '0'
26
- - !ruby/object:Gem::Dependency
27
- name: ffi-bitfield
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
11
+ dependencies: []
40
12
  description: Ruby bindings to the Minimap2 aligner.
41
13
  email:
42
14
  - 2xijok@gmail.com
43
15
  executables: []
44
16
  extensions:
45
- - ext/Rakefile
17
+ - ext/ruby_minimap2/extconf.rb
46
18
  extra_rdoc_files: []
47
19
  files:
48
20
  - LICENSE.txt
49
21
  - README.md
50
- - ext/Rakefile
51
- - ext/cmappy/cmappy.c
52
- - ext/cmappy/cmappy.h
53
- - ext/minimap2.patch
54
- - ext/minimap2/FAQ.md
55
22
  - ext/minimap2/LICENSE.txt
56
- - ext/minimap2/MANIFEST.in
57
23
  - ext/minimap2/Makefile
58
- - ext/minimap2/Makefile.simde
59
- - ext/minimap2/NEWS.md
60
- - ext/minimap2/README.md
61
24
  - ext/minimap2/align.c
62
25
  - ext/minimap2/bseq.c
63
26
  - ext/minimap2/bseq.h
64
- - ext/minimap2/code_of_conduct.md
65
- - ext/minimap2/cookbook.md
66
27
  - ext/minimap2/esterr.c
67
28
  - ext/minimap2/example.c
68
29
  - ext/minimap2/format.c
@@ -90,64 +51,22 @@ files:
90
51
  - ext/minimap2/main.c
91
52
  - ext/minimap2/map.c
92
53
  - ext/minimap2/minimap.h
93
- - ext/minimap2/minimap2.1
94
54
  - ext/minimap2/misc.c
95
- - ext/minimap2/misc/README.md
96
- - ext/minimap2/misc/pafcluster.js
97
- - ext/minimap2/misc/paftools.js
98
55
  - ext/minimap2/mmpriv.h
99
56
  - ext/minimap2/options.c
100
57
  - ext/minimap2/pe.c
101
- - ext/minimap2/pyproject.toml
102
- - ext/minimap2/python/README.rst
103
- - ext/minimap2/python/cmappy.h
104
- - ext/minimap2/python/cmappy.pxd
105
- - ext/minimap2/python/mappy.pyx
106
- - ext/minimap2/python/minimap2.py
107
58
  - ext/minimap2/sdust.c
108
59
  - ext/minimap2/sdust.h
109
60
  - ext/minimap2/seed.c
110
- - ext/minimap2/setup.py
111
61
  - ext/minimap2/sketch.c
112
62
  - ext/minimap2/splitidx.c
113
63
  - ext/minimap2/sse2neon/emmintrin.h
114
- - ext/minimap2/test/MT-human.fa
115
- - ext/minimap2/test/MT-orang.fa
116
- - ext/minimap2/test/q-inv.fa
117
- - ext/minimap2/test/q2.fa
118
- - ext/minimap2/test/t-inv.fa
119
- - ext/minimap2/test/t2.fa
120
- - ext/minimap2/test/x3s-aln.txt
121
- - ext/minimap2/test/x3s-qry.fa
122
- - ext/minimap2/test/x3s-ref.fa
123
- - ext/minimap2/tex/Makefile
124
- - ext/minimap2/tex/bioinfo.cls
125
- - ext/minimap2/tex/blasr-mc.eval
126
- - ext/minimap2/tex/bowtie2-s3.sam.eval
127
- - ext/minimap2/tex/bwa-s3.sam.eval
128
- - ext/minimap2/tex/bwa.eval
129
- - ext/minimap2/tex/eval2roc.pl
130
- - ext/minimap2/tex/graphmap.eval
131
- - ext/minimap2/tex/hs38-simu.sh
132
- - ext/minimap2/tex/minialign.eval
133
- - ext/minimap2/tex/minimap2.bib
134
- - ext/minimap2/tex/minimap2.tex
135
- - ext/minimap2/tex/mm2-s3.sam.eval
136
- - ext/minimap2/tex/mm2-update.tex
137
- - ext/minimap2/tex/mm2.approx.eval
138
- - ext/minimap2/tex/mm2.eval
139
- - ext/minimap2/tex/natbib.bst
140
- - ext/minimap2/tex/natbib.sty
141
- - ext/minimap2/tex/ngmlr.eval
142
- - ext/minimap2/tex/roc.gp
143
- - ext/minimap2/tex/snap-s3.sam.eval
64
+ - ext/ruby_minimap2/extconf.rb
65
+ - ext/ruby_minimap2/native_main.c
66
+ - ext/ruby_minimap2/ruby_minimap2.c
144
67
  - lib/minimap2.rb
145
68
  - lib/minimap2/aligner.rb
146
69
  - lib/minimap2/alignment.rb
147
- - lib/minimap2/ffi.rb
148
- - lib/minimap2/ffi/constants.rb
149
- - lib/minimap2/ffi/functions.rb
150
- - lib/minimap2/ffi/mappy.rb
151
70
  - lib/minimap2/version.rb
152
71
  homepage: https://github.com/kojix2/ruby-minimap2
153
72
  licenses:
@@ -160,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
79
  requirements:
161
80
  - - ">="
162
81
  - !ruby/object:Gem::Version
163
- version: '2.5'
82
+ version: '3.3'
164
83
  required_rubygems_version: !ruby/object:Gem::Requirement
165
84
  requirements:
166
85
  - - ">="
167
86
  - !ruby/object:Gem::Version
168
87
  version: '0'
169
88
  requirements: []
170
- rubygems_version: 4.0.3
89
+ rubygems_version: 4.0.16
171
90
  specification_version: 4
172
91
  summary: minimap2
173
92
  test_files: []
data/ext/Rakefile DELETED
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rake"
4
- require "fileutils"
5
- require "ffi"
6
-
7
- minimap2_dir = File.expand_path("minimap2", __dir__)
8
- target_dir = "../../vendor"
9
- target_fname = FFI.map_library_name("minimap2")
10
- target_path = File.join(target_dir, target_fname)
11
-
12
- task default: ["minimap2:build", "minimap2:clean"]
13
-
14
- namespace :minimap2 do
15
- desc "Compile Minimap2"
16
- task :build do
17
- Dir.chdir(minimap2_dir) do
18
- # Add -fPIC option to Makefile
19
- sh "git apply ../minimap2.patch"
20
- sh "cp ../cmappy/cmappy.h ../cmappy/cmappy.c ."
21
- case RbConfig::CONFIG["host_cpu"]
22
- when /arm64/
23
- sh "make arm_neon=1 aarch64=1"
24
- when /arm/
25
- sh "make arm_neon=1"
26
- else
27
- sh "make"
28
- end
29
- case RbConfig::CONFIG["host_os"]
30
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
31
- sh "cc *.o -shared -o #{target_fname} -lm -lz -lpthread"
32
- when /darwin|mac os/
33
- sh "clang -dynamiclib -undefined dynamic_lookup -o #{target_fname} *.o -lm -lz -lpthread"
34
- sh "otool -L #{target_fname}"
35
- else
36
- sh "cc *.o -shared -o #{target_fname} -lm -lz -lpthread"
37
- sh "ldd -r #{target_fname}"
38
- end
39
- sh "rm cmappy.h cmappy.c"
40
- sh "git apply -R ../minimap2.patch"
41
- FileUtils.mkdir_p(target_dir)
42
- warn "mkdir -p #{target_dir}"
43
- sh "mv #{target_fname} #{target_path}"
44
- end
45
- end
46
-
47
- desc "`make clean`"
48
- task :clean do
49
- Dir.chdir(minimap2_dir) do
50
- sh "make clean"
51
- end
52
- end
53
-
54
- desc "`make clean` and remove shared lib"
55
- task cleanall: [:clean] do
56
- Dir.chdir(minimap2_dir) do
57
- sh "rm #{target_path}" if File.exist?(target_path)
58
- end
59
- end
60
- end
data/ext/cmappy/cmappy.c DELETED
@@ -1,134 +0,0 @@
1
- #include "cmappy.h"
2
-
3
- void mm_reg2hitpy(const mm_idx_t *mi, mm_reg1_t *r, mm_hitpy_t *h)
4
- {
5
- h->ctg = mi->seq[r->rid].name;
6
- h->ctg_len = mi->seq[r->rid].len;
7
- h->ctg_start = r->rs, h->ctg_end = r->re;
8
- h->qry_start = r->qs, h->qry_end = r->qe;
9
- h->strand = r->rev? -1 : 1;
10
- h->mapq = r->mapq;
11
- h->mlen = r->mlen;
12
- h->blen = r->blen;
13
- h->NM = r->blen - r->mlen + r->p->n_ambi;
14
- h->trans_strand = r->p->trans_strand == 1? 1 : r->p->trans_strand == 2? -1 : 0;
15
- h->is_primary = (r->id == r->parent);
16
- h->seg_id = r->seg_id;
17
- h->n_cigar32 = r->p->n_cigar;
18
- h->cigar32 = r->p->cigar;
19
- }
20
-
21
- void mm_free_reg1(mm_reg1_t *r)
22
- {
23
- free(r->p);
24
- }
25
-
26
- kseq_t *mm_fastx_open(const char *fn)
27
- {
28
- gzFile fp;
29
- fp = fn && strcmp(fn, "-") != 0? gzopen(fn, "r") : gzdopen(fileno(stdin), "r");
30
- return kseq_init(fp);
31
- }
32
-
33
- void mm_fastx_close(kseq_t *ks)
34
- {
35
- gzFile fp;
36
- fp = ks->f->f;
37
- kseq_destroy(ks);
38
- gzclose(fp);
39
- }
40
-
41
- int mm_verbose_level(int v)
42
- {
43
- if (v >= 0) mm_verbose = v;
44
- return mm_verbose;
45
- }
46
-
47
- void mm_reset_timer(void)
48
- {
49
- extern double realtime(void);
50
- mm_realtime0 = realtime();
51
- }
52
-
53
- 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)
54
- {
55
- mm_reg1_t *r;
56
-
57
- // Py_BEGIN_ALLOW_THREADS
58
- if (seq2 == 0) {
59
- r = mm_map(mi, strlen(seq1), seq1, n_regs, b, opt, seqname);
60
- } else {
61
- int _n_regs[2];
62
- mm_reg1_t *regs[2];
63
- char *seq[2];
64
- int i, len[2];
65
-
66
- len[0] = strlen(seq1);
67
- len[1] = strlen(seq2);
68
- seq[0] = (char*)seq1;
69
- seq[1] = strdup(seq2);
70
- for (i = 0; i < len[1]>>1; ++i) {
71
- int t = seq[1][len[1] - i - 1];
72
- seq[1][len[1] - i - 1] = seq_comp_table[(uint8_t)seq[1][i]];
73
- seq[1][i] = seq_comp_table[t];
74
- }
75
- if (len[1]&1) seq[1][len[1]>>1] = seq_comp_table[(uint8_t)seq[1][len[1]>>1]];
76
- mm_map_frag(mi, 2, len, (const char**)seq, _n_regs, regs, b, opt, seqname);
77
- for (i = 0; i < _n_regs[1]; ++i)
78
- regs[1][i].rev = !regs[1][i].rev;
79
- *n_regs = _n_regs[0] + _n_regs[1];
80
- regs[0] = (mm_reg1_t*)realloc(regs[0], sizeof(mm_reg1_t) * (*n_regs));
81
- memcpy(&regs[0][_n_regs[0]], regs[1], _n_regs[1] * sizeof(mm_reg1_t));
82
- free(regs[1]);
83
- r = regs[0];
84
- }
85
- // Py_END_ALLOW_THREADS
86
-
87
- return r;
88
- }
89
-
90
- char *mappy_revcomp(int len, const uint8_t *seq)
91
- {
92
- int i;
93
- char *rev;
94
- rev = (char*)malloc(len + 1);
95
- for (i = 0; i < len; ++i)
96
- rev[len - i - 1] = seq_comp_table[seq[i]];
97
- rev[len] = 0;
98
- return rev;
99
- }
100
-
101
- char *mappy_fetch_seq(const mm_idx_t *mi, const char *name, int st, int en, int *len)
102
- {
103
- int i, rid;
104
- char *s;
105
- *len = 0;
106
- rid = mm_idx_name2id(mi, name);
107
- if (rid < 0) return 0;
108
- if ((uint32_t)st >= mi->seq[rid].len || st >= en) return 0;
109
- if (en < 0 || (uint32_t)en > mi->seq[rid].len)
110
- en = mi->seq[rid].len;
111
- s = (char*)malloc(en - st + 1);
112
- *len = mm_idx_getseq(mi, rid, st, en, (uint8_t*)s);
113
- for (i = 0; i < *len; ++i)
114
- s[i] = "ACGTN"[(uint8_t)s[i]];
115
- s[*len] = 0;
116
- return s;
117
- }
118
-
119
- mm_idx_t *mappy_idx_seq(int w, int k, int is_hpc, int bucket_bits, const char *seq, int len)
120
- {
121
- const char *fake_name = "N/A";
122
- char *s;
123
- mm_idx_t *mi;
124
- s = (char*)calloc(len + 1, 1);
125
- memcpy(s, seq, len);
126
- mi = mm_idx_str(w, k, is_hpc, bucket_bits, 1, (const char**)&s, (const char**)&fake_name);
127
- free(s);
128
- return mi;
129
- }
130
-
131
- void mappy_free(void *p)
132
- {
133
- free(p);
134
- }
data/ext/cmappy/cmappy.h DELETED
@@ -1,46 +0,0 @@
1
- #ifndef CMAPPY_H
2
- #define CMAPPY_H
3
-
4
- #include <stdlib.h>
5
- #include <string.h>
6
- #include <zlib.h>
7
- #include "minimap.h"
8
- #include "kseq.h"
9
- KSEQ_DECLARE(gzFile)
10
-
11
- typedef struct {
12
- const char *ctg;
13
- int32_t ctg_start, ctg_end;
14
- int32_t qry_start, qry_end;
15
- int32_t blen, mlen, NM, ctg_len;
16
- uint8_t mapq, is_primary;
17
- int8_t strand, trans_strand;
18
- int32_t seg_id;
19
- int32_t n_cigar32;
20
- uint32_t *cigar32;
21
- } mm_hitpy_t;
22
-
23
- void mm_reg2hitpy(const mm_idx_t *mi, mm_reg1_t *r, mm_hitpy_t *h);
24
-
25
- void mm_free_reg1(mm_reg1_t *r);
26
-
27
- kseq_t *mm_fastx_open(const char *fn);
28
-
29
- void mm_fastx_close(kseq_t *ks);
30
-
31
- int mm_verbose_level(int v);
32
-
33
- void mm_reset_timer(void);
34
-
35
- extern unsigned char seq_comp_table[256];
36
- 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);
37
-
38
- char *mappy_revcomp(int len, const uint8_t *seq);
39
-
40
- char *mappy_fetch_seq(const mm_idx_t *mi, const char *name, int st, int en, int *len);
41
-
42
- mm_idx_t *mappy_idx_seq(int w, int k, int is_hpc, int bucket_bits, const char *seq, int len);
43
-
44
- void mappy_free(void *p);
45
-
46
- #endif
data/ext/minimap2/FAQ.md DELETED
@@ -1,46 +0,0 @@
1
- #### 1. Alignment different with option `-a` or `-c`?
2
-
3
- Without `-a`, `-c` or `--cs`, minimap2 only finds *approximate* mapping
4
- locations without detailed base alignment. In particular, the start and end
5
- positions of the alignment are imprecise. With one of those options, minimap2
6
- will perform base alignment, which is generally more accurate but is much
7
- slower.
8
-
9
- #### 2. How to map Illumina short reads to noisy long reads?
10
-
11
- No good solutions. The better approach is to assemble short reads into contigs
12
- and then map noisy reads to contigs.
13
-
14
- #### 3. The output SAM doesn't have a header.
15
-
16
- By default, minimap2 indexes 4 billion reference bases (4Gb) in a batch and map
17
- all reads against each reference batch. Given a reference longer than 4Gb,
18
- minimap2 is unable to see all the sequences and thus can't produce a correct
19
- SAM header. In this case, minimap2 doesn't output any SAM header. There are two
20
- solutions to this issue. First, you may increase option `-I` to, for example,
21
- `-I8g` to index more reference bases in a batch. This is preferred if your
22
- machine has enough memory. Second, if your machines doesn't have enough memory
23
- to hold the reference index, you can use the `--split-prefix` option in a
24
- command line like:
25
- ```sh
26
- minimap2 -ax map-ont --split-prefix=tmp ref.fa reads.fq
27
- ```
28
- This second approach uses less memory, but it is slower and requires temporary
29
- disk space.
30
-
31
- #### 4. The output SAM is malformatted.
32
-
33
- This typically happens when you use nohup to wrap a minimap2 command line.
34
- Nohup is discouraged as it breaks piping. If you have to use nohup, please
35
- specify an output file with option `-o`.
36
-
37
- #### 5. How to output one alignment per read?
38
-
39
- You can use `--secondary=no` to suppress secondary alignments (aka multiple
40
- mappings), but you can't suppress supplementary alignment (aka split or
41
- chimeric alignment) this way. You can use samtools to filter out these
42
- alignments:
43
- ```sh
44
- minimap2 -ax map-out ref.fa reads.fq | samtools view -F0x900
45
- ```
46
- However, this is discouraged as supplementary alignment is informative.
@@ -1,10 +0,0 @@
1
- include *.h
2
- include Makefile
3
- include ksw2_dispatch.c
4
- include main.c
5
- include README.md
6
- include sse2neon/emmintrin.h
7
- include python/cmappy.h
8
- include python/cmappy.pxd
9
- include python/mappy.pyx
10
- include python/README.rst