~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to t/phd.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*-Perl-*-
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 $
4
4
#
5
5
 
6
6
 
7
7
use strict;
8
8
use vars qw($DEBUG);
 
9
use Bio::Root::IO;
9
10
$DEBUG = $ENV{'BIOPERLDEBUG'};
10
11
 
11
12
BEGIN {
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)
14
15
        # as a fallback
15
 
    eval { require Test; };
 
16
    eval { require Test::More; };
16
17
    if( $@ ) {
17
 
        use lib 't';
 
18
        use lib 't/lib';
18
19
    }
19
 
    use Test;
20
 
    plan tests => 5;
 
20
    use Test::More;
 
21
    plan tests => 9;
21
22
}
22
23
END  {
23
24
    unlink qw(write_phd.phd);
24
25
}
25
26
 
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);
27
28
        # test 1
28
 
use Bio::SeqIO::phd;
29
 
ok(1);
 
29
use_ok('Bio::SeqIO::phd');
30
30
 
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",
33
33
                                                                "phredfile.phd"),
34
34
                              '-format'  => 'phd',
35
35
                              '-verbose' => $DEBUG || 0);
36
 
ok(1);
 
36
isa_ok($in_phd,'Bio::SeqIO::phd');
37
37
 
38
38
my @phreds;
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");
43
45
 
44
46
my $position = 6;
45
47
 
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");
66
68
 
67
69
$out_phd->write_seq(    -SeqWithQuality         =>      $phd,
68
70
                        -CHROMAT_FILE           =>      $phd->id(),
77
79
                        -DYE    =>      ""      
78
80
                        );
79
81
ok( -e "write_phd.phd");
 
82
 
 
83
# Bug 2120
 
84
 
 
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);
 
87
 
 
88
$in_phd  = Bio::SeqIO->new('-file' => Bio::Root::IO->catfile("t","data",
 
89
                                                                "bug2120.phd"),
 
90
                              '-format'  => 'phd',
 
91
                              '-verbose' => $DEBUG || 0);
 
92
 
 
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()');