1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 25,
11 -requires_module => 'Graph::Directed');
14 use_ok('Bio::SeqFeature::Generic');
15 use_ok('Bio::SeqFeature::AnnotationAdaptor');
18 my $seqin = Bio::SeqIO->new(-file => test_input_file('LL-sample.seq'),
19 -format => 'locuslink');
21 my $seqout = Bio::SeqIO->new(-file => ">".test_output_file(),
24 # process and write to output
27 while(my $seq = $seqin->next_seq()) {
30 # create an artificial feature to stick the annotation on
31 my $fea = Bio::SeqFeature::Generic->new(-start => 1, -end => 9999,
33 -primary => 'annotation');
34 my $ac = Bio::SeqFeature::AnnotationAdaptor->new(-feature => $fea);
35 foreach my $k ($seq->annotation->get_all_annotation_keys()) {
36 foreach my $ann ($seq->annotation->get_Annotations($k)) {
37 next unless $ann->isa("Bio::Annotation::SimpleValue");
38 $ac->add_Annotation($ann);
41 $seq->add_SeqFeature($fea);
42 $seqout->write_seq($seq);
45 is (scalar(@seqs), 2);
48 "amiloride binding protein 1 (amine oxidase (copper-containing))");
49 is ($seqs[0]->accession, "26");
50 is ($seqs[0]->display_id, "ABP1");
51 is ($seqs[0]->species->binomial, "Homo sapiens");
54 my @dblinks = $seqs[0]->annotation->get_Annotations('dblink');
55 my %counts = map { ($_->database(),0) } @dblinks;
56 foreach (@dblinks) { $counts{$_->database()}++; }
58 is ($counts{GenBank}, 11);
59 is ($counts{RefSeq}, 4);
60 is ($counts{UniGene}, 1);
61 is ($counts{Pfam}, 1);
64 is ($counts{PUBMED}, 6);
65 is (scalar(@dblinks), 27);
67 is ($seqs[1]->desc, "v-abl Abelson murine leukemia viral oncogene homolog 2 (arg, Abelson-related gene)");
68 is ($seqs[1]->display_id, "ABL2");
70 my $ac = $seqs[1]->annotation;
71 my @keys = $ac->get_all_annotation_keys();
72 is (scalar(@keys), 19);
74 my ($cmt) = $ac->get_Annotations('comment');
75 is (length($cmt->text), 403);
77 my @isoforms = qw(a b);
78 foreach ($ac->get_Annotations('PRODUCT')) {
80 "v-abl Abelson murine leukemia viral oncogene homolog 2 isoform ".
85 foreach my $k (@keys) {
86 foreach my $ann ($ac->get_Annotations($k)) {
87 next unless $ann->isa("Bio::Ontology::TermI");
91 is (scalar(@goann), 4);
92 @goann = sort { $a->as_text() cmp $b->as_text() } @goann;
93 is ($goann[2]->as_text, "cellular component|cytoplasm|");