From bfdc94bb6ad23084f22a2dcff2d9b781cfbd897e Mon Sep 17 00:00:00 2001 From: Benjamin Demaille Date: Wed, 5 Aug 2026 22:55:01 +0200 Subject: [PATCH] rammap 1.1.2 (new formula) --- Formula/r/rammap.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Formula/r/rammap.rb diff --git a/Formula/r/rammap.rb b/Formula/r/rammap.rb new file mode 100644 index 000000000000..06d91d3f0cd3 --- /dev/null +++ b/Formula/r/rammap.rb @@ -0,0 +1,42 @@ +class Rammap < Formula + desc "Extensible and performant aligner and read mapper" + homepage "https://github.com/jwanglab/rammap" + url "https://github.com/jwanglab/rammap/archive/refs/tags/v1.1.2.tar.gz" + sha256 "d6d349495da8fb26e50ce6408235a587a297f666063f01ca8ebf05439b47d33c" + license "MIT" + head "https://github.com/jwanglab/rammap.git", branch: "main" + + depends_on "rust" => :build + + def install + system "cargo", "install", *std_cargo_args(path: "rammap") + end + + test do + # Deterministic pseudo-random reference; a repetitive one would not seed. + seed = 12_345 + reference = Array.new(1200) do + seed = ((seed * 1_103_515_245) + 12_345) % (2**31) + "ACGT"[(seed >> 16) % 4] + end.join + (testpath/"ref.fa").write ">chr1\n#{reference.scan(/.{1,60}/).join("\n")}\n" + + # A read lifted verbatim out of the reference, so it must align exactly. + read = reference[300, 200] + (testpath/"reads.fq").write "@read1\n#{read}\n+\n#{"I" * read.length}\n" + + paf = shell_output("#{bin}/rammap -x map-ont ref.fa reads.fq 2>/dev/null") + fields = paf.lines.first.chomp.split("\t") + assert_equal "read1", fields[0] + assert_equal "+", fields[4] + assert_equal "chr1", fields[5] + assert_equal "1200", fields[6] + assert_equal "60", fields[11] + assert_operator fields[9].to_i, :>=, 190 + + sam = shell_output("#{bin}/rammap -x map-ont -a ref.fa reads.fq 2>/dev/null") + assert_match "@SQ\tSN:chr1\tLN:1200", sam + assert_match "200M", sam + assert_match "NM:i:0", sam + end +end