Debian Codegraph @

hmmer/testsuite/i10-duplicate-names.pl

raw
1 #! /usr/bin/perl
2
3 # Check how we handle duplicate names, for both queries and targets.
4 # Indexing HMM or sequence files does require unique names/accessions.
5 # Aside from SSI indexes, other HMMER operations do not require unique
6 # names/accessions.
7 #
8 # Usage: ./i10-duplicate-names.pl <builddir> <srcdir> <tmpfile prefix>
9 # Example: ./i10-duplicate-names.pl .. .. tmpfoo
10 #
11 # SRE, Sun Dec 13 14:41:31 2009 [Yokohama, Japan]
12
13
14 BEGIN {
15 $builddir = shift;
16 $srcdir = shift;
17 $tmppfx = shift;
18 }
19 use lib "$srcdir/testsuite"; # The BEGIN is necessary to make this work: sets $srcdir at compile-time
20 use h3;
21
22
23 # Verify that we have all the executables we need for the test.
24 if (! -x "$builddir/src/hmmbuild") { die "FAIL: didn't find hmmbuild binary in $builddir/src\n"; }
25 if (! -x "$builddir/src/hmmpress") { die "FAIL: didn't find hmmpress binary in $builddir/src\n"; }
26 if (! -x "$builddir/src/hmmsearch") { die "FAIL: didn't find hmmsearch binary in $builddir/src\n"; }
27 if (! -x "$builddir/src/hmmscan") { die "FAIL: didn't find hmmscan binary in $builddir/src\n"; }
28 if (! -x "$builddir/src/phmmer") { die "FAIL: didn't find phmmer binary in $builddir/src\n"; }
29 if (! -x "$builddir/src/jackhmmer") { die "FAIL: didn't find jackhmmer binary in $builddir/src\n"; }
30
31 # Create our test files
32 if (! open(ALI1, ">$tmppfx.sto")) { print "FAIL: couldn't open $tmppfx.sto for write"; exit 1; }
33 if (! open(SEQ1, ">$tmppfx.fa")) { print "FAIL: couldn't open $tmppfx.fa for write"; exit 1; }
34
35 print ALI1 <<"EOF";
36 # STOCKHOLM 1.0
37 #=GF ID profile
38 #=GF AC XX01234.5
39 #=GF DE A test description
40 seq1 ACDEFGHIKLMNPQRSTVWY
41 seq2 ACDEFGHIKLMNPQRSTVWY
42 seq3 ACDEFGHIKLMNPQRSTVWY
43 //
44 # STOCKHOLM 1.0
45 #=GF ID profile
46 #=GF AC XX01234.5
47 #=GF DE A test description
48 seq1 ACDEFGHIKLLMNPQRSTVWY
49 seq2 ACDEFGHIKLLMNPQRSTVWY
50 seq3 ACDEFGHIKLLMNPQRSTVWY
51 //
52 EOF
53
54 print SEQ1 << "EOF";
55 >seq
56 ACDEFGHIKLMNPQRSTVWY
57 >seq
58 ACDEFGHIKLLMNPQRSTVWY
59 EOF
60
61 close ALI1;
62 close SEQ1;
63
64 # Build profiles from the test alignments
65 @output = `$builddir/src/hmmbuild $tmppfx.hmm $tmppfx.sto 2>&1`;
66 if ($? != 0) { die "FAIL: hmmbuild failed\n"; }
67
68 # You can't hmmpress a file with duplicate HMM names; SSI indexing will reject it.
69 @output = `$builddir/src/hmmpress $tmppfx.hmm 2>&1`;
70 if ($? == 0) { die "FAIL: hmmpress should reject indexing an HMM file with duplicate names\n"; }
71
72
73
74 # phmmer should show four results
75 $output = `$builddir/src/phmmer --tblout $tmppfx.tbl $tmppfx.fa $tmppfx.fa 2>&1`;
76 if ($? != 0) { die "FAIL: phmmer failed\n"; }
77
78 &h3::ParseTbl("$tmppfx.tbl");
79 if ($h3::ntbl != 4) { die "FAIL: on expected number of hits, phmmer\n"; }
80
81
82 # jackhmmer should show four results
83 $output = `$builddir/src/jackhmmer --tblout $tmppfx.tbl $tmppfx.fa $tmppfx.fa 2>&1`;
84 if ($? != 0) { die "FAIL: jackhmmer failed\n"; }
85
86 &h3::ParseTbl("$tmppfx.tbl");
87 if ($h3::ntbl != 4) { die "FAIL: on expected number of hits, jackhmmer\n"; }
88
89
90 # hmmsearch should show four results
91 $output = `$builddir/src/hmmsearch --tblout $tmppfx.tbl $tmppfx.hmm $tmppfx.fa 2>&1`;
92 if ($? != 0) { die "FAIL: hmmsearch failed\n"; }
93
94 &h3::ParseTbl("$tmppfx.tbl");
95 if ($h3::ntbl != 4) { die "FAIL: on expected number of hits, hmmsearch\n"; }
96
97
98 # hmmscan requires hmmpress'd databases, so it can't handle dup names/accessions.
99
100
101 print "ok\n";
102 unlink "$tmppfx.sto";
103 unlink "$tmppfx.fa";
104 unlink "$tmppfx.tbl";
105 unlink <$tmppfx.hmm*>;
106 exit 0;
107
108
109
110
111