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

« back to all changes in this revision

Viewing changes to Bio/Ontology/SimpleGOEngine/GraphAdaptor.pm

  • 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:
2
2
#
3
3
# BioPerl Graph adaptor for Bio::Ontology::SimpleGOEngine
4
4
#
5
 
# Please direct questions and support issues to <bioperl-l@bioperl.org> 
 
5
# Please direct questions and support issues to <bioperl-l@bioperl.org>
6
6
#
7
7
# Cared for by Nat Goodman <natg at shore.net>
8
8
#
35
35
 
36
36
=head1 DESCRIPTION
37
37
 
38
 
This is a think adaptor to simplify use of the old and new versions of
39
 
the standard CPAN Graph module (old is versions 0.2x; new is 0.5x and
40
 
beyond) within Bio::Ontology::SimpleGOEngine.
41
 
 
42
 
This module implements only those Graph methods used by
43
 
SimpleGOEngine.  It is far from a complete compatibility layer!  It
44
 
also implements workarounds for cerain performance problems in the
45
 
current versions of Graph v0.5x.
46
 
 
47
 
This class provides a 'new' method that determines which version of
48
 
Graph is available.  The object returned by 'new' is blessed into this
49
 
class if the new version of Graph is available, else into the subclass
50
 
 
51
 
  Bio::Ontology::SimpleGOEngine::GraphAdaptor02
52
 
 
53
 
This class provides implementations for the required graph methods
54
 
using the new version of Graph.  In most cases, these are simple
55
 
pass-throughs.  Methods that differ in v0.2x are implemented in the
56
 
subclass.
 
38
This is an adaptor to simplify use of versions of the standard CPAN Graph module
 
39
(old is versions 0.2x; new is 0.5x and beyond) within
 
40
Bio::Ontology::SimpleGOEngine. Prior versions of this module supported Graph
 
41
version older than 0.5, however we are removing support for these older version
 
42
post BioPerl 1.6.901. If you absolutely require an old version of Graph, please
 
43
use an older version of BioPerl.
 
44
 
 
45
This module implements only those Graph methods used by SimpleGOEngine. It is
 
46
far from a complete compatibility layer! It also implements workarounds for
 
47
certain performance problems in the current versions of Graph v0.5x.
 
48
 
 
49
This class provides implementations for the required graph methods using the new
 
50
version of Graph. In most cases, these are simple pass-throughs
57
51
 
58
52
The methods implemented here or in the subclasses are listed below.
59
53
In all cases, we implemented the Graph v0.5x interface.  Consult the
86
80
  bioperl-l@bioperl.org                  - General discussion
87
81
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
88
82
 
89
 
=head2 Support 
 
83
=head2 Support
90
84
 
91
85
Please direct usage questions or support issues to the mailing list:
92
86
 
93
87
I<bioperl-l@bioperl.org>
94
88
 
95
 
rather than to the module maintainer directly. Many experienced and 
96
 
reponsive experts will be able look at the problem and quickly 
97
 
address it. Please include a thorough description of the problem 
 
89
rather than to the module maintainer directly. Many experienced and
 
90
reponsive experts will be able look at the problem and quickly
 
91
address it. Please include a thorough description of the problem
98
92
with code and data examples if at all possible.
99
93
 
100
94
=head2 Reporting Bugs
131
125
use Graph::Directed;
132
126
 
133
127
use strict;
134
 
use Bio::Ontology::SimpleGOEngine::GraphAdaptor02;
135
128
 
136
129
use base qw(Bio::Root::Root);
137
130
 
140
133
 Title   : new
141
134
 Usage   : $graph = Bio::Ontology::SimpleGOEngine::GraphAdaptor->new()
142
135
 Function: Creates a new graph
143
 
 Returns : Bio::Ontology::SimpleGOEngine::GraphAdaptor02 or 
144
 
           Bio::Ontology::SimpleGOEngine::GraphAdaptor05 object, 
 
136
 Returns : Bio::Ontology::SimpleGOEngine::GraphAdaptor02 or
 
137
           Bio::Ontology::SimpleGOEngine::GraphAdaptor05 object,
145
138
           depending on which Graph version is available
146
139
 Args    : none
147
140
 
151
144
  my( $class ) = @_;
152
145
  $class = ref $class || $class;
153
146
 
154
 
  my $self=
155
 
    ( defined $Graph::VERSION && $Graph::VERSION >= 0.5 ) ?
156
 
      bless ( {}, $class ) :
157
 
        bless ( {}, 'Bio::Ontology::SimpleGOEngine::GraphAdaptor02' );
158
 
  $self->{_graph}=new Graph::Directed;
 
147
  my $self= bless( {}, $class );
 
148
  $self->{_graph}=Graph::Directed->new();
159
149
  $self->{_vertex_attributes}={};
160
150
  $self->{_edge_attributes}={};
161
151
  return $self;
194
184
sub predecessors {
195
185
  my $self=shift;
196
186
  $self->_graph->predecessors(@_);
197
 
 
187
}
198
188
sub successors {
199
189
  my $self=shift;
200
190
  $self->_graph->successors(@_);
207
197
  my $self=shift;
208
198
  $self->_graph->sink_vertices();
209
199
}
210
 
# The following methods workaround a performance problem in Graph v0.5x 
 
200
# The following methods workaround a performance problem in Graph v0.5x
211
201
# when attributes are attached to the graph
212
202
sub set_vertex_attribute {
213
203
  my($self,$v,$attribute,$value)=@_;
231
221
 Title   : _graph
232
222
 Usage   : $self->_graph();
233
223
 Function: Internal method to access 'real' graph
234
 
 Returns : Graph::Directed object 
 
224
 Returns : Graph::Directed object
235
225
 Args    : none
236
226
 
237
227
=cut
243
233
 Title   : _vertex_attributes
244
234
 Usage   : $self->vertex_attributes();
245
235
 Function: Internal method to access HASH used to store vertex attributes
246
 
 Returns : Graph::Directed object 
 
236
 Returns : Graph::Directed object
247
237
 Args    : none
248
238
 
249
239
=cut
255
245
 Title   : _edge_attributes
256
246
 Usage   : $self->edge_attributes();
257
247
 Function: Internal method to access HASH used to store edge attributes
258
 
 Returns : Graph::Directed object 
 
248
 Returns : Graph::Directed object
259
249
 Args    : none
260
250
 
261
251
=cut