1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 34, -requires_modules => [qw(URI::Escape Graph::Directed)]);
12 use_ok('Bio::SeqFeature::Generic');
13 use_ok('Bio::SeqFeature::Annotated');
16 my $sfa = Bio::SeqFeature::Annotated->new(-start => 1,
20 -type => 'nucleotide_motif',
23 -source => 'program_b',
24 -display_name => 'test.annot',
25 -seq_id => 'test.displayname' );
28 my $loc = $sfa->location;
29 ok $loc->isa("Bio::Location::Simple");
30 ok $sfa->display_name eq 'test.annot';
32 #test bsfa::from_feature
33 my $sfg = Bio::SeqFeature::Generic->new ( -start => 400,
36 -primary => 'nucleotide_motif',
37 -source => 'program_a',
44 $sfa2 = Bio::SeqFeature::Annotated->new(-feature => $sfg);
46 is $sfa2->type->name,'nucleotide_motif';
47 is $sfa2->primary_tag, 'nucleotide_motif';
48 is $sfa2->source->display_text,'program_a';
49 is $sfa2->source_tag,'program_a';
53 is $sfa2->get_Annotations('silly')->value,20;
54 is $sfa2->get_Annotations('new')->value,1;
55 my $sfaa = Bio::SeqFeature::Annotated->new(-feature => $sfa);
56 is $sfaa->type->name,'nucleotide_motif';
57 is $sfaa->primary_tag, 'nucleotide_motif';
58 is $sfaa->source->display_text,'program_b';
59 is $sfaa->source_tag,'program_b';
65 my $sfa3 = Bio::SeqFeature::Annotated->new( -start => 1,
71 -display_name => 'test.annot',
72 -seq_id => 'test.displayname' );
73 $sfa3->from_feature($sfg);
75 is $sfa3->type->name,'nucleotide_motif', 'type->name';
76 is $sfa3->primary_tag, 'nucleotide_motif', 'primary_tag';
77 is $sfa3->source->display_text,'program_a';
78 is $sfa3->source_tag,'program_a';
82 is $sfa3->get_Annotations('silly')->value,20;
83 is $sfa3->get_Annotations('new')->value,1;
85 # Note there is an API conflict with SeqFeature::Generic, where score is a
86 # simple scalar, and here it is a Bio::Annotation::SimpleValue
87 # By popular vote there is no operator overloading, so this needs to be
89 is $sfa3->score(), 12;
91 is $sfa3->score(), 11;
93 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)