line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::GMOD::Query::WormBase; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
77875
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
450
|
use Ace; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Bio::GMOD::Util::Rearrange; |
7
|
|
|
|
|
|
|
use vars qw/@ISA @AVAILABLE_CLASSES/; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw/Bio::GMOD::Query/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Adjust this array to describe the classes that can be searched or |
12
|
|
|
|
|
|
|
# retrieved at your MOD. Classes should correspond to method names! |
13
|
|
|
|
|
|
|
@AVAILABLE_CLASSES = qw/gene protein/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub available_classes { return @AVAILABLE_CLASSES; } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Run a query for genes at WormBase |
18
|
|
|
|
|
|
|
sub gene { |
19
|
|
|
|
|
|
|
my ($self,@p) = @_; |
20
|
|
|
|
|
|
|
my ($name,@remainder) = rearrange([qw/NAME/],@p); |
21
|
|
|
|
|
|
|
my $adaptor = $self->adaptor; |
22
|
|
|
|
|
|
|
my $db = $self->_connect_to_ace; |
23
|
|
|
|
|
|
|
my $query = sprintf($adaptor->gene_fetch_query,$name); |
24
|
|
|
|
|
|
|
my @genes = $db->aql($query); |
25
|
|
|
|
|
|
|
my @results = _do_grep($db,'Gene',$name) unless @genes; |
26
|
|
|
|
|
|
|
if (@results) { |
27
|
|
|
|
|
|
|
@genes = map { [ $_,$_->Public_name,$_->Concise_description ] } @results; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
return \@genes; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub protein { |
33
|
|
|
|
|
|
|
my ($self,@p) = @_; |
34
|
|
|
|
|
|
|
my ($name,@remainder) = rearrange([qw/NAME/],@p); |
35
|
|
|
|
|
|
|
my $adaptor = $self->adaptor; |
36
|
|
|
|
|
|
|
my $db = $self->_connect_to_ace; |
37
|
|
|
|
|
|
|
my $query = sprintf($adaptor->protein_fetch_query,$name); |
38
|
|
|
|
|
|
|
my @proteins = $db->aql($query); |
39
|
|
|
|
|
|
|
my @results = _do_grep($db,'Protein',$name) unless @proteins; |
40
|
|
|
|
|
|
|
if (@results) { |
41
|
|
|
|
|
|
|
@proteins = map { [ $_,$_->Public_name,$_->Concise_description ] } @results; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
return \@proteins; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub allele { |
47
|
|
|
|
|
|
|
my ($self,@p) = @_; |
48
|
|
|
|
|
|
|
my ($name,@remainder) = rearrange([qw/NAME/],@p); |
49
|
|
|
|
|
|
|
my $adaptor = $self->adaptor; |
50
|
|
|
|
|
|
|
my $db = $self->_connect_to_ace; |
51
|
|
|
|
|
|
|
my $query = sprintf($adaptor->protein_fetch_query,$name); |
52
|
|
|
|
|
|
|
my @alleles = $db->aql($query); |
53
|
|
|
|
|
|
|
my @results = _do_grep($db,'Variation',$name) unless @alleles; |
54
|
|
|
|
|
|
|
if (@results) { |
55
|
|
|
|
|
|
|
@alleles = map { [ $_,$_->Public_name,$_->Concise_description ] } @results; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
return \@alleles; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _connect_to_ace { |
61
|
|
|
|
|
|
|
my $self = shift; |
62
|
|
|
|
|
|
|
my $adaptor = $self->adaptor; |
63
|
|
|
|
|
|
|
my $host = $adaptor->data_mining_server; |
64
|
|
|
|
|
|
|
my $port = $adaptor->data_mining_port; |
65
|
|
|
|
|
|
|
return $self->{db} if $self->{db}; |
66
|
|
|
|
|
|
|
my $db = Ace->connect(-host=>$host,-port=>$port) or $self->logit(-msg=>"Couldn't connect to $host:$port: $!",-die=>1); |
67
|
|
|
|
|
|
|
$self->{db} = $db; |
68
|
|
|
|
|
|
|
return $db; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Do a full database grep in cases where we can't specifically fetch something |
72
|
|
|
|
|
|
|
sub _do_grep { |
73
|
|
|
|
|
|
|
my ($db,$class,$name) = @_; |
74
|
|
|
|
|
|
|
my @results = grep { $_->class eq $class } $db->grep(-pattern => $name, |
75
|
|
|
|
|
|
|
-long => 'true'); |
76
|
|
|
|
|
|
|
return @results; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 NAME |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Bio::GMOD::Query::WormBase - Defaults for programmatically interacting with Wormbase |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 SYNPOSIS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $adaptor = Bio::GMOD::Adaptor::WormBase->new(); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 DESCRIPTION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Bio::GMOD::Adaptor::WormBase objects are created internally by the new() |
98
|
|
|
|
|
|
|
method provided by Bio::GMOD::Adaptor. Adaptor::* objects contain |
99
|
|
|
|
|
|
|
appropriate defaults for interacting programmatically with the GMOD of |
100
|
|
|
|
|
|
|
choice. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Defaults are read dynamically from the WormBase server at runtime. |
103
|
|
|
|
|
|
|
This helps to insulate your scripts from changes in the WormBase |
104
|
|
|
|
|
|
|
infrastructure. If using Bio::GMOD offline, defaults will be |
105
|
|
|
|
|
|
|
populated from those hard-coded in this adaptor. You may also supply |
106
|
|
|
|
|
|
|
these defaults as hash=>key pairs to the new method. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
For descriptions of all currently known parameters, see |
109
|
|
|
|
|
|
|
Bio::GMOD::Adaptor::WormBase.pm or the default list maintained at |
110
|
|
|
|
|
|
|
http://dev.wormbase.org/db/gmod/defaults |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 BUGS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
None reported. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 SEE ALSO |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L, L |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHOR |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Todd W. Harris Eharris@cshl.eduE. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Copyright (c) 2003-2005 Cold Spring Harbor Laboratory. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
127
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|