remove comment
[bioperl-live.git] / Bio / Phenotype / Correlate.pm
blob7712a947a9061bee3be507d5842d436cf157a33d
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
24 =head1 NAME
26 Bio::Phenotype::Correlate - Representation of a correlating phenotype in a given species
28 =head1 SYNOPSIS
30 use Bio::Phenotype::Correlate;
32 $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
33 -description => "mouse correlate of human phenotype MIM 605865",
34 -species => $mouse,
35 -type => "homolog",
36 -comment => "type=homolog is putative" );
38 print $co->name();
39 print $co->description();
40 print $co->species()->binomial();
41 print $co->type();
42 print $co->comment();
44 print $co->to_string();
46 =head1 DESCRIPTION
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.
54 =head1 FEEDBACK
56 =head2 Mailing Lists
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
65 =head2 Support
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.
76 =head2 Reporting Bugs
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
80 web:
82 https://redmine.open-bio.org/projects/bioperl/
84 =head1 AUTHOR
86 Christian M. Zmasek
88 Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
90 WWW: http://monochrome-effect.net/
92 Address:
94 Genomics Institute of the Novartis Research Foundation
95 10675 John Jay Hopkins Drive
96 San Diego, CA 92121
98 =head1 APPENDIX
100 The rest of the documentation details each of the object
101 methods.
103 =cut
106 # Let the code begin...
108 package Bio::Phenotype::Correlate;
109 use strict;
110 use Bio::Species;
112 use base qw(Bio::Root::Root);
115 =head2 new
117 Title : new
118 Usage : $co = Bio::Phenotype::Correlate->new( -name => "4(Tas1r3)",
119 -description => "mouse correlate of human phenotype MIM 605865",
120 -species => $mouse,
121 -type => "homolog",
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
131 =cut
133 sub new {
135 my( $class, @args ) = @_;
137 my $self = $class->SUPER::new( @args );
139 my ( $name, $desc, $species, $type, $comment )
140 = $self->_rearrange( [ qw( NAME
141 DESCRIPTION
142 SPECIES
143 TYPE
144 COMMENT ) ], @args );
146 $self->init();
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 );
154 return $self;
156 } # new
161 =head2 init
163 Title : init()
164 Usage : $co->init();
165 Function: Initializes this Correlate to all "".
166 Returns :
167 Args :
169 =cut
171 sub init {
173 my( $self ) = @_;
175 $self->name( "" );
176 $self->description( "" );
177 my $species = Bio::Species->new();
178 $species->classification( qw( species Undetermined ) );
179 $self->species( $species );
180 $self->type( "" );
181 $self->comment( "" );
183 } # init
188 =head2 name
190 Title : name
191 Usage : $co->name( "4(Tas1r3)" );
193 print $co->name();
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).
198 =cut
200 sub name {
201 my ( $self, $value ) = @_;
203 if ( defined $value ) {
204 $self->{ "_name" } = $value;
207 return $self->{ "_name" };
209 } # name
214 =head2 description
216 Title : description
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).
224 =cut
226 sub description {
227 my ( $self, $value ) = @_;
229 if ( defined $value ) {
230 $self->{ "_description" } = $value;
233 return $self->{ "_description" };
235 } # description
240 =head2 species
242 Title : species
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).
250 =cut
252 sub species {
254 my ( $self, $value ) = @_;
256 if ( defined $value ) {
257 $self->_check_ref_type( $value, "Bio::Species" );
258 $self->{ "_species" } = $value;
261 return $self->{ "_species" };
263 } # species
268 =head2 type
270 Title : type
271 Usage : $co->type( "homolog" );
273 print $co->type();
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).
278 =cut
280 sub type {
281 my ( $self, $value ) = @_;
283 if ( defined $value ) {
284 $self->{ "_type" } = $value;
287 return $self->{ "_type" };
289 } # type
294 =head2 comment
296 Title : comment
297 Usage : $co->comment( "doubtful" );
299 print $co->comment();
300 Function: Set/get for an arbitrary comment about this Correlate.
301 Returns : A comment.
302 Args : A comment (optional).
304 =cut
306 sub comment {
307 my ( $self, $value ) = @_;
309 if ( defined $value ) {
310 $self->{ "_comment" } = $value;
313 return $self->{ "_comment" };
315 } # comment
319 =head2 to_string
321 Title : to_string()
322 Usage : print $co->to_string();
323 Function: To string method for Correlate objects.
324 Returns : A string representations of this Correlate.
325 Args :
327 =cut
329 sub to_string {
331 my ( $self ) = @_;
333 my $s = "";
335 $s .= "-- Name:\n";
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();
346 return $s;
348 } # to_string
353 # Title : _check_ref_type
354 # Function: Checks for the correct type.
355 # Returns :
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" );
372 } # _check_ref_type