3 # BioPerl module for Bio::Phenotype::Correlate
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Christian M. Zmasek <czmasek-at-burnham.org> or <cmzmasek@yahoo.com>
9 # (c) Christian M. Zmasek, czmasek-at-burnham.org, 2002.
10 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
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::Phenotype::Correlate - Representation of a correlating phenotype in a given species
31 use Bio::Phenotype::Correlate;
33 $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
34 -description => "mouse correlate of human phenotype MIM 605865",
37 -comment => "type=homolog is putative" );
40 print $co->description();
41 print $co->species()->binomial();
45 print $co->to_string();
49 This class models correlating phenotypes.
50 Its creation was inspired by the OMIM database where many human phenotypes
51 have a correlating mouse phenotype. Therefore, this class is intended
52 to be used together with a phenotype class.
59 User feedback is an integral part of the evolution of this and other
60 Bioperl modules. Send your comments and suggestions preferably to one
61 of the Bioperl mailing lists. Your participation is much appreciated.
63 bioperl-l@bioperl.org - General discussion
64 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
68 Please direct usage questions or support issues to the mailing list:
70 I<bioperl-l@bioperl.org>
72 rather than to the module maintainer directly. Many experienced and
73 reponsive experts will be able look at the problem and quickly
74 address it. Please include a thorough description of the problem
75 with code and data examples if at all possible.
79 Report bugs to the Bioperl bug tracking system to help us keep track
80 the bugs and their resolution. Bug reports can be submitted via the
83 http://bugzilla.open-bio.org/
89 Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
91 WWW: http://monochrome-effect.net/
95 Genomics Institute of the Novartis Research Foundation
96 10675 John Jay Hopkins Drive
101 The rest of the documentation details each of the object
107 # Let the code begin...
109 package Bio
::Phenotype
::Correlate
;
113 use base
qw(Bio::Root::Root);
119 Usage : $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
120 -description => "mouse correlate of human phenotype MIM 605865",
123 -comment => "type=homolog is putative" );
124 Function: Creates a new Correlate object.
125 Returns : A new Correlate object.
126 Args : -name => a name or id
127 -description => a description
128 -species => the species of this correlating phenotype [Bio::Species]
129 -type => the type of correlation
130 -comment => a comment
136 my( $class, @args ) = @_;
138 my $self = $class->SUPER::new
( @args );
140 my ( $name, $desc, $species, $type, $comment )
141 = $self->_rearrange( [ qw( NAME
145 COMMENT ) ], @args );
149 $name && $self->name( $name );
150 $desc && $self->description( $desc );
151 $species && $self->species( $species );
152 $type && $self->type( $type );
153 $comment && $self->comment( $comment );
166 Function: Initializes this Correlate to all "".
177 $self->description( "" );
178 my $species = Bio
::Species
->new();
179 $species->classification( qw( species Undetermined ) );
180 $self->species( $species );
182 $self->comment( "" );
192 Usage : $co->name( "4(Tas1r3)" );
195 Function: Set/get for the name or id of this Correlate.
196 Returns : The name or id of this Correlate.
197 Args : The name or id of this Correlate (optional).
202 my ( $self, $value ) = @_;
204 if ( defined $value ) {
205 $self->{ "_name" } = $value;
208 return $self->{ "_name" };
218 Usage : $co->description( "mouse correlate of human phenotype MIM 03923" );
220 print $co->description();
221 Function: Set/get for the description of this Correlate.
222 Returns : A description of this Correlate.
223 Args : A description of this Correlate (optional).
228 my ( $self, $value ) = @_;
230 if ( defined $value ) {
231 $self->{ "_description" } = $value;
234 return $self->{ "_description" };
244 Usage : $co->species( $species );
246 $species = $co->species();
247 Function: Set/get for the species of this Correlate.
248 Returns : The Bio::Species of this Correlate [Bio::Species].
249 Args : The Bio::Species of this Correlate [Bio::Species] (optional).
255 my ( $self, $value ) = @_;
257 if ( defined $value ) {
258 $self->_check_ref_type( $value, "Bio::Species" );
259 $self->{ "_species" } = $value;
262 return $self->{ "_species" };
272 Usage : $co->type( "homolog" );
275 Function: Set/get for the type of this Correlate.
276 Returns : The type of this Correlate.
277 Args : The type of this Correlate (optional).
282 my ( $self, $value ) = @_;
284 if ( defined $value ) {
285 $self->{ "_type" } = $value;
288 return $self->{ "_type" };
298 Usage : $co->comment( "doubtful" );
300 print $co->comment();
301 Function: Set/get for an arbitrary comment about this Correlate.
303 Args : A comment (optional).
308 my ( $self, $value ) = @_;
310 if ( defined $value ) {
311 $self->{ "_comment" } = $value;
314 return $self->{ "_comment" };
323 Usage : print $co->to_string();
324 Function: To string method for Correlate objects.
325 Returns : A string representations of this Correlate.
337 $s .= $self->name()."\n";
338 $s .= "-- Description:\n";
339 $s .= $self->description()."\n";
340 $s .= "-- Species:\n";
341 $s .= $self->species()->binomial()."\n";
342 $s .= "-- Type of correlation:\n";
343 $s .= $self->type()."\n";
344 $s .= "-- Comment:\n";
345 $s .= $self->comment();
354 # Title : _check_ref_type
355 # Function: Checks for the correct type.
357 # Args : The value to be checked, the expected class.
358 sub _check_ref_type
{
359 my ( $self, $value, $expected_class ) = @_;
361 if ( ! defined( $value ) ) {
362 $self->throw( ( caller( 1 ) )[ 3 ] .": Found [undef"
363 ."] where [$expected_class] expected" );
365 elsif ( ! ref( $value ) ) {
366 $self->throw( ( caller( 1 ) )[ 3 ] .": Found scalar"
367 ." where [$expected_class] expected" );
369 elsif ( ! $value->isa( $expected_class ) ) {
370 $self->throw( ( caller( 1 ) )[ 3 ] .": Found [". ref( $value )
371 ."] where [$expected_class] expected" );