| 1 |
#! /usr/bin/perl |
| 2 |
|
| 3 |
# Check that we can deal with profiles and sequences that contain |
| 4 |
# duplicate names, both as queries and targets. |
| 5 |
# |
| 6 |
# Usage: ./itest2-duplicate-names.pl <builddir> <srcdir> <tmpfile prefix> |
| 7 |
# Example: ./itest2-duplicate-names.pl .. .. tmpfoo |
| 8 |
# |
| 9 |
# SRE, Sun Dec 13 14:41:31 2009 [Yokohama, Japan] |
| 10 |
|
| 11 |
BEGIN { |
| 12 |
$builddir = shift; |
| 13 |
$srcdir = shift; |
| 14 |
$tmppfx = shift; |
| 15 |
} |
| 16 |
use lib "$srcdir/testsuite"; # The BEGIN is necessary to make this work: sets $srcdir at compile-time |
| 17 |
use i1; |
| 18 |
|
| 19 |
|
| 20 |
# Verify that we have all the executables we need for the test. |
| 21 |
if (! -x "$builddir/src/cmbuild") { die "FAIL: didn't find cmbuild binary in $builddir/src\n"; } |
| 22 |
if (! -x "$builddir/src/cmcalibrate") { die "FAIL: didn't find cmcalibrate binary in $builddir/src\n"; } |
| 23 |
if (! -x "$builddir/src/cmpress") { die "FAIL: didn't find cmpress binary in $builddir/src\n"; } |
| 24 |
if (! -x "$builddir/src/cmsearch") { die "FAIL: didn't find cmsearch binary in $builddir/src\n"; } |
| 25 |
if (! -x "$builddir/src/cmscan") { die "FAIL: didn't find cmscan binary in $builddir/src\n"; } |
| 26 |
|
| 27 |
# Create our test files |
| 28 |
if (! open(ALI1, ">$tmppfx.sto")) { print "FAIL: couldn't open $tmppfx.sto for write"; exit 1; } |
| 29 |
if (! open(SEQ1, ">$tmppfx.fa")) { print "FAIL: couldn't open $tmppfx.fa for write"; exit 1; } |
| 30 |
|
| 31 |
print ALI1 <<"EOF"; |
| 32 |
# STOCKHOLM 1.0 |
| 33 |
#=GF ID profile |
| 34 |
#=GF AC XX01234.5 |
| 35 |
#=GF DE A test description |
| 36 |
seq1 ACGUACGUACGUACGUACGUACGU |
| 37 |
seq2 ACGUACGUACGUACGUACGUACGU |
| 38 |
seq3 ACGUACGUACGUACGUACGUACGU |
| 39 |
#=GC SS_cons <<<<________________>>>> |
| 40 |
// |
| 41 |
# STOCKHOLM 1.0 |
| 42 |
#=GF ID profile |
| 43 |
#=GF AC XX01234.5 |
| 44 |
#=GF DE A test description |
| 45 |
seq1 UGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCA |
| 46 |
seq2 UGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCA |
| 47 |
seq3 UGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCA |
| 48 |
#=GC SS_cons <<<<<<<<________________>>>>>>>> |
| 49 |
// |
| 50 |
EOF |
| 51 |
|
| 52 |
print SEQ1 << "EOF"; |
| 53 |
>seq |
| 54 |
ACGUACGUACGUACGUACGUACGU |
| 55 |
>seq |
| 56 |
UGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCA |
| 57 |
EOF |
| 58 |
|
| 59 |
close ALI1; |
| 60 |
close SEQ1; |
| 61 |
|
| 62 |
if(-e "$tmppfx.cm.i1m") { unlink "$tmppfx.cm.i1m"; } |
| 63 |
if(-e "$tmppfx.cm.i1p") { unlink "$tmppfx.cm.i1p"; } |
| 64 |
if(-e "$tmppfx.cm.i1f") { unlink "$tmppfx.cm.i1f"; } |
| 65 |
if(-e "$tmppfx.cm.i1i") { unlink "$tmppfx.cm.i1i"; } |
| 66 |
if(-e "$tmppfx.cm.ssi") { unlink "$tmppfx.cm.ssi"; } |
| 67 |
|
| 68 |
|
| 69 |
# cmbuild and cmcalibrate will succeed; they don't care about dup names. |
| 70 |
# cmpress will fail; it uses an SSI index, which does care about dup names. |
| 71 |
@output = `$builddir/src/cmbuild -F $tmppfx.cm $tmppfx.sto 2>&1`; if ($? != 0) { die "FAIL: cmbuild failed\n"; } |
| 72 |
@output = `$builddir/src/cmcalibrate -L 0.05 $tmppfx.cm 2>&1`; if ($? != 0) { die "FAIL: cmcalibrate failed\n"; } |
| 73 |
@output = `$builddir/src/cmpress -F $tmppfx.cm 2>&1`; if ($? == 0) { die "FAIL: cmpress should have detected dup names and failed, but it didn't\n"; } |
| 74 |
|
| 75 |
# cmsearch should show four results |
| 76 |
$output = `$builddir/src/cmsearch --tblout $tmppfx.tbl $tmppfx.cm $tmppfx.fa 2>&1`; |
| 77 |
if ($? != 0) { die "FAIL: cmsearch failed\n"; } |
| 78 |
|
| 79 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 80 |
if ($i1::ntbl != 4) { die "FAIL: on expected number of hits, cmsearch\n"; } |
| 81 |
|
| 82 |
# you can't run cmscan, because it depends on cmpress success |
| 83 |
|
| 84 |
|
| 85 |
print "ok\n"; |
| 86 |
unlink "$tmppfx.sto"; |
| 87 |
unlink "$tmppfx.fa"; |
| 88 |
unlink "$tmppfx.tbl"; |
| 89 |
unlink <$tmppfx.cm*>; |
| 90 |
exit 0; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|