| 1 |
#! /usr/bin/perl |
| 2 |
|
| 3 |
# Check that we can deal with HMMs with no optional annotation, in either |
| 4 |
# hmmscan or hmmsearch mode. |
| 5 |
# Bug #h69 segfaulted on this test. |
| 6 |
# |
| 7 |
# Usage: ./i9-optional-annotation.pl <builddir> <srcdir> <tmpfile prefix> |
| 8 |
# Example: ./i9-optional-annotation.pl .. .. tmpfoo |
| 9 |
# |
| 10 |
# SRE, Sun Nov 29 11:49:39 2009 |
| 11 |
|
| 12 |
BEGIN { |
| 13 |
$builddir = shift; |
| 14 |
$srcdir = shift; |
| 15 |
$tmppfx = shift; |
| 16 |
} |
| 17 |
use lib "$srcdir/testsuite"; |
| 18 |
use h3; |
| 19 |
|
| 20 |
# Verify that we have all the executables we need for the test. |
| 21 |
if (! -x "$builddir/src/hmmbuild") { die "FAIL: didn't find hmmbuild binary in $builddir/src\n"; } |
| 22 |
if (! -x "$builddir/src/hmmpress") { die "FAIL: didn't find hmmpress binary in $builddir/src\n"; } |
| 23 |
if (! -x "$builddir/src/hmmsearch") { die "FAIL: didn't find hmmsearch binary in $builddir/src\n"; } |
| 24 |
if (! -x "$builddir/src/hmmscan") { die "FAIL: didn't find hmmscan binary in $builddir/src\n"; } |
| 25 |
|
| 26 |
|
| 27 |
# Create our test files. |
| 28 |
if (! open(ALI1, ">$tmppfx.sto")) { die "FAIL: couldn't open $tmppfx.sto for write\n"; } |
| 29 |
if (! open(SEQ1, ">$tmppfx.seq")) { die "FAIL: couldn't open $tmppfx.seq for write\n"; } |
| 30 |
|
| 31 |
print ALI1 <<"EOF"; |
| 32 |
# STOCKHOLM 1.0 |
| 33 |
#=GF ID ali1 |
| 34 |
#=GF AC XX01234.5 |
| 35 |
#=GF DE A test description |
| 36 |
seq1 ACDEFGHIKLMNPQRSTVWY |
| 37 |
seq2 ACDEFGHIKLMNPQRSTVWY |
| 38 |
seq3 ACDEFGHIKLMNPQRSTVWY |
| 39 |
// |
| 40 |
# STOCKHOLM 1.0 |
| 41 |
#=GF ID ali2 |
| 42 |
seq1 ACDEFGHIKLMNPQRSTVWY |
| 43 |
seq2 ACDEFGHIKLMNPQRSTVWY |
| 44 |
seq3 ACDEFGHIKLMNPQRSTVWY |
| 45 |
// |
| 46 |
EOF |
| 47 |
|
| 48 |
print SEQ1 <<"EOF"; |
| 49 |
ID test1 STANDARD; PRT; 20 AA. |
| 50 |
AC AC00001; |
| 51 |
DE Sequence description |
| 52 |
SQ SEQUENCE 20 AA; 99999 MW; FFFFFFFFFFFFFFFF CRC64; |
| 53 |
ACDEFGHIKLMNPQRSTVWY |
| 54 |
// |
| 55 |
ID test2 STANDARD; PRT; 20 AA. |
| 56 |
SQ SEQUENCE 20 AA; 99999 MW; FFFFFFFFFFFFFFFF CRC64; |
| 57 |
ACDEFGHIKLMNPQRSTVWY |
| 58 |
// |
| 59 |
EOF |
| 60 |
|
| 61 |
close ALI1; |
| 62 |
close SEQ1; |
| 63 |
|
| 64 |
@output = `$builddir/src/hmmbuild $tmppfx.hmm $tmppfx.sto 2>&1`; |
| 65 |
if ($? != 0) { die "FAIL: hmmbuild failed\n"; } |
| 66 |
@output = `$builddir/src/hmmpress $tmppfx.hmm 2>&1`; |
| 67 |
if ($? != 0) { die "FAIL: hmmpress failed\n"; } |
| 68 |
|
| 69 |
@output = `$builddir/src/hmmscan --tblout $tmppfx.tbl1 --domtblout $tmppfx.dtbl1 $tmppfx.hmm $tmppfx.seq 2>&1`; |
| 70 |
if ($? != 0) { die "FAIL: hmmscan failed\n"; } |
| 71 |
|
| 72 |
|
| 73 |
&h3::ParseDomTbl("$tmppfx.dtbl1"); |
| 74 |
if ($h3::ndomtbl != 4) { die "FAIL: on expected number lines, dtbl1\n"; } |
| 75 |
if ($h3::tname[0] ne "ali1") { die "FAIL: on line 0 target name, dtbl1\n"; } |
| 76 |
if ($h3::tacc[0] ne "XX01234.5") { die "FAIL: on line 0 accession, dtbl1\n"; } |
| 77 |
if ($h3::tdesc[0] ne "A test description") { die "FAIL: on line 0 desc, dtbl1\n"; } |
| 78 |
if ($h3::qname[0] ne "test1") { die "FAIL: on line 0 query name, dtbl1\n"; } |
| 79 |
if ($h3::qacc[0] ne "AC00001") { die "FAIL: on line 0 query accession, dtbl1\n"; } |
| 80 |
if ($h3::tname[1] ne "ali2") { die "FAIL: on line 1 target name, dtbl1\n"; } |
| 81 |
if ($h3::tacc[1] ne "-") { die "FAIL: on line 1 accession, dtbl1\n"; } |
| 82 |
if ($h3::tdesc[1] ne "-") { die "FAIL: on line 1 desc, dtbl1\n"; } |
| 83 |
if ($h3::qname[2] ne "test2") { die "FAIL: on line 2 query name, dtbl1\n"; } |
| 84 |
if ($h3::qacc[2] ne "-") { die "FAIL: on line 2 query accession, dtbl1\n"; } |
| 85 |
|
| 86 |
@output = `$builddir/src/hmmsearch --tblout $tmppfx.tbl2 --domtblout $tmppfx.dtbl2 $tmppfx.hmm $tmppfx.seq 2>&1`; |
| 87 |
if ($? != 0) { die "FAIL: hmmsearch failed\n"; } |
| 88 |
|
| 89 |
&h3::ParseDomTbl("$tmppfx.dtbl2"); |
| 90 |
if ($h3::ndomtbl != 4) { die "FAIL: on expected number lines, dtbl2\n"; } |
| 91 |
if ($h3::tname[0] ne "test1") { die "FAIL: on line 0 target name, dtbl2\n"; } |
| 92 |
if ($h3::tacc[0] ne "AC00001") { die "FAIL: on line 0 accession, dtbl2\n"; } |
| 93 |
if ($h3::tdesc[0] ne "Sequence description") { die "FAIL: on line 0 desc, dtbl2\n"; } |
| 94 |
if ($h3::qname[0] ne "ali1") { die "FAIL: on line 0 query name, dtbl2\n"; } |
| 95 |
if ($h3::qacc[0] ne "XX01234.5") { die "FAIL: on line 0 query accession, dtbl2\n"; } |
| 96 |
if ($h3::tname[1] ne "test2") { die "FAIL: on line 1 target name, dtbl2\n"; } |
| 97 |
if ($h3::tacc[1] ne "-") { die "FAIL: on line 1 accession, dtbl2\n"; } |
| 98 |
if ($h3::tdesc[1] ne "-") { die "FAIL: on line 1 desc, dtbl2\n"; } |
| 99 |
if ($h3::qname[2] ne "ali2") { die "FAIL: on line 2 query name, dtbl2\n"; } |
| 100 |
if ($h3::qacc[2] ne "-") { die "FAIL: on line 2 query accession, dtbl2\n"; } |
| 101 |
|
| 102 |
|
| 103 |
print "ok\n"; |
| 104 |
unlink "$tmppfx.sto"; |
| 105 |
unlink "$tmppfx.seq"; |
| 106 |
unlink "$tmppfx.tbl1"; |
| 107 |
unlink "$tmppfx.tbl2"; |
| 108 |
unlink "$tmppfx.dtbl1"; |
| 109 |
unlink "$tmppfx.dtbl2"; |
| 110 |
unlink <$tmppfx.hmm*>; |
| 111 |
exit 0; |