forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kalign.rb
50 lines (46 loc) · 2.05 KB
/
kalign.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
require 'formula'
class Kalign < Formula
homepage 'http://msa.sbc.su.se/'
url 'http://msa.sbc.su.se/downloads/kalign/kalign-2.04.tar.gz'
sha1 '8bf4c1afe90e8d529840c0906c7b740299fe4041'
def install
# Hard coded prefix:
inreplace "Makefile.in", "/usr/local/bin/", "#{bin}/"
mkdir_p bin
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make install"
end
def test
# Make sure kalign can to a simple fasta sequence alignment.
input = <<-EOS.undent
>E8S7Y8
MNSPLTGTVALVAGATRGAGRQIAVQLGAAGATVYATGRTTRERRSEMDRPETIEETAELVTAAGGTGIAVAVDHLDPEQVRGLVERIDAEQGRL
DVLVNDVWGADPLITWEKPVWEQPLDAGFRTLRLAVDTHIITSHFALPLLIRNPGGLVVEVGDGTKEHNDSEYRLSVFYDLAKVSVNRLGFSQAHELAPHGCTAVALTPG
WLRSEAMLEHYGVTEANWRDAATTEPHFVMSETPAFVGRAVAALAADPDRARWNGQSLDSGGLSQVYGFTDVDGSRPHWARYYEEVVKPGKPADPDGYR
>B1K8E8
MATNLFDLTGKIALVTGASRGIGEEIAKLLAEQGAYVIVSSRKLDDCQAVADAIVAAGGRAEALACHVGRLEDIAATFEHIRGKHGRLDI
LVNNAAANPYFGHILDTDLAAYEKTVDVNIRGYFFMSVEAGKLMKTHGGGAIVNTASVNALQPGDRQGIYSITKAAVVNMTKAFAKECGP
LGIRVNALLPGLTKTKFAGALFADKDIYETWMTKIPLRRHAEPREMAGTVLYLVSDAASYTNGECIVVDGGLTI
EOS
output = `echo '#{input}' | #{bin}/kalign -f fasta 2>/dev/null`
correct = <<-EOS.undent
>E8S7Y8
MNS---PLTGTVALVAGATRGAGRQIAVQLGAAGATVYATGRTTRERRSEMDRPETIEET
AELVTAAGGTGIAVAVDHLDPEQVRGLVERIDAEQGRLDVLVNDVWGADPLITWEKPVWE
QPLDAGFRTLRLAVDTHIITSHFALPLLIRNPGGLVVEVGDGTKEHNDSEYRLSV-----
FYDLAKVSVNRLGFSQAHELAPHGCTAVALTPGWLRSE---AMLEHYGVTEANWRDAATT
EPHFVMSETPAFVGRAVAALAADPDRARWNGQSLDSGGLSQVYGFTDVDGSRPHWARYYE
EVVKPGKPADPDGYR
>B1K8E8
MATNLFDLTGKIALVTGASRGIGEEIAKLLAEQGAYVIVSSR----------KLDDCQAV
ADAIVAAGGRAEALACHVGRLEDIAATFEHIRGKHGRLDILVNN--------AAANPYFG
HILDTDLAAYEKTVDVN-IRGYFFMSV---EAGKLMKTHGGGAIVNTASVNALQPGDRQG
IYSITKAAVVNMTKAFAKECGPLGIRVNALLPGLTKTKFAGALFADKDIYET-WMTKIPL
RRH----AEPREMAGTVLYLVSDAASYTNGECIVVDGGLTI-------------------
---------------
EOS
output == correct
end
end