/usr/share/perl5/GO/Model/Path.pm is in libgo-perl 0.15-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | # $Id: Path.pm,v 1.5 2004/11/29 20:18:17 cmungall Exp $
#
# This GO module is maintained by Chris Mungall <cjm@fruitfly.org>
#
# see also - http://www.geneontology.org
# - http://www.godatabase.org/dev
#
# You may distribute this module under the same terms as perl itself
package GO::Model::Path;
=head1 NAME
GO::Model::Path - path between two nodes
=head1 SYNOPSIS
=head1 DESCRIPTION
represents a path between two nodes in a graph
TODO: have the path be built of relationships rather than terms, so
we can get the edgetypes in here
=cut
use Carp;
use Exporter;
use GO::Utils qw(rearrange);
use GO::Model::Root;
use strict;
use vars qw(@ISA);
@ISA = qw(GO::Model::Root Exporter);
sub _valid_params {
return qw(link_list);
}
=head2 link_list
Usage -
Returns - arrayref of alternating type, GO::Model::Term
Args -
=cut
=head2 term_list
Usage -
Returns - arrayref of GO::Model::Term
Args -
gets/sets an ordered list of terms in the path
L<GO::Model::Term>
=cut
sub term_list {
my $self = shift;
my $links = $self->link_list || [];
my @terms = ();
for (my $i=1; $i<@$links; $i+=2) {
push(@terms, $links->[$i]);
}
\@terms;
}
# add_link - private
sub add_link {
my $self = shift;
if (!$self->{link_list}) {
$self->{link_list} = [];
}
push(@{$self->{link_list}}, shift, shift) if @_;
$self->{link_list};
}
=head2 length
Usage - print $path->length
Returns - int
Args -
=cut
sub length {
my $self = shift;
return scalar(@{$self->{link_list} || []})/2;
}
=head2 to_text
Usage -
Returns -
Args -
=cut
sub to_text {
my $self = shift;
my $use = shift;
my $links = $self->link_list || [];
my @parts = ();
for (my $i=0; $i<@$links; $i+=2) {
my $t = $links->[$i+1];
push(@parts, "[$links->[$i]]", $use && $use eq 'acc' ? $t->acc : $t->name);
}
return
join(' ', @parts);
}
=head2 duplicate
Usage -
Returns -
Args -
=cut
sub duplicate {
my $self = shift;
my $dup = $self->new;
$dup->link_list([@{$self->link_list || []}]);
$dup;
}
1;
|