minimap2-cr
Crystal >= 1.19.1 bindings for minimap2. Build/load reference indexes and map sequences with coordinates, MAPQ and CIGAR.
Installation
Requires a C compiler, make, curl, tar, bzip2 and zlib development headers.
On Ubuntu: sudo apt-get install build-essential curl bzip2 zlib1g-dev.
On macOS, install Xcode Command Line Tools. Windows requires MinGW/MSYS2 with
MAKE=mingw32-make; see CI setup for packages.
dependencies:
minimap2:
github: kojix2/minimap2-cr
Run shards install. The postinstall hook builds the minimap2 version pinned in
ext/build.cr. Crystal links ext/libminimap2.a statically;
setting a shared-library search path is not required.
Map
require "minimap2"
aligner = Minimap2::Aligner.new("reference.fa", preset: "map-ont", cigar: true)
hits = aligner.map("ACGTACGTACGT", cs: true, md: true)
hits.each { |hit| puts "#{hit.target_name}:#{hit.target_start} MAPQ=#{hit.mapq}" }
Supply your own FASTA or minimap2 index. Coordinates are zero-based and half-open.
cs:, md: and ds: request alignment tags. aligner.seq(name, start, stop)
retrieves reference sequence; Minimap2.revcomp(sequence) reverse-complements it.
For presets and detailed options, use AlignerBuilder.
Development
shards install
crystal spec
To rebuild native code in a local checkout: crystal run ext/build.cr.
License: MIT.