Module: Minimap2

Defined in:
lib/minimap2.rb,
lib/minimap2.rb,
lib/minimap2/aligner.rb,
lib/minimap2/version.rb,
lib/minimap2/alignment.rb,
ext/ruby_minimap2/ruby_minimap2.c

Overview

Ruby bindings for the minimap2 sequence aligner.

Defined Under Namespace

Modules: Native Classes: Aligner, Alignment, Error

Constant Summary collapse

VERSION =

...

"1.2.31.0"

Class Method Summary collapse

Class Method Details

.execute(*arguments) ⇒ Object

Run minimap2's command entry point. Each Ruby argument is one argv item.



25
26
27
# File 'lib/minimap2.rb', line 25

def execute(*arguments)
  Native.execute(*arguments)
end

.fastx_read(file_path, comment: false) ⇒ Object

Read records from a FASTA or FASTQ file.

Raises:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/minimap2.rb', line 38

def fastx_read(file_path, comment: false)
  path = file_path.to_s == "-" ? "-" : File.expand_path(file_path)
  raise Error, "Cannot open FASTA/FASTQ file: #{path}" unless path == "-" || File.file?(path)

  reader = Native::FastxReader.new(path)
  if block_given?
    begin
      while (record = reader.next_record(comment))
        yield record
      end
    ensure
      reader.close
    end
  else
    Enumerator.new do |yielder|
      while (record = reader.next_record(comment))
        yielder << record
      end
    ensure
      reader.close
    end
  end
end

.revcomp(sequence) ⇒ Object



62
63
64
# File 'lib/minimap2.rb', line 62

def revcomp(sequence)
  Native.revcomp(sequence)
end

.verboseObject



29
30
31
# File 'lib/minimap2.rb', line 29

def verbose
  Native.verbose
end

.verbose=(level) ⇒ Object



33
34
35
# File 'lib/minimap2.rb', line 33

def verbose=(level)
  Native.verbose = level
end