~ubuntu-branches/ubuntu/trusty/bioperl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/SeqFeature/SeqFeatAnnotated.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*-Perl-*- Test Harness script for Bioperl
 
2
# $Id: SeqFeatAnnotated.t 15112 2008-12-08 18:12:38Z sendu $
 
3
 
 
4
use strict;
 
5
 
 
6
BEGIN { 
 
7
    use lib '.';
 
8
    use Bio::Root::Test;
 
9
    
 
10
    test_begin(-tests => 34, 
 
11
               -requires_modules => [qw(URI::Escape Graph::Directed)],
 
12
               -requires_networking => 1
 
13
        );
 
14
        
 
15
        use_ok('Bio::SeqFeature::Generic');
 
16
        use_ok('Bio::SeqFeature::Annotated');
 
17
}
 
18
 
 
19
my $sfa = Bio::SeqFeature::Annotated->new(-start => 1,
 
20
                                          -end => 5,
 
21
                                          -strand => "+",
 
22
                                          -frame => 2,
 
23
                                          -type => 'nucleotide_motif',
 
24
                                          -phase => 2,
 
25
                                          -score => 12,
 
26
                                          -source => 'program_b',
 
27
                                          -display_name => 'test.annot',
 
28
                                          -seq_id => 'test.displayname' );
 
29
 
 
30
ok (defined $sfa);
 
31
my $loc = $sfa->location;
 
32
ok $loc->isa("Bio::Location::Simple");    
 
33
ok $sfa->display_name eq 'test.annot';
 
34
 
 
35
#test bsfa::from_feature
 
36
my $sfg = Bio::SeqFeature::Generic->new ( -start => 400,
 
37
                                          -end => 440,
 
38
                                          -strand => 1,
 
39
                                          -primary => 'nucleotide_motif',
 
40
                                          -source  => 'program_a',
 
41
                                          -tag => {
 
42
                                          silly => 20,
 
43
                                          new => 1
 
44
                                          }
 
45
                                          );
 
46
my $sfa2;
 
47
$sfa2 = Bio::SeqFeature::Annotated->new(-feature => $sfg);
 
48
 
 
49
is $sfa2->type->name,'nucleotide_motif';
 
50
is $sfa2->primary_tag, 'nucleotide_motif';
 
51
is $sfa2->source->display_text,'program_a';
 
52
is $sfa2->source_tag,'program_a';
 
53
is $sfa2->strand,1;
 
54
is $sfa2->start,400;
 
55
is $sfa2->end,440;
 
56
is $sfa2->get_Annotations('silly')->value,20;
 
57
is $sfa2->get_Annotations('new')->value,1;
 
58
my $sfaa = Bio::SeqFeature::Annotated->new(-feature => $sfa);
 
59
is $sfaa->type->name,'nucleotide_motif';
 
60
is $sfaa->primary_tag, 'nucleotide_motif';
 
61
is $sfaa->source->display_text,'program_b';
 
62
is $sfaa->source_tag,'program_b';
 
63
is $sfaa->strand,1;
 
64
is $sfaa->start,1;
 
65
is $sfaa->end,5;
 
66
is $sfaa->score,12;
 
67
 
 
68
my $sfa3 = Bio::SeqFeature::Annotated->new( -start => 1,
 
69
                                        -end => 5,
 
70
                                        -strand => "+",
 
71
                                        -frame => 2,
 
72
                                        -phase => 2,
 
73
                                        -score => 12,
 
74
                                        -display_name => 'test.annot',
 
75
                                        -seq_id => 'test.displayname' );
 
76
$sfa3->from_feature($sfg);
 
77
 
 
78
is $sfa3->type->name,'nucleotide_motif', 'type->name';
 
79
is $sfa3->primary_tag, 'nucleotide_motif', 'primary_tag';
 
80
is $sfa3->source->display_text,'program_a';
 
81
is $sfa3->source_tag,'program_a';
 
82
is $sfa3->strand,1;
 
83
is $sfa3->start,400;
 
84
is $sfa3->end,440;
 
85
is $sfa3->get_Annotations('silly')->value,20;
 
86
is $sfa3->get_Annotations('new')->value,1;
 
87
 
 
88
# Note there is an API conflict with SeqFeature::Generic, where score is a
 
89
# simple scalar, and here it is a Bio::Annotation::SimpleValue
 
90
# By popular vote there is no operator overloading, so this needs to be
 
91
# resolved
 
92
is $sfa3->score(), 12; 
 
93
$sfa3->score(11);
 
94
is $sfa3->score(), 11; 
 
95
$sfa3->score(0);
 
96
is $sfa3->score(), 0;   # test that setting to 0 no longer is overriddent to set score to '.' (fixed in Bio::SeqFeature::Annotated version 1.3.7)
 
97