| 1 |
#! /usr/bin/perl |
| 2 |
|
| 3 |
# bug i45 - cmsearch incorrect model boundaries in alidisplay with local ends at terminii |
| 4 |
# |
| 5 |
# EPN, Tue Feb 21 10:27:18 2017 |
| 6 |
# |
| 7 |
|
| 8 |
$usage = "perl bug-i45.pl <cmsearch> <path to bug-i45.cm> <path to bug-i45a.fa> <path to bug-i45b.fa>\n"; |
| 9 |
if ($#ARGV != 3) { die "Wrong argument number.\n$usage"; } |
| 10 |
|
| 11 |
$cmsearch = shift; |
| 12 |
$cmfile = shift; |
| 13 |
$seqfileA = shift; |
| 14 |
$seqfileB = shift; |
| 15 |
$ok = 1; |
| 16 |
|
| 17 |
######################################### |
| 18 |
# First example of bug (A: 5' truncation): |
| 19 |
# Model is RF00177 from Rfam 12.1 |
| 20 |
# Sequence is gi|1029367024|emb|FKPB01000027.1| |
| 21 |
# This is the original CM/sequence pair that exposed the bug to Azat Badretdin. |
| 22 |
# |
| 23 |
# Original bug (latest version present v1.1.2) causes cm_alidisplay to have a |
| 24 |
# model boundary on the 3' end (2367) that exceeds the model's consensus length (1533) |
| 25 |
# due to a 5' truncation and EL at the 5' end of the alignment. |
| 26 |
# |
| 27 |
# This test script checks that the 5' model boundary in the alignment |
| 28 |
# is 1 and that the 3' model boundary in the alignment is 1533, |
| 29 |
# and fails if they are not. |
| 30 |
# |
| 31 |
if ($ok) { |
| 32 |
$output = `$cmsearch --cpu 0 --onepass --5trunc --rfam --notextw $cmfile $seqfileA`; |
| 33 |
if ($? != 0) { $ok = 0; } |
| 34 |
# find the relevant line of the output, and make sure it has 1 as the first |
| 35 |
# model position and 1533 as the final one |
| 36 |
if($output !~ /\n\s+SSU\_rRNA\_bacteria\s+1\s+[^\n]+\s+1533\n/) { |
| 37 |
$ok = 0; |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
######################################### |
| 42 |
# Second example of bug (B: 3' truncation) |
| 43 |
# Model is RF00177 from Rfam 12.1 |
| 44 |
# Sequence is the first 1100 nts of the consensus sequence of RF00177 |
| 45 |
# plus 200 C's, so it is length 1300. |
| 46 |
# |
| 47 |
# Original bug (latest version present v1.1.2) causes cm_alidisplay to have a |
| 48 |
# model boundary on the 3' end (1567) that exceeds the model's consensus length (1533) |
| 49 |
# due to a 3' truncation and EL at the 3' end of the alignment. |
| 50 |
# |
| 51 |
if ($ok) { |
| 52 |
$output = `$cmsearch --cpu 0 --onepass --3trunc --rfam --notextw $cmfile $seqfileB`; |
| 53 |
if ($? != 0) { $ok = 0; } |
| 54 |
# find the relevant line of the output, and make sure it has 1 as the first |
| 55 |
# model position and 1533 as the final one |
| 56 |
if($output !~ /\n\s+SSU\_rRNA\_bacteria\s+1\s+[^\n]+\s+1533\n/) { |
| 57 |
$ok = 0; |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
if ($ok) { print "ok\n"; exit 0; } |
| 62 |
else { print "FAILED\n"; exit 1; } |