2
2
## Bioperl Test Harness Script for Modules
3
## $Id: phd.t,v 1.6 2001/10/14 21:46:23 jason Exp $
3
## $Id: phd.t,v 1.8.4.2 2006/11/08 17:25:55 sendu Exp $
9
10
$DEBUG = $ENV{'BIOPERLDEBUG'};
12
13
# to handle systems with no installed Test module
13
14
# we include the t dir (where a copy of Test.pm is located)
15
eval { require Test; };
16
eval { require Test::More; };
23
24
unlink qw(write_phd.phd);
26
print("Checking if the Bio::SeqIO::phd module could be used, even though it shouldn't be directly use'd...\n") if ( $DEBUG);
27
print("Checking if the Bio::SeqIO::phd module could be used, even though it shouldn't be directly used...\n") if ( $DEBUG);
29
use_ok('Bio::SeqIO::phd');
31
31
print("Checking to see if SeqWithQuality objects can be created from a file...\n") if ($DEBUG);
32
32
my $in_phd = Bio::SeqIO->new('-file' => Bio::Root::IO->catfile("t","data",
34
34
'-format' => 'phd',
35
35
'-verbose' => $DEBUG || 0);
36
isa_ok($in_phd,'Bio::SeqIO::phd');
39
39
print("I saw these in qualfile.qual:\n") if($DEBUG);
40
40
my $phd = $in_phd->next_seq();
41
print("Did you get the 'QUALITY_LEVELS' comment?\n") if ($DEBUG);
42
is($phd->{comments}->{'QUALITY_LEVELS'}, 99);
41
43
print("Checking to see if this is the right reference...\n") if( $DEBUG);
42
ok(ref($phd) eq "Bio::Seq::SeqWithQuality");
44
isa_ok($phd,"Bio::Seq::Quality");
62
64
my $out_phd = Bio::SeqIO->new(-file => ">write_phd.phd",
63
65
'-format' => 'phd');
64
66
print("Did it return the right reference?\n") if($DEBUG);
65
ok(ref($out_phd) eq "Bio::SeqIO::phd");
67
isa_ok($out_phd,"Bio::SeqIO::phd");
67
69
$out_phd->write_seq( -SeqWithQuality => $phd,
68
70
-CHROMAT_FILE => $phd->id(),
79
81
ok( -e "write_phd.phd");
85
my @qual = q(9 9 12 12 8 8 9 8 8 8 9);
86
my @trace = q(113 121 130 145 153 169 177 203 210 218 234);
88
$in_phd = Bio::SeqIO->new('-file' => Bio::Root::IO->catfile("t","data",
91
'-verbose' => $DEBUG || 0);
93
my $seq = $in_phd->next_seq;
94
is($seq->subseq(10,20),'gggggccttat','$seq->subseq()');
95
my @seq_qual =$seq->subqual_text(10,20);
96
is_deeply(\@seq_qual,\@qual,'$seq->subqual_tex()');
97
my @seq_trace = $seq->subtrace_text(10,20);
98
is_deeply(\@seq_trace,\@trace,'$seq->subqual_tex()');