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