| 1 |
#! /usr/bin/perl |
| 2 |
|
| 3 |
# Tests of cmsearch sensitivity using examples collected |
| 4 |
# in 2002 by Sean. |
| 5 |
# |
| 6 |
# 00README from infernal/testsuite/ in Infernal versions |
| 7 |
# 0.55->1.0.2. (Updated to remove 'mito-celegans' files which I can't |
| 8 |
# find, and replace with 'mito-ascaris.fa'.) |
| 9 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
# Test cases for INFERNAL search sensitivity |
| 11 |
# SRE, Fri May 17 12:00:03 2002 |
| 12 |
# |
| 13 |
# |
| 14 |
# tRNA1415G.sto - tRNA alignment. 1415 sequences. |
| 15 |
# mito-ascaris.fa - Ascaris suum mito. 14284 bp. [FASTA] |
| 16 |
# Two tRNAs found by tRNAscan-SE v1.23, with -O |
| 17 |
# 4169..4230 and 2125..2049, with low bit scores |
| 18 |
# (< 17 bits). Second one is not real. Infernal |
| 19 |
# finds others. |
| 20 |
# mito-ascaris.gb - Ascaris suum mito. 14284 bp. [Genbank] |
| 21 |
# Includes other tRNAs - this script currently |
| 22 |
# doesn't use this file, but we could to |
| 23 |
# test if Infernal's other hits are real. |
| 24 |
# |
| 25 |
# srp-euk.sto - SRP RNA alignment. 37 sequences. |
| 26 |
# ffs-frag.fa - 20kb fragment of E. coli m54, GB:U00096. [FASTA] |
| 27 |
# ffs is annotated at 15648..15785; |
| 28 |
# is really at 15672..15784 by BLASTN to [Larsen93] seq |
| 29 |
# ffs-ecoli.fa - 113 nt 4.5S ffs RNA from E. coli [Larsen93] |
| 30 |
# |
| 31 |
# |
| 32 |
# rnaseP-eubact.sto - Jim Brown's a_bacterial_rnas.gb. xref ~/db/RNaseP. |
| 33 |
# 340 sequences. |
| 34 |
# rnaseP-frag.fa - 20 kb fragment of B. subtilis, GB:AL009126 [FASTA] |
| 35 |
# frag is from 2320001..2340000 |
| 36 |
# in this frag, RNaseP is 10962..10562 (rev strand) |
| 37 |
# rnaseP-bsu.fa - 401 nt P RNA from B. subtilis [JW Brown's db] |
| 38 |
# |
| 39 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 40 |
# |
| 41 |
# Each stockholm alignment (.sto suffixed) file was used to build |
| 42 |
# a CM using default v1.1 cmbuild. Those models were then calibrated |
| 43 |
# using default v1.1 cmcalibrate. These 3 models are used in this |
| 44 |
# test script. |
| 45 |
# |
| 46 |
# Usage: ./itest6-sensitivity.pl <builddir> <srcdir> <tmpfile prefix> |
| 47 |
# Example: ./itest6-sensitivity.pl .. .. tmpfoo |
| 48 |
# |
| 49 |
# EPN, Tue May 1 08:15:38 2012 |
| 50 |
|
| 51 |
|
| 52 |
BEGIN { |
| 53 |
$builddir = shift; |
| 54 |
$srcdir = shift; |
| 55 |
$tmppfx = shift; |
| 56 |
} |
| 57 |
use lib "$srcdir/testsuite"; # The BEGIN is necessary to make this work: sets $srcdir at compile-time |
| 58 |
use i1; |
| 59 |
|
| 60 |
$verbose = 1; |
| 61 |
|
| 62 |
# The test makes use of the following files: |
| 63 |
# |
| 64 |
# tRNA1415G.c.cm <cm> calibrated tRNA model, built from tRNA1415G.sto |
| 65 |
# srp-euk.c.cm <cm> calibrated Euk SRP model, built from srp-euk.sto |
| 66 |
# rnasep-eubact.c.cm <cm> calibrated type A bacterial Rnase P model, built |
| 67 |
# from rnasep-eubact.sto |
| 68 |
# 5 sequence files: all .fa files listed in header above, which was |
| 69 |
# excised from Sean's 2002 00README. |
| 70 |
# |
| 71 |
# It creates the following files: |
| 72 |
# $tmppfx.cm1 <cm> copy of tRNA1415G.c.cm |
| 73 |
# $tmppfx.cm2 <cm> copy of srp-euk.c.cm |
| 74 |
# $tmppfx.cm3 <cm> copy of rnasep-eubact.c.cm |
| 75 |
|
| 76 |
# All models assumed to be in testsuite subdirectory. |
| 77 |
$model1 = "tRNA1415G"; |
| 78 |
$model2 = "srp-euk"; |
| 79 |
$model3 = "rnaseP-eubact"; |
| 80 |
|
| 81 |
@i1progs = ("cmpress", "cmsearch", "cmscan"); |
| 82 |
@seqfiles = ("tRNA1415G.sto", "mito-ascaris.fa", "srp-euk.sto", "ffs-frag.fa", "ffs-ecoli.fa", "rnaseP-eubact.sto", "rnaseP-frag.fa", "rnaseP-bsu.fa"); |
| 83 |
# Verify that we have all the executables and datafiles we need for the test. |
| 84 |
foreach $i1prog (@i1progs) { if (! -x "$builddir/src/$i1prog") { die "FAIL: didn't find $i1prog executable in $builddir/src\n"; } } |
| 85 |
foreach $seqfile (@seqfiles) { if (! -e "$srcdir/testsuite/$seqfile") { die "FAIL: didn't find $seqfile in $srcdir/testsuite/\n"; } } |
| 86 |
|
| 87 |
if (! -r "$srcdir/testsuite/$model1.c.cm") { die "FAIL: can't read profile $model1.c.cm in $srcdir/testsuite\n"; } |
| 88 |
if (! -r "$srcdir/testsuite/$model2.c.cm") { die "FAIL: can't read profile $model2.c.cm in $srcdir/testsuite\n"; } |
| 89 |
if (! -r "$srcdir/testsuite/$model3.c.cm") { die "FAIL: can't read profile $model3.c.cm in $srcdir/testsuite\n"; } |
| 90 |
|
| 91 |
# Create the test CM files |
| 92 |
`cat $srcdir/testsuite/$model1.c.cm > $tmppfx.cm1`; if ($?) { die "FAIL: cat\n"; } |
| 93 |
`cat $srcdir/testsuite/$model2.c.cm > $tmppfx.cm2`; if ($?) { die "FAIL: cat\n"; } |
| 94 |
`cat $srcdir/testsuite/$model3.c.cm > $tmppfx.cm3`; if ($?) { die "FAIL: cat\n"; } |
| 95 |
|
| 96 |
|
| 97 |
###################### |
| 98 |
# tRNA |
| 99 |
# |
| 100 |
# tRNAscan-SE only detects two tRNAs when run in organellar mode, |
| 101 |
# and one doesn't look real. cmsearch finds more. We check that |
| 102 |
# the top hit is the same promising one from tRNAscan-SE. |
| 103 |
###################### |
| 104 |
`cat $srcdir/testsuite/mito-ascaris.fa > $tmppfx.fa`; if ($?) { die "FAIL: cat\n"; } |
| 105 |
|
| 106 |
# cmsearch |
| 107 |
$output = `$builddir/src/cmsearch -E 1E-3 --tblout $tmppfx.tbl $tmppfx.cm1 $tmppfx.fa 2>&1`; |
| 108 |
if ($? != 0) { die "FAIL: cmsearch failed\n"; } |
| 109 |
# first hit should be the best (and only real) tRNAscan-SE hit, 4169..4230 |
| 110 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 111 |
if ($i1::ntbl < 1) { die "FAIL: cmsearch tRNA, no hits found\n"; } |
| 112 |
if ($i1::sfrom[0] ne "4169") { die "FAIL: cmsearch tRNA hit 1, start position\n"; } |
| 113 |
if ($i1::sto[0] ne "4230") { die "FAIL: cmsearch tRNA hit 1, stop position\n"; } |
| 114 |
|
| 115 |
# cmscan |
| 116 |
# press the model first |
| 117 |
if(-e "$tmppfx.cm1.i1m") { unlink "$tmppfx.cm1.i1m"; } |
| 118 |
if(-e "$tmppfx.cm1.i1p") { unlink "$tmppfx.cm1.i1p"; } |
| 119 |
if(-e "$tmppfx.cm1.i1f") { unlink "$tmppfx.cm1.i1f"; } |
| 120 |
if(-e "$tmppfx.cm1.i1i") { unlink "$tmppfx.cm1.i1i"; } |
| 121 |
if(-e "$tmppfx.cm1.ssi") { unlink "$tmppfx.cm1.ssi"; } |
| 122 |
`$builddir/src/cmpress $tmppfx.cm1`; if ($?) { die "FAIL: cmpress\n"; } |
| 123 |
$output = `$builddir/src/cmscan -E 1E-3 --tblout $tmppfx.tbl $tmppfx.cm1 $tmppfx.fa 2>&1`; |
| 124 |
if ($? != 0) { die "FAIL: cmscan failed\n"; } |
| 125 |
# first hit should be the best (and only real) tRNAscan-SE hit, 4169..4230 |
| 126 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 127 |
if ($i1::ntbl < 1) { die "FAIL: cmscan tRNA, no hits found\n"; } |
| 128 |
if ($i1::sfrom[0] ne "4169") { die "FAIL: cmscan tRNA hit 1, start position\n"; } |
| 129 |
if ($i1::sto[0] ne "4230") { die "FAIL: cmscan tRNA hit 1, stop position\n"; } |
| 130 |
|
| 131 |
###################### |
| 132 |
# srp-euk |
| 133 |
# |
| 134 |
# Default cmsearch can't detect the homology between the euk model and |
| 135 |
# the E coli sequence. We need to omit the HMM filters with --nohmm to |
| 136 |
# get any hits to the correct region and even then our best hit is a |
| 137 |
# 26 nt segment with a bit score of only 14.9 (as of v1.1). We tighten |
| 138 |
# QDB beta values to make the search a little faster, and we only |
| 139 |
# do cmsearch on the larger subseq to save time. |
| 140 |
###################### |
| 141 |
`cat $srcdir/testsuite/ffs-frag.fa > $tmppfx.fa`; if ($?) { die "FAIL: cat\n"; } |
| 142 |
`cat $srcdir/testsuite/ffs-ecoli.fa > $tmppfx.fa2`; if ($?) { die "FAIL: cat\n"; } |
| 143 |
|
| 144 |
# cmsearch |
| 145 |
# larger subseq |
| 146 |
$output = `$builddir/src/cmsearch -E 0.01 --nohmm --fbeta 1E-2 --beta 1E-4 --tblout $tmppfx.tbl $tmppfx.cm2 $tmppfx.fa 2>&1`; |
| 147 |
if ($? != 0) { die "FAIL: cmsearch failed\n"; } |
| 148 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 149 |
if ($i1::ntbl < 1) { die "FAIL: cmsearch long SRP, no hits found\n"; } |
| 150 |
if ($i1::sfrom[0] ne "15714") { die "FAIL: cmsearch long SRP hit 1, start position\n"; } |
| 151 |
if ($i1::sto[0] ne "15739") { die "FAIL: cmsearch long SRP hit 1, stop position\n"; } |
| 152 |
|
| 153 |
# shorter subseq |
| 154 |
$output = `$builddir/src/cmsearch -E 0.01 --nohmm --fbeta 1E-2 --beta 1E-4 --tblout $tmppfx.tbl $tmppfx.cm2 $tmppfx.fa2 2>&1`; |
| 155 |
if ($? != 0) { die "FAIL: cmsearch failed\n"; } |
| 156 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 157 |
if ($i1::ntbl < 1) { die "FAIL: cmsearch short SRP, no hits found\n"; } |
| 158 |
if ($i1::sfrom[0] ne "43") { die "FAIL: cmsearch short SRP hit 1, start position\n"; } |
| 159 |
if ($i1::sto[0] ne "68") { die "FAIL: cmsearch short SRP hit 1, stop position\n"; } |
| 160 |
|
| 161 |
# cmscan |
| 162 |
# press the model first |
| 163 |
if(-e "$tmppfx.cm2.i1m") { unlink "$tmppfx.cm2.i1m"; } |
| 164 |
if(-e "$tmppfx.cm2.i1p") { unlink "$tmppfx.cm2.i1p"; } |
| 165 |
if(-e "$tmppfx.cm2.i1f") { unlink "$tmppfx.cm2.i1f"; } |
| 166 |
if(-e "$tmppfx.cm2.i1i") { unlink "$tmppfx.cm2.i1i"; } |
| 167 |
if(-e "$tmppfx.cm2.ssi") { unlink "$tmppfx.cm2.ssi"; } |
| 168 |
`$builddir/src/cmpress $tmppfx.cm2`; if ($?) { die "FAIL: cmpress\n"; } |
| 169 |
|
| 170 |
# shorter subseq (we don't search longer subseq) |
| 171 |
$output = `$builddir/src/cmscan -E 0.01 --nohmm --fbeta 1E-2 --beta 1E-4 --tblout $tmppfx.tbl $tmppfx.cm2 $tmppfx.fa2 2>&1`; |
| 172 |
|
| 173 |
if ($? != 0) { die "FAIL: cmscan failed\n"; } |
| 174 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 175 |
if ($i1::ntbl < 1) { die "FAIL: cmscan short SRP, no hits found\n"; } |
| 176 |
if ($i1::sfrom[0] ne "43") { die "FAIL: cmscan short SRP hit 1, start position\n"; } |
| 177 |
if ($i1::sto[0] ne "68") { die "FAIL: cmscan short SRP hit 1, stop position\n"; } |
| 178 |
|
| 179 |
|
| 180 |
###################### |
| 181 |
# rnasep-eubact |
| 182 |
# |
| 183 |
# The model doesn't seem to be full length, but cmsearch does |
| 184 |
# find P with default settings. |
| 185 |
###################### |
| 186 |
`cat $srcdir/testsuite/rnaseP-frag.fa > $tmppfx.fa`; if ($?) { die "FAIL: cat\n"; } |
| 187 |
`cat $srcdir/testsuite/rnaseP-bsu.fa > $tmppfx.fa2`; if ($?) { die "FAIL: cat\n"; } |
| 188 |
|
| 189 |
# cmsearch |
| 190 |
# longer subseq |
| 191 |
$output = `$builddir/src/cmsearch -E 0.1 --tblout $tmppfx.tbl $tmppfx.cm3 $tmppfx.fa 2>&1`; |
| 192 |
if ($? != 0) { die "FAIL: cmsearch failed\n"; } |
| 193 |
|
| 194 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 195 |
if ($i1::ntbl < 1) { die "FAIL: cmsearch long Rnase P, no hits found\n"; } |
| 196 |
if ($i1::sfrom[0] ne "10920") { die "FAIL: cmsearch long Rnase P hit 1, start position\n"; } |
| 197 |
if ($i1::sto[0] ne "10580") { die "FAIL: cmsearch long Rnase P hit 1, stop position\n"; } |
| 198 |
|
| 199 |
# shorter subseq |
| 200 |
$output = `$builddir/src/cmsearch -E 0.1 --tblout $tmppfx.tbl $tmppfx.cm3 $tmppfx.fa2 2>&1`; |
| 201 |
if ($? != 0) { die "FAIL: cmsearch failed\n"; } |
| 202 |
|
| 203 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 204 |
if ($i1::ntbl < 1) { die "FAIL: cmsearch short Rnase P, no hits found\n"; } |
| 205 |
if ($i1::sfrom[0] ne "43") { die "FAIL: cmsearch short Rnase P hit 1, start position\n"; } |
| 206 |
if ($i1::sto[0] ne "383") { die "FAIL: cmsearch short Rnase P hit 1, stop position\n"; } |
| 207 |
|
| 208 |
# cmscan |
| 209 |
# press the model first |
| 210 |
if(-e "$tmppfx.cm3.i1m") { unlink "$tmppfx.cm3.i1m"; } |
| 211 |
if(-e "$tmppfx.cm3.i1p") { unlink "$tmppfx.cm3.i1p"; } |
| 212 |
if(-e "$tmppfx.cm3.i1f") { unlink "$tmppfx.cm3.i1f"; } |
| 213 |
if(-e "$tmppfx.cm3.i1i") { unlink "$tmppfx.cm3.i1i"; } |
| 214 |
if(-e "$tmppfx.cm3.ssi") { unlink "$tmppfx.cm3.ssi"; } |
| 215 |
`$builddir/src/cmpress $tmppfx.cm3`; if ($?) { die "FAIL: cmpress\n"; } |
| 216 |
|
| 217 |
# shorter subseq (we don't search longer subseq) |
| 218 |
$output = `$builddir/src/cmscan -E 0.1 --tblout $tmppfx.tbl $tmppfx.cm3 $tmppfx.fa2 2>&1`; |
| 219 |
if ($? != 0) { die "FAIL: cmscan failed\n"; } |
| 220 |
|
| 221 |
&i1::ParseTblFormat1("$tmppfx.tbl"); |
| 222 |
if ($i1::ntbl < 1) { die "FAIL: cmscan short Rnase P, no hits found\n"; } |
| 223 |
if ($i1::sfrom[0] ne "43") { die "FAIL: cmscan short Rnase P hit 1, start position\n"; } |
| 224 |
if ($i1::sto[0] ne "383") { die "FAIL: cmscan short Rnase P hit 1, stop position\n"; } |
| 225 |
|
| 226 |
print "ok.\n"; |
| 227 |
unlink <$tmppfx.cm1*>; |
| 228 |
unlink <$tmppfx.cm2*>; |
| 229 |
unlink <$tmppfx.cm3*>; |
| 230 |
unlink "$tmppfx.tbl"; |
| 231 |
unlink "$tmppfx.fa"; |
| 232 |
unlink "$tmppfx.fa2"; |
| 233 |
|
| 234 |
exit 0; |