/usr/share/perl5/Bio/Ontology/GOterm.pm is in libbio-perl-perl 1.6.924-1.
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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | #
# BioPerl module for Bio::Ontology::GOterm
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Christian M. Zmasek <czmasek-at-burnham.org> or <cmzmasek@yahoo.com>
#
# (c) Christian M. Zmasek, czmasek-at-burnham.org, 2002.
# (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
#
# You may distribute this module under the same terms as perl itself.
# Refer to the Perl Artistic License (see the license accompanying this
# software package, or see http://www.perl.com/language/misc/Artistic.html)
# for the terms under which you may use, modify, and redistribute this module.
#
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Ontology::GOterm - representation of GO terms
=head1 SYNOPSIS
$term = Bio::Ontology::GOterm->new
( -go_id => "GO:0016847",
-name => "1-aminocyclopropane-1-carboxylate synthase",
-definition => "Catalysis of ...",
-is_obsolete => 0,
-comment => "" );
$term->add_definition_references( @refs );
$term->add_secondary_GO_ids( @ids );
$term->add_aliases( @aliases );
foreach my $dr ( $term->each_definition_reference() ) {
print $dr, "\n";
}
# etc.
=head1 DESCRIPTION
This is "dumb" class for GO terms (it provides no functionality
related to graphs). Implements Bio::Ontology::TermI.
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<bioperl-l@bioperl.org>
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
=head1 AUTHOR
Christian M. Zmasek
Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
WWW: http://monochrome-effect.net/
Address:
Genomics Institute of the Novartis Research Foundation
10675 John Jay Hopkins Drive
San Diego, CA 92121
=head1 APPENDIX
The rest of the documentation details each of the object
methods.
=cut
# Let the code begin...
package Bio::Ontology::GOterm;
use strict;
use constant GOID_DEFAULT => "GO:0000000";
use constant TRUE => 1;
use constant FALSE => 0;
use base qw(Bio::Ontology::Term);
=head2 new
Title : new
Usage : $term = Bio::Ontology::GOterm->new(
-go_id => "GO:0016847",
-name => "1-aminocyclopropane-1-carboxylate synthase",
-definition => "Catalysis of ...",
-is_obsolete => 0,
-comment => "" );
Function: Creates a new Bio::Ontology::GOterm.
Returns : A new Bio::Ontology::GOterm object.
Args : -go_id => the goid of this GO term [GO:nnnnnnn]
or [nnnnnnn] (nnnnnnn is a zero-padded
integer of seven digits)
-name => the name of this GO term [scalar]
-definition => the definition of this GO term [scalar]
-ontology => the ontology for this term (a
Bio::Ontology::OntologyI compliant object)
-version => version information [scalar]
-is_obsolete => the obsoleteness of this GO term [0 or 1]
-comment => a comment [scalar]
=cut
sub new {
my( $class,@args ) = @_;
my $self = $class->SUPER::new( @args );
my ( $GO_id )
= $self->_rearrange( [ qw( GO_ID ) ], @args );
$GO_id && $self->GO_id( $GO_id );
return $self;
} # new
=head2 init
Title : init()
Usage : $term->init();
Function: Initializes this GOterm to all "" and empty lists.
Returns :
Args :
=cut
sub init {
my $self = shift;
# first call the inherited version to properly chain up the hierarchy
$self->SUPER::init(@_);
# then only initialize what we implement ourselves here
#$self->GO_id( GOID_DEFAULT );
} # init
=head2 GO_id
Title : GO_id
Usage : $term->GO_id( "GO:0003947" );
or
print $term->GO_id();
Function: Set/get for the goid of this GO term.
This is essentially an alias to identifier(), with added
format checking.
Returns : The goid [GO:nnnnnnn].
Args : The goid [GO:nnnnnnn] or [nnnnnnn] (nnnnnnn is a
zero-padded integer of seven digits) (optional).
=cut
sub GO_id {
my $self = shift;
my $value;
if ( @_ ) {
$value = $self->_check_go_id( shift );
unshift(@_, $value);
}
return $self->identifier( @_ );
} # GO_id
=head2 get_secondary_GO_ids
Title : get_secondary_GO_ids
Usage : @ids = $term->get_secondary_GO_ids();
Function: Returns a list of secondary goids of this Term.
This is aliased to remove_secondary_ids().
Returns : A list of secondary goids [array of [GO:nnnnnnn]]
(nnnnnnn is a zero-padded integer of seven digits).
Args :
=cut
sub get_secondary_GO_ids {
return shift->get_secondary_ids(@_);
} # get_secondary_GO_ids
=head2 add_secondary_GO_id
Title : add_secondary_GO_id
Usage : $term->add_secondary_GO_id( @ids );
or
$term->add_secondary_GO_id( $id );
Function: Pushes one or more secondary goids into
the list of secondary goids.
This is aliased to remove_secondary_ids().
Returns :
Args : One secondary goid [GO:nnnnnnn or nnnnnnn] or a list
of secondary goids [array of [GO:nnnnnnn or nnnnnnn]]
(nnnnnnn is a zero-padded integer of seven digits).
=cut
sub add_secondary_GO_id {
return shift->add_secondary_id(@_);
} # add_secondary_GO_id
=head2 remove_secondary_GO_ids
Title : remove_secondary_GO_ids()
Usage : $term->remove_secondary_GO_ids();
Function: Deletes (and returns) the secondary goids of this Term.
This is aliased to remove_secondary_ids().
Returns : A list of secondary goids [array of [GO:nnnnnnn]]
(nnnnnnn is a zero-padded integer of seven digits).
Args :
=cut
sub remove_secondary_GO_ids {
return shift->remove_secondary_ids(@_);
} # remove_secondary_GO_ids
=head2 to_string
Title : to_string()
Usage : print $term->to_string();
Function: to_string method for GO terms.
Returns : A string representation of this GOterm.
Args :
=cut
sub to_string {
my( $self ) = @_;
my $s = "";
$s .= "-- GO id:\n";
$s .= ($self->GO_id() || '')."\n";
$s .= "-- Name:\n";
$s .= ($self->name() || '') ."\n";
$s .= "-- Definition:\n";
$s .= ($self->definition() || '') ."\n";
$s .= "-- Category:\n";
if ( defined( $self->ontology() ) ) {
$s .= $self->ontology()->name()."\n";
}
else {
$s .= "\n";
}
$s .= "-- Version:\n";
$s .= ($self->version() || '') ."\n";
$s .= "-- Is obsolete:\n";
$s .= $self->is_obsolete()."\n";
$s .= "-- Comment:\n";
$s .= ($self->comment() || '') ."\n";
$s .= "-- Definition references:\n";
$s .= $self->_array_to_string( $self->get_dbxrefs() )."\n";
$s .= "-- Secondary GO ids:\n";
$s .= $self->_array_to_string( $self->get_secondary_GO_ids() )."\n";
$s .= "-- Aliases:\n";
$s .= $self->_array_to_string( $self->get_synonyms() );
return $s;
} # to_string
# Title : _check_go_id
# Function: Checks whether the argument is [GO:nnnnnnn].
# If "GO:" is not present, it adds it.
# Returns : The canonical GO id.
# Args : The value to be checked.
sub _check_go_id {
my ( $self, $value ) = @_;
unless ( $value =~ /^(GO:)?\d{7}$/ || $value eq GOID_DEFAULT ) {
$self->throw( "Found [" . $value
. "] where [GO:nnnnnnn] or [nnnnnnn] expected" );
}
unless ( $value =~ /^GO:/ ) {
$value = "GO:".$value;
}
return $value;
} # _check_go_id
# Title : _array_to_string
# Function:
# Returns :
# Args :
sub _array_to_string {
my( $self, @value ) = @_;
my $s = "";
for ( my $i = 0; $i < scalar( @value ); ++$i ) {
if ( ! ref( $value[ $i ] ) ) {
$s .= "#" . $i . "\n-- " . $value[ $i ] . "\n";
}
}
return $s;
} # _array_to_string
#################################################################
# aliases or forwards to maintain backward compatibility
#################################################################
*each_secondary_GO_id = \&get_secondary_GO_ids;
*add_secondary_GO_ids = \&add_secondary_GO_id;
1;
|