1
# -*-Perl-*- Test Harness script for Bioperl
2
# $Id: epost.t 15112 2008-12-08 18:12:38Z sendu $
12
test_begin(-tests => 60,
13
-requires_module => 'XML::Simple');
15
use_ok('Bio::Tools::EUtilities');
16
use_ok('Bio::Tools::EUtilities::EUtilParameters');
19
# check -correspondence => 0 (default) - this is set up to return the
20
# exact same thing as correspondece = 1, tested below)
21
my $eutil = Bio::Tools::EUtilities->new(
23
-file => test_input_file('eutils','elink_ncheck.xml'));
25
isa_ok($eutil, 'Bio::Tools::EUtilities::Link');
27
# for lcheck, db are not returned (check is for external link in, not out)
28
is(join(',',$eutil->get_databases), '');
30
# for elinks, IDs are globbed together when called from the parser
31
# unless a database is specified. Since no database is specified, all
32
# ids are lumped together regardless
33
is(join(',',$eutil->get_ids), '730439,68536103,1621261,20807972', 'get_ids');
34
my @ls = $eutil->get_LinkSets;
35
is(scalar(@ls), 4, 'uncorrelated LinkSets lump everything together');
36
is(join(',',$ls[1]->get_databases), '');
37
isa_ok($ls[0], 'Bio::Tools::EUtilities::EUtilDataI');
38
isa_ok($ls[0], 'Bio::Tools::EUtilities::Link::LinkSet');
40
# check data in LinkSets
41
is(join(',',$ls[0]->get_ids), '730439');
42
is(join(',',$ls[0]->get_databases), '');
43
is(join(',',$ls[0]->get_submitted_ids), '730439');
44
is($ls[0]->get_dbfrom, 'protein');
45
is(join(',',$ls[0]->get_link_names), '');
46
is($ls[0]->has_scores, 0);
47
is($ls[0]->has_linkout, 0);
48
is($ls[0]->has_neighbor, 1);
51
my @info = $ls[0]->get_LinkInfo;
54
my @urls = $ls[0]->get_UrlLinks;
57
is(join(',',$ls[1]->get_ids), '68536103');
58
is(join(',',$ls[1]->get_databases), '');
59
is(join(',',$ls[1]->get_submitted_ids), '68536103');
60
is(join(',',$ls[1]->get_link_names), '');
61
is($ls[1]->get_dbfrom, 'protein');
62
is($ls[1]->has_scores, 0);
63
is($ls[1]->has_linkout, 0);
64
is($ls[1]->has_neighbor, 1);
67
@info = $ls[1]->get_LinkInfo;
71
@urls = $ls[1]->get_UrlLinks;
74
# check -correspondence => 1
75
$eutil = Bio::Tools::EUtilities->new(
77
-file => test_input_file('eutils','elink_ncheck_corr.xml'));
79
isa_ok($eutil, 'Bio::Tools::EUtilities::Link');
80
is(join(',',$eutil->get_databases), '');
82
# for elinks, IDs are globbed together when called from the parser unless a database is specified
83
is(join(',',$eutil->get_ids), '1621261,68536103,20807972,730439', 'get_ids');
84
@ls = $eutil->get_LinkSets;
85
is(scalar(@ls), 4, 'correlated LinkSets separate ID data');
86
is(join(',',$ls[1]->get_databases), '');
87
isa_ok($ls[0], 'Bio::Tools::EUtilities::EUtilDataI');
88
isa_ok($ls[0], 'Bio::Tools::EUtilities::Link::LinkSet');
90
# check data in LinkSets
91
is(join(',',$ls[0]->get_ids), '1621261');
92
is(join(',',$ls[0]->get_databases), '');
93
is(join(',',$ls[0]->get_submitted_ids), '1621261');
94
is(join(',',$ls[0]->get_link_names), '');
95
is($ls[0]->get_dbfrom, 'protein');
96
is($ls[0]->has_scores, 0);
97
is($ls[0]->has_linkout, 0);
98
is($ls[0]->has_neighbor, 1);
101
@info = $ls[0]->get_LinkInfo;
102
is(scalar(@info), 0);
105
@urls = $ls[0]->get_UrlLinks;
106
is(scalar(@urls), 0);
109
is($ls[0]->get_webenv, undef);
110
is($ls[0]->get_query_key, undef);
112
is(join(',',$ls[1]->get_ids), '68536103');
113
is(join(',',$ls[1]->get_databases), '');
114
is(join(',',$ls[1]->get_submitted_ids), '68536103');
115
is($ls[1]->get_dbfrom, 'protein');
116
is(join(',',$ls[1]->get_link_names), '');
117
is($ls[1]->has_scores, 0);
118
is($ls[1]->has_linkout, 0);
119
is($ls[1]->has_neighbor, 1);
122
@info = $ls[1]->get_LinkInfo;
123
is(scalar(@info), 0);
126
@urls = $ls[1]->get_UrlLinks;
127
is(scalar(@urls), 0);
130
is($ls[1]->get_webenv, undef);
131
is($ls[1]->get_query_key, undef);