File: elink_neighbor_history.t

package info (click to toggle)
bioperl 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 40,768 kB
  • ctags: 12,005
  • sloc: perl: 174,299; xml: 13,923; sh: 1,941; lisp: 1,803; asm: 109; makefile: 53
file content (141 lines) | stat: -rw-r--r-- 4,501 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# -*-Perl-*- Test Harness script for Bioperl
# $Id: epost.t 15112 2008-12-08 18:12:38Z sendu $

use strict;
use warnings;

BEGIN {
    use lib '.';
	use Bio::Root::Test;
	
	test_begin(-tests => 65,
			   -requires_module => 'XML::Simple');
	
    use_ok('Bio::Tools::EUtilities');
    use_ok('Bio::Tools::EUtilities::EUtilParameters');
}

# check -correspondence => 0 (default) 
my $eutil = Bio::Tools::EUtilities->new(
    -eutil      => 'elink',
    -file       => test_input_file('eutils','elink_nhist.xml'));

isa_ok($eutil, 'Bio::Tools::EUtilities::Link');
is(join(',',$eutil->get_databases), 'pubmed');

# for elinks, IDs are globbed together when called from the parser unless a
# database is specified when cmd=neighbor_history is used, no IDs come back
# (they are stored on the server for further work)

is(join(',',$eutil->get_ids), '', 'get_ids');
my @ls = $eutil->get_LinkSets;
is(scalar(@ls), 2, 'uncorrelated LinkSets lump everything together');
is(join(',',$ls[1]->get_databases), 'pubmed');
isa_ok($ls[0], 'Bio::Tools::EUtilities::EUtilDataI');
isa_ok($ls[0], 'Bio::Tools::EUtilities::Link::LinkSet');
isa_ok($ls[0], 'Bio::Tools::EUtilities::HistoryI');

# check data in LinkSets
# Note that retrieved IDs and submitted IDs are lumped together (don't correspond)
is(join(',',$ls[0]->get_ids), '');
is(join(',',$ls[0]->get_databases), 'pubmed');
is(join(',',$ls[0]->get_submitted_ids), '730439,68536103,1621261,20807972');
is($ls[0]->get_dbfrom, 'protein');
is(join(',',$ls[0]->get_link_names), 'protein_pubmed');
is($ls[0]->has_scores, 0);
is($ls[0]->has_linkout, 0);
is($ls[0]->has_neighbor, 0);

# no LinkInfo
my @info = $ls[0]->get_LinkInfo;
is(scalar(@info), 0);

# no UrlLinks
my @urls = $ls[0]->get_UrlLinks;
is(scalar(@urls), 0);

# HistoryI
is($ls[0]->get_webenv, '085LBC0s_G5ZenmRAnAm9dgF-TYrzyM9zVawz6_GfunjA5iasUqoGSfSzd@991070AE944054A1_0001SID');
is($ls[0]->get_query_key, 1);

# next 
is(join(',',$ls[1]->get_ids), '');
is(join(',',$ls[1]->get_databases), 'pubmed');
is(join(',',$ls[1]->get_submitted_ids), '730439,68536103,1621261,20807972');
is(join(',',$ls[1]->get_link_names), 'protein_pubmed_refseq');
is($ls[1]->get_dbfrom, 'protein');
is($ls[1]->has_scores, 0);
is($ls[1]->has_linkout, 0);
is($ls[1]->has_neighbor, 0);

# no LinkInfo
@info = $ls[1]->get_LinkInfo;
is(scalar(@info), 0);

# no UrlLinks
@urls = $ls[1]->get_UrlLinks;
is(scalar(@urls), 0);

# HistoryI
is($ls[1]->get_webenv, '085LBC0s_G5ZenmRAnAm9dgF-TYrzyM9zVawz6_GfunjA5iasUqoGSfSzd@991070AE944054A1_0001SID');
is($ls[1]->get_query_key, 2);

# check -correspondence => 1
$eutil = Bio::Tools::EUtilities->new(
    -eutil      => 'elink',
    -file       => test_input_file('eutils','elink_nhist_corr.xml'));

isa_ok($eutil, 'Bio::Tools::EUtilities::Link');
is(join(',',$eutil->get_databases), 'pubmed');

# for elinks, IDs are globbed together when called from the parser unless a database is specified
is(join(',',$eutil->get_ids), '', 'get_ids');
@ls = $eutil->get_LinkSets;
is(scalar(@ls), 6, 'correlated LinkSets separate ID data');
is(join(',',$ls[1]->get_databases), 'pubmed');
isa_ok($ls[0], 'Bio::Tools::EUtilities::EUtilDataI');
isa_ok($ls[0], 'Bio::Tools::EUtilities::Link::LinkSet');
isa_ok($ls[0], 'Bio::Tools::EUtilities::HistoryI');

# check data in LinkSets
# Note that you can get more that one returned ID, but only one submitted ID
is(join(',',$ls[0]->get_ids), ''); 
is(join(',',$ls[0]->get_submitted_ids), '1621261');
is(join(',',$ls[0]->get_link_names), 'protein_pubmed');
is($ls[0]->get_dbfrom, 'protein');
is($ls[0]->has_scores, 0);
is($ls[0]->has_linkout, 0);
is($ls[0]->has_neighbor, 0);

# no LinkInfo
@info = $ls[0]->get_LinkInfo;
is(scalar(@info), 0);

# no UrlLinks
@urls = $ls[0]->get_UrlLinks;
is(scalar(@urls), 0);

# HistoryI
is($ls[0]->get_webenv, '0-g5Po62X-zBqwiLv9LDfH6dJvaMByxF-B7jUpwxS73UvKdcD2qdti4CNbY@03F16D1B94400731_0005SID');
is($ls[0]->get_query_key, 1);

is(join(',',$ls[1]->get_ids), '');
is(join(',',$ls[1]->get_databases), 'pubmed');
is(join(',',$ls[1]->get_submitted_ids), '68536103');
is($ls[1]->get_dbfrom, 'protein');
is(join(',',$ls[1]->get_link_names), 'protein_pubmed');
is($ls[1]->has_scores, 0);
is($ls[1]->has_linkout, 0);
is($ls[1]->has_neighbor, 0);

# no LinkInfo
@info = $ls[1]->get_LinkInfo;
is(scalar(@info), 0);

# no UrlLinks
@urls = $ls[1]->get_UrlLinks;
is(scalar(@urls), 0);

# HistoryI
is($ls[1]->get_webenv, '0-g5Po62X-zBqwiLv9LDfH6dJvaMByxF-B7jUpwxS73UvKdcD2qdti4CNbY@03F16D1B94400731_0005SID');
is($ls[1]->get_query_key, 2);