3 # BioPerl module for Bio::Phenotype::Correlate
5 # Cared for by Christian M. Zmasek <czmasek@gnf.org> or <cmzmasek@yahoo.com>
7 # (c) Christian M. Zmasek, czmasek@gnf.org, 2002.
8 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
10 # You may distribute this module under the same terms as perl itself.
11 # Refer to the Perl Artistic License (see the license accompanying this
12 # software package, or see http://www.perl.com/language/misc/Artistic.html)
13 # for the terms under which you may use, modify, and redistribute this module.
15 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
16 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
17 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 # You may distribute this module under the same terms as perl itself
21 # POD documentation - main docs before the code
25 Bio::Phenotype::Correlate - Representation of a correlating phenotype in a given species
29 use Bio::Phenotype::Correlate;
31 $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
32 -description => "mouse correlate of human phenotype MIM 605865",
35 -comment => "type=homolog is putative" );
38 print $co->description();
39 print $co->species()->binomial();
43 print $co->to_string();
47 This class models correlating phenotypes.
48 Its creation was inspired by the OMIM database where many human phenotypes
49 have a correlating mouse phenotype. Therefore, this class is intended
50 to be used together with a phenotype class.
57 User feedback is an integral part of the evolution of this and other
58 Bioperl modules. Send your comments and suggestions preferably to one
59 of the Bioperl mailing lists. Your participation is much appreciated.
61 bioperl-l@bioperl.org - General discussion
62 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
66 Report bugs to the Bioperl bug tracking system to help us keep track
67 the bugs and their resolution. Bug reports can be submitted via the
70 http://bugzilla.open-bio.org/
76 Email: czmasek@gnf.org or cmzmasek@yahoo.com
78 WWW: http://www.genetics.wustl.edu/eddy/people/zmasek/
82 Genomics Institute of the Novartis Research Foundation
83 10675 John Jay Hopkins Drive
88 The rest of the documentation details each of the object
94 # Let the code begin...
96 package Bio
::Phenotype
::Correlate
;
100 use base
qw(Bio::Root::Root);
106 Usage : $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
107 -description => "mouse correlate of human phenotype MIM 605865",
110 -comment => "type=homolog is putative" );
111 Function: Creates a new Correlate object.
112 Returns : A new Correlate object.
113 Args : -name => a name or id
114 -description => a description
115 -species => the species of this correlating phenotype [Bio::Species]
116 -type => the type of correlation
117 -comment => a comment
123 my( $class, @args ) = @_;
125 my $self = $class->SUPER::new
( @args );
127 my ( $name, $desc, $species, $type, $comment )
128 = $self->_rearrange( [ qw( NAME
132 COMMENT ) ], @args );
136 $name && $self->name( $name );
137 $desc && $self->description( $desc );
138 $species && $self->species( $species );
139 $type && $self->type( $type );
140 $comment && $self->comment( $comment );
153 Function: Initializes this Correlate to all "".
164 $self->description( "" );
165 my $species = Bio
::Species
->new();
166 $species->classification( qw( species Undetermined ) );
167 $self->species( $species );
169 $self->comment( "" );
179 Usage : $co->name( "4(Tas1r3)" );
182 Function: Set/get for the name or id of this Correlate.
183 Returns : The name or id of this Correlate.
184 Args : The name or id of this Correlate (optional).
189 my ( $self, $value ) = @_;
191 if ( defined $value ) {
192 $self->{ "_name" } = $value;
195 return $self->{ "_name" };
205 Usage : $co->description( "mouse correlate of human phenotype MIM 03923" );
207 print $co->description();
208 Function: Set/get for the description of this Correlate.
209 Returns : A description of this Correlate.
210 Args : A description of this Correlate (optional).
215 my ( $self, $value ) = @_;
217 if ( defined $value ) {
218 $self->{ "_description" } = $value;
221 return $self->{ "_description" };
231 Usage : $co->species( $species );
233 $species = $co->species();
234 Function: Set/get for the species of this Correlate.
235 Returns : The Bio::Species of this Correlate [Bio::Species].
236 Args : The Bio::Species of this Correlate [Bio::Species] (optional).
242 my ( $self, $value ) = @_;
244 if ( defined $value ) {
245 $self->_check_ref_type( $value, "Bio::Species" );
246 $self->{ "_species" } = $value;
249 return $self->{ "_species" };
259 Usage : $co->type( "homolog" );
262 Function: Set/get for the type of this Correlate.
263 Returns : The type of this Correlate.
264 Args : The type of this Correlate (optional).
269 my ( $self, $value ) = @_;
271 if ( defined $value ) {
272 $self->{ "_type" } = $value;
275 return $self->{ "_type" };
285 Usage : $co->comment( "doubtful" );
287 print $co->comment();
288 Function: Set/get for an arbitrary comment about this Correlate.
290 Args : A comment (optional).
295 my ( $self, $value ) = @_;
297 if ( defined $value ) {
298 $self->{ "_comment" } = $value;
301 return $self->{ "_comment" };
310 Usage : print $co->to_string();
311 Function: To string method for Correlate objects.
312 Returns : A string representations of this Correlate.
324 $s .= $self->name()."\n";
325 $s .= "-- Description:\n";
326 $s .= $self->description()."\n";
327 $s .= "-- Species:\n";
328 $s .= $self->species()->binomial()."\n";
329 $s .= "-- Type of correlation:\n";
330 $s .= $self->type()."\n";
331 $s .= "-- Comment:\n";
332 $s .= $self->comment();
341 # Title : _check_ref_type
342 # Function: Checks for the correct type.
344 # Args : The value to be checked, the expected class.
345 sub _check_ref_type
{
346 my ( $self, $value, $expected_class ) = @_;
348 if ( ! defined( $value ) ) {
349 $self->throw( ( caller( 1 ) )[ 3 ] .": Found [undef"
350 ."] where [$expected_class] expected" );
352 elsif ( ! ref( $value ) ) {
353 $self->throw( ( caller( 1 ) )[ 3 ] .": Found scalar"
354 ." where [$expected_class] expected" );
356 elsif ( ! $value->isa( $expected_class ) ) {
357 $self->throw( ( caller( 1 ) )[ 3 ] .": Found [". ref( $value )
358 ."] where [$expected_class] expected" );