1#!/usr/local/bin/perl 2 3# Test the ability of hmmbuild to deal with crappy alignments 4# of lots of sequence fragments. 5# 6# Usage: ./i7-hmmbuild-fragments.pl <hmmbuild binary> <tmpfile prefix> 7# Example: ./i7-hmmbuild-fragments.pl ../src/hmmbuild tmpfoo 8# 9# SRE, Tue Jun 16 13:37:05 2009 10 11 12$hmmbuild = shift; 13$tmppfx = shift; 14 15if (! -x "$hmmbuild") { die "FAIL: didn't find hmmalign binary $hmmalign\n"; } 16open (TMPFILE, ">$tmppfx.sto") || die "FAIL: couldn't open $tmppfx.sto for writing\n"; 17print TMPFILE << "EOF"; 18# STOCKHOLM 1.0 19 20#=GF ID test 21 22seq1 ACDEFGHIKL------------------------------ 23seq2 ----------MNPQRSTVWY-------------------- 24seq3 --------------------ACDEFGHIKL---------- 25seq4 ------------------------------MNPQRSTVWY 26// 27EOF 28close TMPFILE; 29 30 31$output = `$hmmbuild -O $tmppfx.sto2 $tmppfx.hmm $tmppfx.sto 2>&1`; 32if ($? != 0) { die "FAIL: hmmbuild failed unexpectedly\n"; } 33 34$output =~ /1\s+test\s+4\s+40\s+(\d+)/; 35if ($1 != 40) { die "FAIL: should've built a M=40 model\n"; } 36 37 38$output = `$hmmbuild --fragthresh 0.0 $tmppfx.hmm $tmppfx.sto 2>&1`; 39if ($? == 0) { die "FAIL: hmmbuild should have failed but didn't\n"; } 40 41 42print "ok\n"; 43unlink "$tmppfx.sto"; 44unlink "$tmppfx.sto2"; 45unlink "$tmppfx.hmm"; 46exit 0; 47