~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to t/LocusLink.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-*- mode (to keep my emacs happy)
2
 
# $Id: LocusLink.t,v 1.8 2006/06/08 02:11:12 bosborne Exp $
3
 
 
4
 
use strict;
5
 
use vars qw($DEBUG $NUMTESTS $HAVEGRAPHDIRECTED);
6
 
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
7
 
 
8
 
BEGIN {
9
 
        eval { require Test; };
10
 
        if( $@ ) {
11
 
                use lib 't';
12
 
        }
13
 
        use Test;
14
 
        eval {
15
 
                require Graph::Directed; 
16
 
                $HAVEGRAPHDIRECTED=1;
17
 
        };
18
 
        if ($@) {
19
 
                $HAVEGRAPHDIRECTED = 0;
20
 
                warn "Graph::Directed not installed, skipping tests\n";
21
 
        }
22
 
        plan tests => ($NUMTESTS = 23);
23
 
}
24
 
 
25
 
END {
26
 
        foreach ( $Test::ntest..$NUMTESTS) {
27
 
                skip('Cannot complete LocusLink tests, skipping',1);
28
 
        }
29
 
        unlink("locuslink-test.out.embl") if -e "locuslink-test.out.embl";
30
 
}
31
 
 
32
 
exit(0) unless $HAVEGRAPHDIRECTED;
33
 
 
34
 
use Bio::SeqIO;
35
 
use Bio::Root::IO;
36
 
use Bio::SeqFeature::Generic;
37
 
use Bio::SeqFeature::AnnotationAdaptor;
38
 
 
39
 
ok(1);
40
 
 
41
 
my $seqin = Bio::SeqIO->new(-file => Bio::Root::IO->catfile("t","data",
42
 
                                                         "LL-sample.seq"),
43
 
                            -format => 'locuslink');
44
 
ok $seqin;
45
 
my $seqout = Bio::SeqIO->new(-file => ">locuslink-test.out.embl",
46
 
                             -format => 'embl');
47
 
 
48
 
# process and write to output
49
 
my @seqs = ();
50
 
 
51
 
while(my $seq = $seqin->next_seq()) {
52
 
    push(@seqs, $seq);
53
 
    
54
 
    # create an artificial feature to stick the annotation on
55
 
    my $fea = Bio::SeqFeature::Generic->new(-start => 1, -end => 9999,
56
 
                                            -strand => 1,
57
 
                                            -primary => 'annotation');
58
 
    my $ac = Bio::SeqFeature::AnnotationAdaptor->new(-feature => $fea);
59
 
    foreach my $k ($seq->annotation->get_all_annotation_keys()) {
60
 
        foreach my $ann ($seq->annotation->get_Annotations($k)) {
61
 
            next unless $ann->isa("Bio::Annotation::SimpleValue");
62
 
            $ac->add_Annotation($ann);
63
 
        }
64
 
    }
65
 
    $seq->add_SeqFeature($fea);
66
 
    $seqout->write_seq($seq);
67
 
}
68
 
 
69
 
ok (scalar(@seqs), 2);
70
 
 
71
 
ok ($seqs[0]->desc,
72
 
    "amiloride binding protein 1 (amine oxidase (copper-containing))");
73
 
ok ($seqs[0]->accession, "26");
74
 
ok ($seqs[0]->display_id, "ABP1");
75
 
ok ($seqs[0]->species->binomial, "Homo sapiens");
76
 
 
77
 
 
78
 
my @dblinks = $seqs[0]->annotation->get_Annotations('dblink');
79
 
my %counts = map { ($_->database(),0) } @dblinks;
80
 
foreach (@dblinks) { $counts{$_->database()}++; }
81
 
 
82
 
ok ($counts{GenBank}, 11);
83
 
ok ($counts{RefSeq}, 4);
84
 
ok ($counts{UniGene}, 1);
85
 
ok ($counts{Pfam}, 1);
86
 
ok ($counts{STS}, 2);
87
 
ok ($counts{MIM}, 1);
88
 
ok ($counts{PUBMED}, 6);
89
 
ok (scalar(@dblinks), 27);
90
 
 
91
 
ok ($seqs[1]->desc, "v-abl Abelson murine leukemia viral oncogene homolog 2 (arg, Abelson-related gene)");
92
 
ok ($seqs[1]->display_id, "ABL2");
93
 
 
94
 
my $ac = $seqs[1]->annotation;
95
 
my @keys = $ac->get_all_annotation_keys();
96
 
ok (scalar(@keys), 19);
97
 
 
98
 
my ($cmt) = $ac->get_Annotations('comment');
99
 
ok (length($cmt->text), 403);
100
 
 
101
 
my @isoforms = qw(a b);
102
 
foreach ($ac->get_Annotations('PRODUCT')) {
103
 
    ok ($_->value,
104
 
        "v-abl Abelson murine leukemia viral oncogene homolog 2 isoform ".
105
 
        shift(@isoforms));
106
 
}
107
 
 
108
 
my @goann = ();
109
 
foreach my $k (@keys) {
110
 
    foreach my $ann ($ac->get_Annotations($k)) {
111
 
        next unless $ann->isa("Bio::Ontology::TermI");
112
 
        push(@goann, $ann);
113
 
    }
114
 
}
115
 
ok (scalar(@goann), 4);
116
 
@goann = sort { $a->as_text() cmp $b->as_text() } @goann;
117
 
ok ($goann[2]->as_text, "cellular component|cytoplasm|");
118
 
 
119