3 # BioPerl module for Path
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Hilmar Lapp <hlapp at gmx.net>
9 # (c) Hilmar Lapp, hlapp at gmx.net, 2003.
10 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2003.
12 # You may distribute this module under the same terms as perl itself.
13 # Refer to the Perl Artistic License (see the license accompanying this
14 # software package, or see http://www.perl.com/language/misc/Artistic.html)
15 # for the terms under which you may use, modify, and redistribute this module.
17 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
18 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 # You may distribute this module under the same terms as perl itself
23 # POD documentation - main docs before the code
27 Bio::Ontology::Path - a path for an ontology term graph
31 $path = Bio::Ontology::Path->new( -identifier => "16847",
32 -subject_term => $subj,
34 -predicate_term => $pred,
39 This is a basic implementation of Bio::Ontology::PathI.
41 Essiantially this is a very thin extension of
42 L<Bio::Ontology::Relationship>. It basically adds a method distance().
48 User feedback is an integral part of the evolution of this and other
49 Bioperl modules. Send your comments and suggestions preferably to the
50 Bioperl mailing lists Your participation is much appreciated.
52 bioperl-l@bioperl.org - General discussion
53 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
57 Please direct usage questions or support issues to the mailing list:
59 L<bioperl-l@bioperl.org>
61 rather than to the module maintainer directly. Many experienced and
62 reponsive experts will be able look at the problem and quickly
63 address it. Please include a thorough description of the problem
64 with code and data examples if at all possible.
68 Report bugs to the Bioperl bug tracking system to help us keep track
69 the bugs and their resolution. Bug reports can be submitted via
72 http://bugzilla.open-bio.org/
76 Hilmar Lapp <hlapp@gmx.net>
80 The rest of the documentation details each of the object
81 methods. Internal methods are usually preceded with a _
86 # Let the code begin...
89 package Bio
::Ontology
::Path
;
92 use base
qw(Bio::Ontology::Relationship Bio::Ontology::PathI);
100 Usage : $rel = Bio::Ontology::Path->new(-identifier => "16847",
101 -subject_term => $subject,
102 -object_term => $object,
103 -predicate_term => $type );
105 Function: Creates a new Bio::Ontology::Path.
106 Returns : A new Bio::Ontology::Path object.
107 Args : -identifier => the identifier of this relationship [scalar]
108 -subject_term => the subject term [Bio::Ontology::TermI]
109 -object_term => the object term [Bio::Ontology::TermI]
110 -predicate_term => the predicate term [Bio::Ontology::TermI]
111 -distance => the distance between subject and object
117 my( $class, @args ) = @_;
119 my $self = $class->SUPER::new
( @args );
122 $self->_rearrange( [qw( DISTANCE)
125 $distance && $self->distance($distance);
136 Usage : $rel->init();
137 Function: Initializes this Path to all undef.
146 $self->SUPER::init
(@_);
147 $self->{ "_distance" } = undef;
155 Usage : $obj->distance($newval)
156 Function: Get/set the distance between the two terms connected
159 Note that modifying the distance may not be meaningful. The
160 implementation here is not connected to any graph engine,
161 so changing an existing value may simply render the
162 attribute's value wrong.
165 Returns : value of distance (a scalar)
166 Args : on set, new value (a scalar or undef, optional)
173 return $self->{'_distance'} = shift if @_;
174 return $self->{'_distance'};
180 Usage : print $rel->to_string();
181 Function: to_string method for Path.
182 Returns : A string representation of this Path.
190 my $s = $self->SUPER::to_string
();
191 $s .= "-- Distance:\n";
192 $s .= $self->distance() if defined($self->distance());