Remove modules and tests (StandAloneBlast and WrapperBase) that now reside in bioperl-run
[bioperl-live.git] / Bio / Ontology / Path.pm
blobcb0d8247473dbcdd761cc029742593660545b934
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
24 =head1 NAME
26 Bio::Ontology::Path - a path for an ontology term graph
28 =head1 SYNOPSIS
30 $path = Bio::Ontology::Path->new( -identifier => "16847",
31 -subject_term => $subj,
32 -object_term => $obj,
33 -predicate_term => $pred,
34 -distance => 3 );
36 =head1 DESCRIPTION
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().
43 =head1 FEEDBACK
45 =head2 Mailing Lists
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
54 =head2 Support
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.
65 =head2 Reporting Bugs
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
69 the web:
71 https://github.com/bioperl/bioperl-live/issues
73 =head1 AUTHOR
75 Hilmar Lapp <hlapp@gmx.net>
77 =head1 APPENDIX
79 The rest of the documentation details each of the object
80 methods. Internal methods are usually preceded with a _
82 =cut
85 # Let the code begin...
88 package Bio::Ontology::Path;
89 use strict;
91 use base qw(Bio::Ontology::Relationship Bio::Ontology::PathI);
96 =head2 new
98 Title : new
99 Usage : $rel = Bio::Ontology::Path->new(-identifier => "16847",
100 -subject_term => $subject,
101 -object_term => $object,
102 -predicate_term => $type );
103 -distance => 3 );
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
112 =cut
114 sub new {
116 my( $class, @args ) = @_;
118 my $self = $class->SUPER::new( @args );
120 my ( $distance ) =
121 $self->_rearrange( [qw( DISTANCE)
122 ], @args );
124 $distance && $self->distance($distance);
126 return $self;
128 } # new
132 =head2 init
134 Title : init()
135 Usage : $rel->init();
136 Function: Initializes this Path to all undef.
137 Returns :
138 Args :
140 =cut
142 sub init {
143 my $self = shift;
145 $self->SUPER::init(@_);
146 $self->{ "_distance" } = undef;
148 } # init
151 =head2 distance
153 Title : distance
154 Usage : $obj->distance($newval)
155 Function: Get/set the distance between the two terms connected
156 by this path.
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.
163 Example :
164 Returns : value of distance (a scalar)
165 Args : on set, new value (a scalar or undef, optional)
167 =cut
169 sub distance{
170 my $self = shift;
172 return $self->{'_distance'} = shift if @_;
173 return $self->{'_distance'};
176 =head2 to_string
178 Title : to_string()
179 Usage : print $rel->to_string();
180 Function: to_string method for Path.
181 Returns : A string representation of this Path.
182 Args :
184 =cut
186 sub to_string {
187 my( $self ) = @_;
189 my $s = $self->SUPER::to_string();
190 $s .= "-- Distance:\n";
191 $s .= $self->distance() if defined($self->distance());
192 $s .= "\n";
194 return $s;
196 } # to_string