3
## Bioperl Test Harness Script for Modules
4
## $Id: EMBOSS.t,v 1.6.2.3 2002/03/18 14:31:09 jason Exp $
6
# Before `make install' is performed this script should be runnable with
7
# `make test'. After `make install' it should work as `perl test.t'
12
# to handle systems with no installed Test module
13
# we include the t dir (where a copy of Test.pm is located)
15
eval { require Test; };
21
plan tests => $NTESTS }
23
use Bio::Factory::EMBOSS;
27
my $compseqoutfile = 'dna1.4.compseq';
28
my $wateroutfile = 'cysprot.water';
29
my $consoutfile = 'cysprot.cons';
32
foreach ( $Test::ntest..$NTESTS ) {
33
skip("EMBOSS not installed locally",1);
35
unlink($compseqoutfile);
36
unlink($wateroutfile);
41
my $verbose = $ENV{'BIOPERLDEBUG'} || -1;
44
## End of black magic.
46
## Insert additional test code below but remember to change
47
## the print "1..x\n" in the BEGIN block to reflect the
48
## total number of tests that will be run.
50
my $factory = new Bio::Factory::EMBOSS(-verbose => $verbose);
53
my $compseqapp = $factory->program('compseq');
60
my %input = ( '-word' => 4,
61
'-sequence' => Bio::Root::IO->catfile('t',
64
'-outfile' => $compseqoutfile);
65
$compseqapp->run(\%input);
66
ok(-e $compseqoutfile);
67
#if( open(IN, $compseqoutfile) ) {
68
# while(<IN>) { print }
71
my $water = $factory->program('water');
75
# testing in-memory use of
76
my $in = new Bio::SeqIO(-format => 'fasta',
77
-file => Bio::Root::IO->catfile('t',
80
my $seq = $in->next_seq();
83
$in = new Bio::SeqIO(-format => 'fasta',
84
-file => Bio::Root::IO->catfile('t',
87
while( my $s = $in->next_seq) {
90
$water->run({ '-sequencea' => $seq,
93
'-gapextend' => '0.5',
94
'-outfile' => $wateroutfile});
98
my $alnin = new Bio::AlignIO(-format => 'emboss',
99
-file => $wateroutfile);
102
my $aln = $alnin->next_aln;
104
ok($aln->length, 43);
105
ok($aln->overall_percentage_identity, 100);
106
ok($aln->average_percentage_identity, 100);
108
my ($first) = $aln->each_seq();
109
ok($first->seq(), 'SCWSFSTTGNVEGQHFISQNKLVSLSEQNLVDCDHECMEYEGE');
110
$aln = $alnin->next_aln;
112
ok($aln->length, 339);
113
ok(sprintf("%.2f",$aln->overall_percentage_identity), 33.04);
114
ok(sprintf("%.2f",$aln->average_percentage_identity), 40.58);
116
my $cons = $factory->program('cons');
118
$in = new Bio::AlignIO(-format => 'msf',
119
-file => Bio::Root::IO->catfile('t',
122
my $aln2 = $in->next_aln;
123
$cons->run({ '-msf' => $aln2,
124
'-outseq'=> $consoutfile});