~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to t/Tools/EUtilities/elink_scores.t

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*-Perl-*- Test Harness script for Bioperl
2
 
# $Id: epost.t 15112 2008-12-08 18:12:38Z sendu $
3
 
 
4
 
use strict;
5
 
use warnings;
6
 
 
7
 
BEGIN {
8
 
    use lib '.';
9
 
        use Bio::Root::Test;
10
 
        
11
 
        test_begin(-tests => 58,
12
 
                           -requires_module => 'XML::Simple');
13
 
        
14
 
    use_ok('Bio::Tools::EUtilities');
15
 
    use_ok('Bio::Tools::EUtilities::EUtilParameters');
16
 
}
17
 
 
18
 
# check -correspondence => 0 (default) - this is set up to return the
19
 
# exact same thing as correspondece = 1, tested below)
20
 
my $eutil = Bio::Tools::EUtilities->new(
21
 
    -eutil      => 'elink',
22
 
    -file       => test_input_file('eutils','elink_scores.xml'));
23
 
 
24
 
isa_ok($eutil, 'Bio::Tools::EUtilities::Link');
25
 
is(join(',',$eutil->get_databases), 'protein');
26
 
 
27
 
# for elinks, IDs are globbed together when called from the parser unless a database is specified
28
 
is(join(',',$eutil->get_ids), '15622530,15921743,70607303,68567951,145702933,'.
29
 
   '146304683,6015889,13813749,15897502,15622530,74573864,15921743', 'get_ids');
30
 
my @ls = $eutil->get_LinkSets;
31
 
is(scalar(@ls), 2, 'uncorrelated LinkSets lump everything together');
32
 
is(join(',',$ls[1]->get_databases), 'protein');
33
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::EUtilDataI');
34
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::Link::LinkSet');
35
 
 
36
 
# check data in LinkSets
37
 
is(join(',',$ls[0]->get_ids), '15622530,15921743,70607303,68567951,145702933,'.
38
 
   '146304683,6015889,13813749,15897502');
39
 
is(join(',',$ls[0]->get_databases), 'protein');
40
 
is(join(',',$ls[0]->get_submitted_ids), '15622530');
41
 
is($ls[0]->get_dbfrom, 'protein');
42
 
is(join(',',$ls[0]->get_link_names), 'protein_protein');
43
 
is($ls[0]->has_linkout, 0);
44
 
is($ls[0]->has_neighbor, 0);
45
 
 
46
 
# has relatedness scores!
47
 
is($ls[0]->has_scores, 1);
48
 
 
49
 
my %sd = (
50
 
    15622530 => 2147483647,
51
 
    15921743 => 381,
52
 
    70607303 => 178,
53
 
    68567951 => 178,
54
 
    145702933 => 161,
55
 
    146304683 => 161,
56
 
    6015889 => 142,
57
 
    13813749 => 142,
58
 
    15897502 => 142);
59
 
 
60
 
my %sc = $ls[0]->get_scores;
61
 
for my $id ($ls[0]->get_ids) {
62
 
    ok(exists($sc{$id}));
63
 
    is($sc{$id}, $sd{$id});
64
 
    delete $sd{$id};
65
 
}
66
 
is(keys %sd, 0);
67
 
 
68
 
# no LinkInfo
69
 
my @info = $ls[0]->get_LinkInfo;
70
 
is(scalar(@info), 0);
71
 
 
72
 
# no UrlLinks
73
 
my @urls = $ls[0]->get_UrlLinks;
74
 
is(scalar(@urls), 0);
75
 
 
76
 
is(join(',',$ls[1]->get_ids), '15622530,74573864,15921743');
77
 
is(join(',',$ls[1]->get_databases), 'protein');
78
 
is(join(',',$ls[1]->get_submitted_ids), '15622530');
79
 
is(join(',',$ls[1]->get_link_names), 'protein_protein_identical');
80
 
is($ls[1]->get_webenv, undef);
81
 
is($ls[1]->get_dbfrom, 'protein');
82
 
is($ls[1]->has_linkout, 0);
83
 
is($ls[1]->has_neighbor, 0);
84
 
 
85
 
# has relatedness scores!
86
 
is($ls[1]->has_scores, 1);
87
 
 
88
 
%sd = (
89
 
    15622530 => 2147483647,
90
 
    74573864 => 0,
91
 
    15921743 => 0,
92
 
);
93
 
 
94
 
%sc = $ls[1]->get_scores;
95
 
for my $id ($ls[1]->get_ids) {
96
 
    ok(exists($sc{$id}));
97
 
    is($sc{$id}, $sd{$id});
98
 
    delete $sd{$id};
99
 
}
100
 
 
101
 
is(keys %sd, 0);
102
 
 
103
 
# HistoryI
104
 
is($ls[1]->get_webenv, undef);
105
 
is($ls[1]->get_query_key, undef);
106
 
 
107
 
# no LinkInfo
108
 
@info = $ls[1]->get_LinkInfo;
109
 
is(scalar(@info), 0);
110
 
 
111
 
# no UrlLinks
112
 
@urls = $ls[1]->get_UrlLinks;
113
 
is(scalar(@urls), 0);
114