| 1 |
#! /usr/bin/perl |
| 2 |
|
| 3 |
# bug i44 - cmalign --mapstr can display half basepairs |
| 4 |
# |
| 5 |
# EPN, Wed Oct 28 12:59:03 2015 |
| 6 |
# |
| 7 |
|
| 8 |
$usage = "perl bug-i44.pl <cmbuild> <cmalign>\n"; |
| 9 |
if ($#ARGV != 1) { die "Wrong argument number.\n$usage"; } |
| 10 |
|
| 11 |
$cmbuild = shift; |
| 12 |
$cmalign = shift; |
| 13 |
$ok = 1; |
| 14 |
|
| 15 |
# Make our test alignment, i44.1 |
| 16 |
# |
| 17 |
open (OUT, ">i44.1") || die; |
| 18 |
print OUT <<END; |
| 19 |
# STOCKHOLM 1.0 |
| 20 |
|
| 21 |
BX640422.1/15958-16066 GCACcUUCCCGG |
| 22 |
BX640437.1/48199-48307 G.AC.UUCCCGG |
| 23 |
CP000089.1/376642-376729 G.AC.UUCCCGG |
| 24 |
#=GC SS_cons <<.AA..>>.aa |
| 25 |
#=GC RF GCAC.UUCCCGG |
| 26 |
// |
| 27 |
END |
| 28 |
close OUT; |
| 29 |
# Make our test sequence to align, i44.2 |
| 30 |
# |
| 31 |
open (OUT, ">i44.2") || die; |
| 32 |
print OUT <<END; |
| 33 |
>consensus |
| 34 |
GACUUCCCGG |
| 35 |
END |
| 36 |
close OUT; |
| 37 |
|
| 38 |
# build the model |
| 39 |
if ($ok) { |
| 40 |
$output = `$cmbuild -F i44.cm i44.1`; |
| 41 |
if ($? != 0) { $ok = 0; } |
| 42 |
# make sure output includes a 'CPU' string indicating success |
| 43 |
if($output !~ /\n\# CPU/) { |
| 44 |
$ok = 0; |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
# align the sequence and use --mapali and --mapstr |
| 49 |
if ($ok) { |
| 50 |
$output = `$cmalign --mapali i44.1 --mapstr -o i44.3 i44.cm i44.2`; |
| 51 |
if ($? != 0) { $ok = 0; } |
| 52 |
# make sure output includes a 'CPU' string indicating success |
| 53 |
if($output !~ /\n\# CPU/) { |
| 54 |
$ok = 0; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
# make sure the output structure is correct |
| 59 |
if ($ok) { |
| 60 |
# make sure there's a hit in the tab file (if the bug exists, there won't be) |
| 61 |
if(open(IN, "i44.3")) { |
| 62 |
$ok = 0; |
| 63 |
while($line = <IN>) { |
| 64 |
chomp $line; |
| 65 |
if($line =~ s/^\#=GC SS_cons\s+//) { |
| 66 |
chomp $line; |
| 67 |
if($line eq "<..A....>..a") { |
| 68 |
$ok = 1; |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
close(IN); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
foreach $tmpfile ("i44.1", "i44.2", "i44.3", "i44.cm") { |
| 77 |
unlink $tmpfile if -e $tmpfile; |
| 78 |
} |
| 79 |
if ($ok) { print "ok\n"; exit 0; } |
| 80 |
else { print "FAILED\n"; exit 1; } |
| 81 |
|
| 82 |
|