2 # BioPerl module for Bio::Phenotype::Correlate
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Christian M. Zmasek <czmasek-at-burnham.org> or <cmzmasek@yahoo.com>
8 # (c) Christian M. Zmasek, czmasek-at-burnham.org, 2002.
9 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
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
26 Bio::Phenotype::Correlate - Representation of a correlating phenotype in a given species
30 use Bio::Phenotype::Correlate;
32 $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
33 -description => "mouse correlate of human phenotype MIM 605865",
36 -comment => "type=homolog is putative" );
39 print $co->description();
40 print $co->species()->binomial();
44 print $co->to_string();
48 This class models correlating phenotypes.
49 Its creation was inspired by the OMIM database where many human phenotypes
50 have a correlating mouse phenotype. Therefore, this class is intended
51 to be used together with a phenotype class.
58 User feedback is an integral part of the evolution of this and other
59 Bioperl modules. Send your comments and suggestions preferably to one
60 of the Bioperl mailing lists. Your participation is much appreciated.
62 bioperl-l@bioperl.org - General discussion
63 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
67 Please direct usage questions or support issues to the mailing list:
69 I<bioperl-l@bioperl.org>
71 rather than to the module maintainer directly. Many experienced and
72 reponsive experts will be able look at the problem and quickly
73 address it. Please include a thorough description of the problem
74 with code and data examples if at all possible.
78 Report bugs to the Bioperl bug tracking system to help us keep track
79 the bugs and their resolution. Bug reports can be submitted via the
82 https://redmine.open-bio.org/projects/bioperl/
88 Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
90 WWW: http://monochrome-effect.net/
94 Genomics Institute of the Novartis Research Foundation
95 10675 John Jay Hopkins Drive
100 The rest of the documentation details each of the object
106 # Let the code begin...
108 package Bio
::Phenotype
::Correlate
;
112 use base
qw(Bio::Root::Root);
118 Usage : $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
119 -description => "mouse correlate of human phenotype MIM 605865",
122 -comment => "type=homolog is putative" );
123 Function: Creates a new Correlate object.
124 Returns : A new Correlate object.
125 Args : -name => a name or id
126 -description => a description
127 -species => the species of this correlating phenotype [Bio::Species]
128 -type => the type of correlation
129 -comment => a comment
135 my( $class, @args ) = @_;
137 my $self = $class->SUPER::new
( @args );
139 my ( $name, $desc, $species, $type, $comment )
140 = $self->_rearrange( [ qw( NAME
144 COMMENT ) ], @args );
148 $name && $self->name( $name );
149 $desc && $self->description( $desc );
150 $species && $self->species( $species );
151 $type && $self->type( $type );
152 $comment && $self->comment( $comment );
165 Function: Initializes this Correlate to all "".
176 $self->description( "" );
177 my $species = Bio
::Species
->new();
178 $species->classification( qw( species Undetermined ) );
179 $self->species( $species );
181 $self->comment( "" );
191 Usage : $co->name( "4(Tas1r3)" );
194 Function: Set/get for the name or id of this Correlate.
195 Returns : The name or id of this Correlate.
196 Args : The name or id of this Correlate (optional).
201 my ( $self, $value ) = @_;
203 if ( defined $value ) {
204 $self->{ "_name" } = $value;
207 return $self->{ "_name" };
217 Usage : $co->description( "mouse correlate of human phenotype MIM 03923" );
219 print $co->description();
220 Function: Set/get for the description of this Correlate.
221 Returns : A description of this Correlate.
222 Args : A description of this Correlate (optional).
227 my ( $self, $value ) = @_;
229 if ( defined $value ) {
230 $self->{ "_description" } = $value;
233 return $self->{ "_description" };
243 Usage : $co->species( $species );
245 $species = $co->species();
246 Function: Set/get for the species of this Correlate.
247 Returns : The Bio::Species of this Correlate [Bio::Species].
248 Args : The Bio::Species of this Correlate [Bio::Species] (optional).
254 my ( $self, $value ) = @_;
256 if ( defined $value ) {
257 $self->_check_ref_type( $value, "Bio::Species" );
258 $self->{ "_species" } = $value;
261 return $self->{ "_species" };
271 Usage : $co->type( "homolog" );
274 Function: Set/get for the type of this Correlate.
275 Returns : The type of this Correlate.
276 Args : The type of this Correlate (optional).
281 my ( $self, $value ) = @_;
283 if ( defined $value ) {
284 $self->{ "_type" } = $value;
287 return $self->{ "_type" };
297 Usage : $co->comment( "doubtful" );
299 print $co->comment();
300 Function: Set/get for an arbitrary comment about this Correlate.
302 Args : A comment (optional).
307 my ( $self, $value ) = @_;
309 if ( defined $value ) {
310 $self->{ "_comment" } = $value;
313 return $self->{ "_comment" };
322 Usage : print $co->to_string();
323 Function: To string method for Correlate objects.
324 Returns : A string representations of this Correlate.
336 $s .= $self->name()."\n";
337 $s .= "-- Description:\n";
338 $s .= $self->description()."\n";
339 $s .= "-- Species:\n";
340 $s .= $self->species()->binomial()."\n";
341 $s .= "-- Type of correlation:\n";
342 $s .= $self->type()."\n";
343 $s .= "-- Comment:\n";
344 $s .= $self->comment();
353 # Title : _check_ref_type
354 # Function: Checks for the correct type.
356 # Args : The value to be checked, the expected class.
357 sub _check_ref_type
{
358 my ( $self, $value, $expected_class ) = @_;
360 if ( ! defined( $value ) ) {
361 $self->throw( ( caller( 1 ) )[ 3 ] .": Found [undef"
362 ."] where [$expected_class] expected" );
364 elsif ( ! ref( $value ) ) {
365 $self->throw( ( caller( 1 ) )[ 3 ] .": Found scalar"
366 ." where [$expected_class] expected" );
368 elsif ( ! $value->isa( $expected_class ) ) {
369 $self->throw( ( caller( 1 ) )[ 3 ] .": Found [". ref( $value )
370 ."] where [$expected_class] expected" );