forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mummer.rb
90 lines (71 loc) · 2.83 KB
/
mummer.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
require 'formula'
class Mummer < Formula
homepage 'http://mummer.sourceforge.net/'
url 'https://downloads.sourceforge.net/project/mummer/mummer/3.23/MUMmer3.23.tar.gz'
sha1 '69261ed80bb77e7595100f0560973fe1f810c5fa'
def install
inreplace 'scripts/Makefile', '$(CURDIR)', prefix
system 'make'
%w[dnadiff mummerplot nucmer promer mapview].each do |script|
inreplace script, "use lib \"#{prefix}", "use lib \"#{share}/mummer"
end
inreplace 'promer' do |s|
s.gsub! /BIN_DIR = "[^"]+/ , "BIN_DIR = \"#{libexec}"
s.gsub! /AUX_BIN_DIR = "[^"]+/ , "AUX_BIN_DIR = \"#{libexec}"
s.gsub! /SCRIPT_DIR = "[^"]+/ , "SCRIPT_DIR = \"#{share}/mummer"
end
inreplace 'nucmer' do |s|
s.gsub! /BIN_DIR = "[^"]+/ , "BIN_DIR = \"#{libexec}"
s.gsub! /AUX_BIN_DIR = "[^"]+/ , "AUX_BIN_DIR = \"#{libexec}"
s.gsub! /SCRIPT_DIR = "[^"]+/ , "SCRIPT_DIR = \"#{share}/mummer"
end
inreplace 'dnadiff' do |s|
s.gsub! /BIN_DIR = "[^"]+/ , "BIN_DIR = \"#{libexec}"
s.gsub! /SCRIPT_DIR = "[^"]+/ , "SCRIPT_DIR = \"#{share}/mummer"
end
inreplace 'mummerplot' do |s|
s.gsub! /BIN_DIR = "[^"]+/ , "BIN_DIR = \"#{libexec}"
s.gsub! /SCRIPT_DIR = "[^"]+/ , "SCRIPT_DIR = \"#{share}/mummer"
end
inreplace 'exact-tandems' do |s|
s.gsub! /bindir = \S+/ , "bindir = #{libexec}"
s.gsub! /scriptdir = \S+/ , "scriptdir = #{libexec}"
end
inreplace 'run-mummer1' do |s|
s.gsub! /bindir = \S+/ , "bindir = #{libexec}"
end
inreplace 'run-mummer3' do |s|
s.gsub! /bindir = \S+/ , "bindir = #{libexec}"
end
%w[run-mummer1 run-mummer3 nucmer promer].each do |app|
bin.install app
end
%w[show-diff repeat-match show-snps combineMUMs mgaps dnadiff
show-tiling delta-filter exact-tandems show-coords mummer mummerplot
mapview nucmer2xfig annotate gaps].each do |app|
libexec.install app
end
libexec.install 'scripts/tandem-repeat.awk'
# postnuc, postpro, prenuc, prepro
Dir.glob('aux_bin/*').each do |script|
libexec.install script
end
(share/'mummer').install 'scripts/Foundation.pm'
end
def caveats
<<-EOS.undent
show-diff, repeat-match, show-snps, combineMUMs, mgaps, dnadiff, show-tiling,
delta-filter, exact-tandems, show-coords, mummer, mummerplot, mapview, nucmer2xfig,
annotate, and gaps have been installed in #{libexec}
EOS
end
def test
%w[ nucmer promer run-mummer1 run-mummer3 ].each do |script|
system "#{bin}/#{script} -h 2>&1 | grep -i USAGE | grep #{script}"
end
%w[ dnadiff mapview mummerplot show-diff repeat-match show-snps combineMUMs
mgaps show-tiling delta-filter show-coords mummer mummerplot mapview].each do |script|
system "#{libexec}/#{script} -h 2>&1 | grep -i USAGE | grep #{script}"
end
end
end