1
# -*-Perl-*- mode (to keep my emacs happy)
2
# $Id: LocusLink.t,v 1.8 2006/06/08 02:11:12 bosborne Exp $
5
use vars qw($DEBUG $NUMTESTS $HAVEGRAPHDIRECTED);
6
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
9
eval { require Test; };
15
require Graph::Directed;
19
$HAVEGRAPHDIRECTED = 0;
20
warn "Graph::Directed not installed, skipping tests\n";
22
plan tests => ($NUMTESTS = 23);
26
foreach ( $Test::ntest..$NUMTESTS) {
27
skip('Cannot complete LocusLink tests, skipping',1);
29
unlink("locuslink-test.out.embl") if -e "locuslink-test.out.embl";
32
exit(0) unless $HAVEGRAPHDIRECTED;
36
use Bio::SeqFeature::Generic;
37
use Bio::SeqFeature::AnnotationAdaptor;
41
my $seqin = Bio::SeqIO->new(-file => Bio::Root::IO->catfile("t","data",
43
-format => 'locuslink');
45
my $seqout = Bio::SeqIO->new(-file => ">locuslink-test.out.embl",
48
# process and write to output
51
while(my $seq = $seqin->next_seq()) {
54
# create an artificial feature to stick the annotation on
55
my $fea = Bio::SeqFeature::Generic->new(-start => 1, -end => 9999,
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);
65
$seq->add_SeqFeature($fea);
66
$seqout->write_seq($seq);
69
ok (scalar(@seqs), 2);
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");
78
my @dblinks = $seqs[0]->annotation->get_Annotations('dblink');
79
my %counts = map { ($_->database(),0) } @dblinks;
80
foreach (@dblinks) { $counts{$_->database()}++; }
82
ok ($counts{GenBank}, 11);
83
ok ($counts{RefSeq}, 4);
84
ok ($counts{UniGene}, 1);
85
ok ($counts{Pfam}, 1);
88
ok ($counts{PUBMED}, 6);
89
ok (scalar(@dblinks), 27);
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");
94
my $ac = $seqs[1]->annotation;
95
my @keys = $ac->get_all_annotation_keys();
96
ok (scalar(@keys), 19);
98
my ($cmt) = $ac->get_Annotations('comment');
99
ok (length($cmt->text), 403);
101
my @isoforms = qw(a b);
102
foreach ($ac->get_Annotations('PRODUCT')) {
104
"v-abl Abelson murine leukemia viral oncogene homolog 2 isoform ".
109
foreach my $k (@keys) {
110
foreach my $ann ($ac->get_Annotations($k)) {
111
next unless $ann->isa("Bio::Ontology::TermI");
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|");