2 # BioPerl module for Path
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Hilmar Lapp <hlapp at gmx.net>
8 # (c) Hilmar Lapp, hlapp at gmx.net, 2003.
9 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2003.
11 # You may distribute this module under the same terms as perl itself.
12 # Refer to the Perl Artistic License (see the license accompanying this
13 # software package, or see http://www.perl.com/language/misc/Artistic.html)
14 # for the terms under which you may use, modify, and redistribute this module.
16 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
17 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 # You may distribute this module under the same terms as perl itself
22 # POD documentation - main docs before the code
26 Bio::Ontology::Path - a path for an ontology term graph
30 $path = Bio::Ontology::Path->new( -identifier => "16847",
31 -subject_term => $subj,
33 -predicate_term => $pred,
38 This is a basic implementation of Bio::Ontology::PathI.
40 Essiantially this is a very thin extension of
41 L<Bio::Ontology::Relationship>. It basically adds a method distance().
47 User feedback is an integral part of the evolution of this and other
48 Bioperl modules. Send your comments and suggestions preferably to the
49 Bioperl mailing lists Your participation is much appreciated.
51 bioperl-l@bioperl.org - General discussion
52 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
56 Please direct usage questions or support issues to the mailing list:
58 I<bioperl-l@bioperl.org>
60 rather than to the module maintainer directly. Many experienced and
61 reponsive experts will be able look at the problem and quickly
62 address it. Please include a thorough description of the problem
63 with code and data examples if at all possible.
67 Report bugs to the Bioperl bug tracking system to help us keep track
68 the bugs and their resolution. Bug reports can be submitted via
71 https://redmine.open-bio.org/projects/bioperl/
75 Hilmar Lapp <hlapp@gmx.net>
79 The rest of the documentation details each of the object
80 methods. Internal methods are usually preceded with a _
85 # Let the code begin...
88 package Bio
::Ontology
::Path
;
91 use base
qw(Bio::Ontology::Relationship Bio::Ontology::PathI);
99 Usage : $rel = Bio::Ontology::Path->new(-identifier => "16847",
100 -subject_term => $subject,
101 -object_term => $object,
102 -predicate_term => $type );
104 Function: Creates a new Bio::Ontology::Path.
105 Returns : A new Bio::Ontology::Path object.
106 Args : -identifier => the identifier of this relationship [scalar]
107 -subject_term => the subject term [Bio::Ontology::TermI]
108 -object_term => the object term [Bio::Ontology::TermI]
109 -predicate_term => the predicate term [Bio::Ontology::TermI]
110 -distance => the distance between subject and object
116 my( $class, @args ) = @_;
118 my $self = $class->SUPER::new
( @args );
121 $self->_rearrange( [qw( DISTANCE)
124 $distance && $self->distance($distance);
135 Usage : $rel->init();
136 Function: Initializes this Path to all undef.
145 $self->SUPER::init
(@_);
146 $self->{ "_distance" } = undef;
154 Usage : $obj->distance($newval)
155 Function: Get/set the distance between the two terms connected
158 Note that modifying the distance may not be meaningful. The
159 implementation here is not connected to any graph engine,
160 so changing an existing value may simply render the
161 attribute's value wrong.
164 Returns : value of distance (a scalar)
165 Args : on set, new value (a scalar or undef, optional)
172 return $self->{'_distance'} = shift if @_;
173 return $self->{'_distance'};
179 Usage : print $rel->to_string();
180 Function: to_string method for Path.
181 Returns : A string representation of this Path.
189 my $s = $self->SUPER::to_string
();
190 $s .= "-- Distance:\n";
191 $s .= $self->distance() if defined($self->distance());