1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 34,
11 -requires_modules => [qw(URI::Escape Graph::Directed)],
12 -requires_networking => 1
15 use_ok('Bio::SeqFeature::Generic');
16 use_ok('Bio::SeqFeature::Annotated');
19 my $sfa = Bio::SeqFeature::Annotated->new(-start => 1,
23 -type => 'nucleotide_motif',
26 -source => 'program_b',
27 -display_name => 'test.annot',
28 -seq_id => 'test.displayname' );
31 my $loc = $sfa->location;
32 ok $loc->isa("Bio::Location::Simple");
33 ok $sfa->display_name eq 'test.annot';
35 #test bsfa::from_feature
36 my $sfg = Bio::SeqFeature::Generic->new ( -start => 400,
39 -primary => 'nucleotide_motif',
40 -source => 'program_a',
47 $sfa2 = Bio::SeqFeature::Annotated->new(-feature => $sfg);
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';
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';
68 my $sfa3 = Bio::SeqFeature::Annotated->new( -start => 1,
74 -display_name => 'test.annot',
75 -seq_id => 'test.displayname' );
76 $sfa3->from_feature($sfg);
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';
85 is $sfa3->get_Annotations('silly')->value,20;
86 is $sfa3->get_Annotations('new')->value,1;
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
92 is $sfa3->score(), 12;
94 is $sfa3->score(), 11;
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)