minimap2 0.2.31.0 → 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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +47 -64
  3. data/ext/ruby_minimap2/extconf.rb +47 -0
  4. data/ext/ruby_minimap2/native_main.c +15 -0
  5. data/ext/ruby_minimap2/ruby_minimap2.c +1134 -0
  6. data/lib/minimap2/aligner.rb +66 -383
  7. data/lib/minimap2/alignment.rb +15 -8
  8. data/lib/minimap2/version.rb +2 -1
  9. data/lib/minimap2.rb +39 -110
  10. metadata +8 -89
  11. data/ext/Rakefile +0 -63
  12. data/ext/cmappy/cmappy.c +0 -134
  13. data/ext/cmappy/cmappy.h +0 -46
  14. data/ext/minimap2/FAQ.md +0 -46
  15. data/ext/minimap2/MANIFEST.in +0 -10
  16. data/ext/minimap2/Makefile.simde +0 -97
  17. data/ext/minimap2/NEWS.md +0 -1022
  18. data/ext/minimap2/README.md +0 -429
  19. data/ext/minimap2/code_of_conduct.md +0 -30
  20. data/ext/minimap2/cookbook.md +0 -243
  21. data/ext/minimap2/minimap2.1 +0 -844
  22. data/ext/minimap2/misc/README.md +0 -180
  23. data/ext/minimap2/misc/pafcluster.js +0 -241
  24. data/ext/minimap2/misc/paftools.js +0 -3830
  25. data/ext/minimap2/pyproject.toml +0 -2
  26. data/ext/minimap2/python/README.rst +0 -198
  27. data/ext/minimap2/python/cmappy.h +0 -152
  28. data/ext/minimap2/python/cmappy.pxd +0 -157
  29. data/ext/minimap2/python/mappy.pyx +0 -297
  30. data/ext/minimap2/python/minimap2.py +0 -43
  31. data/ext/minimap2/setup.py +0 -55
  32. data/ext/minimap2/test/MT-human.fa +0 -278
  33. data/ext/minimap2/test/MT-orang.fa +0 -276
  34. data/ext/minimap2/test/q-inv.fa +0 -4
  35. data/ext/minimap2/test/q2.fa +0 -2
  36. data/ext/minimap2/test/t-inv.fa +0 -127
  37. data/ext/minimap2/test/t2.fa +0 -2
  38. data/ext/minimap2/test/x3s-aln.txt +0 -5
  39. data/ext/minimap2/test/x3s-qry.fa +0 -5
  40. data/ext/minimap2/test/x3s-ref.fa +0 -10
  41. data/ext/minimap2/tex/Makefile +0 -21
  42. data/ext/minimap2/tex/bioinfo.cls +0 -930
  43. data/ext/minimap2/tex/blasr-mc.eval +0 -17
  44. data/ext/minimap2/tex/bowtie2-s3.sam.eval +0 -28
  45. data/ext/minimap2/tex/bwa-s3.sam.eval +0 -52
  46. data/ext/minimap2/tex/bwa.eval +0 -55
  47. data/ext/minimap2/tex/eval2roc.pl +0 -33
  48. data/ext/minimap2/tex/graphmap.eval +0 -4
  49. data/ext/minimap2/tex/hs38-simu.sh +0 -10
  50. data/ext/minimap2/tex/minialign.eval +0 -49
  51. data/ext/minimap2/tex/minimap2.bib +0 -460
  52. data/ext/minimap2/tex/minimap2.tex +0 -724
  53. data/ext/minimap2/tex/mm2-s3.sam.eval +0 -62
  54. data/ext/minimap2/tex/mm2-update.tex +0 -240
  55. data/ext/minimap2/tex/mm2.approx.eval +0 -12
  56. data/ext/minimap2/tex/mm2.eval +0 -13
  57. data/ext/minimap2/tex/natbib.bst +0 -1288
  58. data/ext/minimap2/tex/natbib.sty +0 -803
  59. data/ext/minimap2/tex/ngmlr.eval +0 -38
  60. data/ext/minimap2/tex/roc.gp +0 -60
  61. data/ext/minimap2/tex/snap-s3.sam.eval +0 -62
  62. data/ext/minimap2.patch +0 -19
  63. data/lib/minimap2/ffi/constants.rb +0 -267
  64. data/lib/minimap2/ffi/functions.rb +0 -245
  65. data/lib/minimap2/ffi/mappy.rb +0 -104
  66. 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.31.0
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.10
89
+ rubygems_version: 4.0.16
171
90
  specification_version: 4
172
91
  summary: minimap2
173
92
  test_files: []
data/ext/Rakefile DELETED
@@ -1,63 +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
- unless system("git", "--version", out: File::NULL, err: File::NULL)
20
- abort "Git is required to build ruby-minimap2 from source. Install Git and ensure `git` is on PATH."
21
- end
22
- sh "git apply ../minimap2.patch"
23
- sh "cp ../cmappy/cmappy.h ../cmappy/cmappy.c ."
24
- case RbConfig::CONFIG["host_cpu"]
25
- when /arm64/
26
- sh "make arm_neon=1 aarch64=1"
27
- when /arm/
28
- sh "make arm_neon=1"
29
- else
30
- sh "make"
31
- end
32
- case RbConfig::CONFIG["host_os"]
33
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
34
- sh "cc *.o -shared -o #{target_fname} -lm -lz -lpthread"
35
- when /darwin|mac os/
36
- sh "clang -dynamiclib -undefined dynamic_lookup -o #{target_fname} *.o -lm -lz -lpthread"
37
- sh "otool -L #{target_fname}"
38
- else
39
- sh "cc *.o -shared -o #{target_fname} -lm -lz -lpthread"
40
- sh "ldd -r #{target_fname}"
41
- end
42
- sh "rm cmappy.h cmappy.c"
43
- sh "git apply -R ../minimap2.patch"
44
- FileUtils.mkdir_p(target_dir)
45
- warn "mkdir -p #{target_dir}"
46
- sh "mv #{target_fname} #{target_path}"
47
- end
48
- end
49
-
50
- desc "`make clean`"
51
- task :clean do
52
- Dir.chdir(minimap2_dir) do
53
- sh "make clean"
54
- end
55
- end
56
-
57
- desc "`make clean` and remove shared lib"
58
- task cleanall: [:clean] do
59
- Dir.chdir(minimap2_dir) do
60
- sh "rm #{target_path}" if File.exist?(target_path)
61
- end
62
- end
63
- 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