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

« back to all changes in this revision

Viewing changes to t/Tools/EUtilities/elink_neighbor_history.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 => 65,
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) 
19
 
my $eutil = Bio::Tools::EUtilities->new(
20
 
    -eutil      => 'elink',
21
 
    -file       => test_input_file('eutils','elink_nhist.xml'));
22
 
 
23
 
isa_ok($eutil, 'Bio::Tools::EUtilities::Link');
24
 
is(join(',',$eutil->get_databases), 'pubmed');
25
 
 
26
 
# for elinks, IDs are globbed together when called from the parser unless a
27
 
# database is specified when cmd=neighbor_history is used, no IDs come back
28
 
# (they are stored on the server for further work)
29
 
 
30
 
is(join(',',$eutil->get_ids), '', 'get_ids');
31
 
my @ls = $eutil->get_LinkSets;
32
 
is(scalar(@ls), 2, 'uncorrelated LinkSets lump everything together');
33
 
is(join(',',$ls[1]->get_databases), 'pubmed');
34
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::EUtilDataI');
35
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::Link::LinkSet');
36
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::HistoryI');
37
 
 
38
 
# check data in LinkSets
39
 
# Note that retrieved IDs and submitted IDs are lumped together (don't correspond)
40
 
is(join(',',$ls[0]->get_ids), '');
41
 
is(join(',',$ls[0]->get_databases), 'pubmed');
42
 
is(join(',',$ls[0]->get_submitted_ids), '730439,68536103,1621261,20807972');
43
 
is($ls[0]->get_dbfrom, 'protein');
44
 
is(join(',',$ls[0]->get_link_names), 'protein_pubmed');
45
 
is($ls[0]->has_scores, 0);
46
 
is($ls[0]->has_linkout, 0);
47
 
is($ls[0]->has_neighbor, 0);
48
 
 
49
 
# no LinkInfo
50
 
my @info = $ls[0]->get_LinkInfo;
51
 
is(scalar(@info), 0);
52
 
 
53
 
# no UrlLinks
54
 
my @urls = $ls[0]->get_UrlLinks;
55
 
is(scalar(@urls), 0);
56
 
 
57
 
# HistoryI
58
 
is($ls[0]->get_webenv, '085LBC0s_G5ZenmRAnAm9dgF-TYrzyM9zVawz6_GfunjA5iasUqoGSfSzd@991070AE944054A1_0001SID');
59
 
is($ls[0]->get_query_key, 1);
60
 
 
61
 
# next 
62
 
is(join(',',$ls[1]->get_ids), '');
63
 
is(join(',',$ls[1]->get_databases), 'pubmed');
64
 
is(join(',',$ls[1]->get_submitted_ids), '730439,68536103,1621261,20807972');
65
 
is(join(',',$ls[1]->get_link_names), 'protein_pubmed_refseq');
66
 
is($ls[1]->get_dbfrom, 'protein');
67
 
is($ls[1]->has_scores, 0);
68
 
is($ls[1]->has_linkout, 0);
69
 
is($ls[1]->has_neighbor, 0);
70
 
 
71
 
# no LinkInfo
72
 
@info = $ls[1]->get_LinkInfo;
73
 
is(scalar(@info), 0);
74
 
 
75
 
# no UrlLinks
76
 
@urls = $ls[1]->get_UrlLinks;
77
 
is(scalar(@urls), 0);
78
 
 
79
 
# HistoryI
80
 
is($ls[1]->get_webenv, '085LBC0s_G5ZenmRAnAm9dgF-TYrzyM9zVawz6_GfunjA5iasUqoGSfSzd@991070AE944054A1_0001SID');
81
 
is($ls[1]->get_query_key, 2);
82
 
 
83
 
# check -correspondence => 1
84
 
$eutil = Bio::Tools::EUtilities->new(
85
 
    -eutil      => 'elink',
86
 
    -file       => test_input_file('eutils','elink_nhist_corr.xml'));
87
 
 
88
 
isa_ok($eutil, 'Bio::Tools::EUtilities::Link');
89
 
is(join(',',$eutil->get_databases), 'pubmed');
90
 
 
91
 
# for elinks, IDs are globbed together when called from the parser unless a database is specified
92
 
is(join(',',$eutil->get_ids), '', 'get_ids');
93
 
@ls = $eutil->get_LinkSets;
94
 
is(scalar(@ls), 6, 'correlated LinkSets separate ID data');
95
 
is(join(',',$ls[1]->get_databases), 'pubmed');
96
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::EUtilDataI');
97
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::Link::LinkSet');
98
 
isa_ok($ls[0], 'Bio::Tools::EUtilities::HistoryI');
99
 
 
100
 
# check data in LinkSets
101
 
# Note that you can get more that one returned ID, but only one submitted ID
102
 
is(join(',',$ls[0]->get_ids), ''); 
103
 
is(join(',',$ls[0]->get_submitted_ids), '1621261');
104
 
is(join(',',$ls[0]->get_link_names), 'protein_pubmed');
105
 
is($ls[0]->get_dbfrom, 'protein');
106
 
is($ls[0]->has_scores, 0);
107
 
is($ls[0]->has_linkout, 0);
108
 
is($ls[0]->has_neighbor, 0);
109
 
 
110
 
# no LinkInfo
111
 
@info = $ls[0]->get_LinkInfo;
112
 
is(scalar(@info), 0);
113
 
 
114
 
# no UrlLinks
115
 
@urls = $ls[0]->get_UrlLinks;
116
 
is(scalar(@urls), 0);
117
 
 
118
 
# HistoryI
119
 
is($ls[0]->get_webenv, '0-g5Po62X-zBqwiLv9LDfH6dJvaMByxF-B7jUpwxS73UvKdcD2qdti4CNbY@03F16D1B94400731_0005SID');
120
 
is($ls[0]->get_query_key, 1);
121
 
 
122
 
is(join(',',$ls[1]->get_ids), '');
123
 
is(join(',',$ls[1]->get_databases), 'pubmed');
124
 
is(join(',',$ls[1]->get_submitted_ids), '68536103');
125
 
is($ls[1]->get_dbfrom, 'protein');
126
 
is(join(',',$ls[1]->get_link_names), 'protein_pubmed');
127
 
is($ls[1]->has_scores, 0);
128
 
is($ls[1]->has_linkout, 0);
129
 
is($ls[1]->has_neighbor, 0);
130
 
 
131
 
# no LinkInfo
132
 
@info = $ls[1]->get_LinkInfo;
133
 
is(scalar(@info), 0);
134
 
 
135
 
# no UrlLinks
136
 
@urls = $ls[1]->get_UrlLinks;
137
 
is(scalar(@urls), 0);
138
 
 
139
 
# HistoryI
140
 
is($ls[1]->get_webenv, '0-g5Po62X-zBqwiLv9LDfH6dJvaMByxF-B7jUpwxS73UvKdcD2qdti4CNbY@03F16D1B94400731_0005SID');
141
 
is($ls[1]->get_query_key, 2);