| 1 |
#! /usr/bin/perl |
| 2 |
|
| 3 |
# Bug #e5: blank text line following #=GF <tag> handled improperly. |
| 4 |
# |
| 5 |
# Easel was allowing blank text, because we want to allow blank #=GF CC |
| 6 |
# lines for line spacing in human-readable comments. |
| 7 |
# |
| 8 |
# Problem is that then blank DE or AC lines are also accepted. HMMER |
| 9 |
# then propagates blank DESC or ACC lines to its save files. But HMMER |
| 10 |
# save file parser strictly requires DESC <s> or ACC <s>. |
| 11 |
# |
| 12 |
# SRE, Tue Jul 13 10:46:02 2010 |
| 13 |
|
| 14 |
BEGIN { |
| 15 |
$builddir = shift; |
| 16 |
$srcdir = shift; |
| 17 |
$tmppfx = shift; |
| 18 |
} |
| 19 |
|
| 20 |
# Verify that we have all the executables we need for the test. |
| 21 |
if (! -x "$builddir/miniapps/esl-reformat") { die "FAIL: didn't find esl-reformat binary in $builddir/miniapps\n"; } |
| 22 |
|
| 23 |
|
| 24 |
# Create four test files |
| 25 |
# .sto1: AC, DE followed by spaces; invalid format |
| 26 |
# .sto2: AC, DE followed by \n; invalid format |
| 27 |
# .sto3, CC followed by spaces; valid format |
| 28 |
# .sto4, CC followed by \n; valid format |
| 29 |
|
| 30 |
open(MSA1, ">$tmppfx.sto1") || die "FAIL: couldn't create $tmppfx.sto1\n"; |
| 31 |
print MSA1 << "EOF"; |
| 32 |
# STOCKHOLM 1.0 |
| 33 |
#=GF AC |
| 34 |
#=GF DE |
| 35 |
|
| 36 |
seq1 ACGTACGTACGT |
| 37 |
seq2 ACGTACGTACGT |
| 38 |
// |
| 39 |
EOF |
| 40 |
close MSA1; |
| 41 |
|
| 42 |
open(MSA2, ">$tmppfx.sto2") || die "FAIL: couldn't create $tmppfx.sto2\n"; |
| 43 |
print MSA2 << "EOF"; |
| 44 |
# STOCKHOLM 1.0 |
| 45 |
#=GF AC |
| 46 |
#=GF DE |
| 47 |
|
| 48 |
seq1 ACGTACGTACGT |
| 49 |
seq2 ACGTACGTACGT |
| 50 |
// |
| 51 |
EOF |
| 52 |
close MSA2; |
| 53 |
|
| 54 |
open(MSA3, ">$tmppfx.sto3") || die "FAIL: couldn't create $tmppfx.sto3\n"; |
| 55 |
print MSA3 << "EOF"; |
| 56 |
# STOCKHOLM 1.0 |
| 57 |
#=GF CC |
| 58 |
|
| 59 |
seq1 ACGTACGTACGT |
| 60 |
seq2 ACGTACGTACGT |
| 61 |
// |
| 62 |
EOF |
| 63 |
close MSA3; |
| 64 |
|
| 65 |
open(MSA4, ">$tmppfx.sto4") || die "FAIL: couldn't create $tmppfx.sto4\n"; |
| 66 |
print MSA4 << "EOF"; |
| 67 |
# STOCKHOLM 1.0 |
| 68 |
#=GF CC |
| 69 |
|
| 70 |
seq1 ACGTACGTACGT |
| 71 |
seq2 ACGTACGTACGT |
| 72 |
// |
| 73 |
EOF |
| 74 |
close MSA4; |
| 75 |
|
| 76 |
|
| 77 |
$output = `$builddir/miniapps/esl-reformat stockholm $tmppfx.sto1 2>&1`; |
| 78 |
if ($? == 0) { die "FAIL: blank AC,DE lines should be invalid Stockholm format (bug #e5) (1)\n"; } |
| 79 |
|
| 80 |
$output = `$builddir/miniapps/esl-reformat stockholm $tmppfx.sto2 2>&1`; |
| 81 |
if ($? == 0) { die "FAIL: blank AC,DE lines should be invalid Stockholm format (bug #e5) (2)\n"; } |
| 82 |
|
| 83 |
$output = `$builddir/miniapps/esl-reformat stockholm $tmppfx.sto3`; |
| 84 |
if ($? != 0) { die "FAIL: blank CC line should be valid Stockholm format (1)\n"; } |
| 85 |
if ($output !~ /#=GF CC/) { die "FAIL: blank CC line did not propagate\n"; } |
| 86 |
|
| 87 |
$output = `$builddir/miniapps/esl-reformat stockholm $tmppfx.sto4`; |
| 88 |
if ($? != 0) { die "FAIL: blank CC line should be valid Stockholm format (2)\n"; } |
| 89 |
if ($output !~ /#=GF CC/) { die "FAIL: blank CC line did not propagate\n"; } |
| 90 |
|
| 91 |
print "ok\n"; |
| 92 |
unlink <$tmppfx.sto*>; |
| 93 |
exit 0; |
| 94 |
|