3 # BioPerl module for Bio::Phenotype::OMIM::OMIMentry
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::OMIM::OMIMentry - represents OMIM (Online Mendelian
28 Inheritance in Man) database entries
32 $obj = Bio::Phenotype::OMIM::OMIMentry->new( -mim_number => 200000,
33 -description => "This is ...",
34 -more_than_two_genes => 1 );
38 Inherits from Bio::Phenotype::PhenotypeI.
39 Bio::Phenotype::OMIM::OMIMparser parses the flat file representation
40 of OMIM (i.e. files "omim.txt" and "genemap") returning OMIMentry objects.
46 User feedback is an integral part of the evolution of this and other
47 Bioperl modules. Send your comments and suggestions preferably to the
48 Bioperl mailing lists Your participation is much appreciated.
50 bioperl-l@bioperl.org - General discussion
51 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
55 Please direct usage questions or support issues to the mailing list:
57 I<bioperl-l@bioperl.org>
59 rather than to the module maintainer directly. Many experienced and
60 reponsive experts will be able look at the problem and quickly
61 address it. Please include a thorough description of the problem
62 with code and data examples if at all possible.
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-at-burnham.org or cmzmasek@yahoo.com
78 WWW: http://monochrome-effect.net/
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
89 methods. Internal methods are usually preceded with a _
94 # Let the code begin...
97 package Bio
::Phenotype
::OMIM
::OMIMentry
;
100 use Bio
::Phenotype
::OMIM
::MiniMIMentry
;
101 use Bio
::Phenotype
::OMIM
::OMIMentryAllelicVariant
;
103 use constant TRUE
=> 1;
104 use constant FALSE
=> 0;
105 use constant DEFAULT_MIM_NUMER
=> 0;
107 use base
qw(Bio::Phenotype::Phenotype);
115 Usage : $obj = Bio::Phenotype::OMIM::OMIMentry->new( -mim_number => 200000,
116 -description => "This is ...",
117 -more_than_two_genes => 1 );
118 Function: Creates a new OMIMentry object.
119 Returns : A new OMIMentry object.
120 Args : -mim_number => the MIM number
121 -title => the title or name
122 -alternative_titles_and_symbols => the "alternative titles and symbols"
123 -more_than_two_genes => can phenotype can be caused by mutation in any of two or more genes?
124 -is_separate => is this phenotype separate from those represented by other entries
125 -description => the description of this phenotype
126 -mapping_method => the mapping method
127 -gene_status => the gene status of this
128 -comment => a comment
129 -species => ref to the the species (human)
130 -created => created by whom/when
131 -edited => edited by whom/when
132 -contributors => contributed by whom/when
133 -additional_references => "see also"
134 -clinical_symptoms => the clinical symptoms
135 -minimim => the Mini MIM associated with this OMIM antry
141 my( $class,@args ) = @_;
143 my $self = $class->SUPER::new
( @args );
147 $alternative_titles_and_symbols,
148 $more_than_two_genes,
158 $additional_references,
161 = $self->_rearrange( [ qw( MIM_NUMBER
163 ALTERNATIVE_TITLES_AND_SYMBOLS
174 ADDITIONAL_REFERENCES
176 MINIMIM ) ], @args );
180 $mim_number && $self->MIM_number( $mim_number );
181 $title && $self->title( $title );
182 $alternative_titles_and_symbols && $self->alternative_titles_and_symbols( $alternative_titles_and_symbols );
183 $more_than_two_genes && $self->more_than_two_genes( $more_than_two_genes );
184 $is_separate && $self->is_separate( $is_separate );
185 $description && $self->description( $description );
186 $mapping_method && $self->mapping_method( $mapping_method );
187 $gene_status && $self->gene_status( $gene_status );
188 $comment && $self->comment( $comment );
189 $species && $self->species( $species );
190 $created && $self->created( $created );
191 $edited && $self->edited( $edited );
192 $contributors && $self->contributors( $contributors );
193 $additional_references && $self->additional_references( $additional_references );
194 $clinical_symptoms && $self->clinical_symptoms_raw( $clinical_symptoms );
195 $miniMIM && $self->miniMIM( $miniMIM );
206 Usage : $obj->init();
207 Function: Initializes this OMIMentry to all "" and empty lists.
217 $self->MIM_number( DEFAULT_MIM_NUMER
);
219 $self->alternative_titles_and_symbols( "" );
220 $self->more_than_two_genes( FALSE
);
221 $self->is_separate( FALSE
);
222 $self->description( "" );
223 $self->mapping_method( "" );
224 $self->gene_status( "" );
225 $self->comment( "" );
226 my $species = Bio
::Species
->new();
227 $species->classification( qw( sapiens Homo ) );
228 $self->species( $species );
229 $self->created( "" );
231 $self->contributors( "" );
232 $self->additional_references( "" );
233 $self->clinical_symptoms( {} );
234 $self->remove_Correlates();
235 $self->remove_References();
236 $self->remove_AllelicVariants();
237 $self->remove_CytoPositions();
238 $self->remove_gene_symbols();
239 $self->remove_Genotypes();
240 $self->remove_DBLinks();
241 $self->remove_keywords();
242 $self->remove_Variants();
243 $self->remove_Measures();
244 $self->miniMIM( Bio
::Phenotype
::OMIM
::MiniMIMentry
->new() );
256 $s .= "-- MIM number:\n";
257 $s .= $self->MIM_number()."\n\n";
259 $s .= $self->title()."\n\n";
260 $s .= "-- Alternative Titles and Symbols:\n";
261 $s .= $self->alternative_titles_and_symbols()."\n\n";
262 $s .= "-- Can be caused by Mutation in any of two or more Genes:\n";
263 $s .= $self->more_than_two_genes()."\n\n";
264 $s .= "-- Phenotype is separate:\n";
265 $s .= $self->is_separate()."\n\n";
266 $s .= "-- Description:\n";
267 $s .= $self->description()."\n\n";
268 $s .= "-- Species:\n";
269 $s .= $self->species()->binomial()."\n\n";
270 $s .= "-- Clinical Symptoms:\n";
271 $s .= $self->clinical_symptoms()."\n\n";
272 $s .= "-- Allelic Variants:\n";
273 $s .= $self->_array_to_string( $self->each_AllelicVariant() )."\n";
274 $s .= "-- Cyto Positions:\n";
275 $s .= $self->_array_to_string( $self->each_CytoPosition() )."\n";
276 $s .= "-- Gene Symbols:\n";
277 $s .= $self->_array_to_string( $self->each_gene_symbol() )."\n";
278 $s .= "-- Correlates:\n";
279 $s .= $self->_array_to_string( $self->each_Correlate() )."\n";
280 $s .= "-- References:\n";
281 $s .= $self->_array_to_string( $self->each_Reference() )."\n";
282 $s .= "-- Additional References:\n";
283 $s .= $self->additional_references()."\n\n";
284 $s .= "-- Mapping Method:\n";
285 $s .= $self->mapping_method()."\n\n";
286 $s .= "-- Gene status:\n";
287 $s .= $self->gene_status()."\n\n";
288 $s .= "-- Created:\n";
289 $s .= $self->created()."\n\n";
290 $s .= "-- Contributors:\n";
291 $s .= $self->contributors()."\n\n";
292 $s .= "-- Edited:\n";
293 $s .= $self->edited()."\n\n";
294 $s .= "-- Comment:\n";
295 $s .= $self->comment()."\n\n";
296 $s .= "-- MiniMIM:\n";
297 $s .= $self->miniMIM()->to_string()."\n\n";
308 Usage : $omim->MIM_number( "100050" );
310 print $omim->MIM_number();
311 Function: Set/get for the MIM number of this OMIM entry.
312 Returns : The MIM number [an integer larger than 100000].
313 Args : The MIM number [an integer larger than 100000] (optional).
318 my ( $self, $value ) = @_;
320 if ( defined $value ) {
322 || ( $value < 100000 && $value != DEFAULT_MIM_NUMER
) ) {
323 $self->throw( "Found [$value]"
324 . " where [integer larger than 100000] expected" );
326 $self->{ "_MIM_number" } = $value;
329 return $self->{ "_MIM_number" };
339 Usage : $omim->title( "AARSKOG SYNDROME" );
341 print $omim->title();
342 Function: Set/get for the title or name of this OMIM entry.
343 This method is an alias to the method "name" of
344 Bio::Phenotype::PhenotypeI.
345 Returns : The title [scalar].
346 Args : The title [scalar] (optional).
360 =head2 alternative_titles_and_symbols
362 Title : alternative_titles_and_symbols
363 Usage : $omim->alternative_titles_and_symbols( "AORTIC ANEURYSM, ABDOMINAL" );
365 print $omim->alternative_titles_and_symbols();
366 Function: Set/get for the "alternative titles and symbols" of this OMIM entry.
367 Currently, everything after the first line of title (TI) field is
368 considered "alternative titles and symbols".
369 Returns : "alternative titles and symbols" [scalar].
370 Args : "alternative titles and symbols" [scalar] (optional).
374 sub alternative_titles_and_symbols
{
375 my ( $self, $value ) = @_;
377 if ( defined $value ) {
378 $self->{ "_alternative_titles_and_symbols" } = $value;
381 return $self->{ "_alternative_titles_and_symbols" };
383 } # alternative_titles_and_symbols
388 =head2 more_than_two_genes
390 Title : more_than_two_genes
391 Usage : $omim->more_than_two_genes( 1 );
393 print $omim->more_than_two_genes();
394 Function: This is true if this phenotype can be caused
395 by mutation in any of two or more genes.
396 In OMIM, this is indicated by a number symbol (#)
397 before an entry number (e.g. #114480 -- BREAST CANCER).
399 Args : [1 or 0] (optional).
403 sub more_than_two_genes
{
404 my ( $self, $value ) = @_;
406 if ( defined $value ) {
407 $self->_is_true_or_false( $value );
408 $self->{ "_more_than_two_genes" } = $value;
411 return $self->{ "_more_than_two_genes" };
413 } # more_than_two_genes
421 Usage : $omim->is_separate( 1 );
423 print $omim->is_separate();
424 Function: This is true if the phenotype determined by the gene at
425 the given locus is separate from those represented by
426 other entries where "is_separate" is true and if the mode
427 of inheritance of the phenotype has been proved
428 (in the judgment of the authors and editors).
429 In OMIM, this is indicated by a asterisk (*)
430 before an entry number (e.g. *113705 BREAST CANCER,
433 Args : [1 or 0] (optional).
438 my ( $self, $value ) = @_;
440 if ( defined $value ) {
441 $self->_is_true_or_false( $value );
442 $self->{ "_is_separate" } = $value;
445 return $self->{ "_is_separate" };
452 =head2 mapping_method
454 Title : mapping_method
455 Usage : $omim->mapping_method( "PCR of somatic cell hybrid DNA" );
457 print $omim->mapping_method();
458 Function: Set/get for the mapping method of this OMIM entry.
459 Returns : The mapping method [scalar].
460 Args : The mapping method [scalar] (optional).
466 return $self->{ "_mapping_method" } = shift if(@_);
467 return $self->{ "_mapping_method" };
473 Usage : $omim->gene_status( "C" );
475 print $omim->gene_status();
476 Function: Set/get for the gene status of this OMIM entry.
477 The certainty with which assignment of loci to chromosomes or the linkage
478 between two loci has been established has been graded into the following
480 <L>C = confirmed - observed in at least two laboratories or in several families.
481 <L>P = provisional - based on evidence from one laboratory or one family.
482 <L>I = inconsistent - results of different laboratories disagree.
483 <L>L = limbo - evidence not as strong as that provisional, but included for
484 heuristic reasons. (Same as `tentative'.)
486 Returns : [C, P, I, or L].
487 Args : [C, P, I, or L] (optional).
492 my ( $self, $value ) = @_;
494 if ( defined $value ) {
495 #unless ( $value eq "C"
499 # || $value eq "A" # !?
500 # || $value eq "H" # !?
501 # || $value eq "U" # !?
502 # || $value eq "" ) {
503 # $self->throw( "Found [$value]"
504 # . " where [C, P, I, or L] expected" );
506 unless ( $value eq "C"
514 $self->{ "_gene_status" } = $value;
517 return $self->{ "_gene_status" };
522 =head2 clinical_symptoms
524 Title : clinical_symptoms
525 Usage : $omim->clinical_symptoms({});
526 Function: Set/get for the clinical symptoms of this OMIM entry.
527 Returns : [hash reference].
528 Args : [hash reference]. Suggested not to assign alone. Parser will do.
532 sub clinical_symptoms
{
533 my ( $self, $value ) = @_;
535 if ( defined $value ) {
536 unless(ref($value) eq 'HASH'){
537 $self->throw('a hash referenced needed');
539 $self->{ "_clinical_symptoms" } = $value;
542 return $self->{ "_clinical_symptoms" };
544 } # clinical_symptoms
546 =head2 clinical_symptoms_raw
548 Title : clinical_symptoms_raw
549 Usage : $omim->clinical_symptoms( "Patients with ..." );
550 print $omim->clinical_symptoms();
551 Functions : Get/set for text information of clinical symptoms
552 Returns : The clinical symptoms [scalar].
553 Args : The clinical symptoms [scalar] (optional).
557 sub clinical_symptoms_raw
{
559 return $self->{_clinical_symptoms_raw
} = shift if @_;
560 return $self->{_clinical_symptoms_raw
};
563 =head2 add_clinical_symptoms
565 Title : add_clinical_symptoms
566 Usage : $entry->add_clinical_symptoms('Ears', 'Floppy ears', 'Lop-ears');
567 Function : add one or more symptoms on one part of body.
569 Args : ($part, @symptoms)
570 $part, the text name of part/organism of human
571 @symptoms, an array of text description
575 sub add_clinical_symptoms
{
576 my ($self, $part, @symptoms) = @_;
577 unless(defined $part){
578 $self->throw('a part/organism must be assigned');
580 $self->{_clinical_symptoms
} = {} unless $self->{_clinical_symptoms
};
581 $self->{_clinical_symptoms
}->{$part} = []
582 unless $self->{_clinical_symptoms
}->{$part};
583 push @
{$self->{_clinical_symptoms
}->{$part}}, @symptoms;
586 =head2 query_clinical_symptoms
588 Title : get_clinical_symptoms
589 Usage : @symptoms = $self->query_clinical_symptoms('Ears');
590 Function : get all symptoms specific to one part/organism.
591 Returns : an array of text
596 sub query_clinical_symptoms
{
597 my ($self, $organ)=@_;
598 my $symptoms=$self->{_clinical_symptoms
}->{$organ};
602 sub get_clinical_symptom_organs
{
604 keys %{$self->{_clinical_symptoms
}};
610 Usage : $omim->created( "Victor A. McKusick: 6/4/1986" );
612 print $omim->created();
613 Function: Set/get for the created field of the OMIM database.
614 Returns : Name(s) and date(s) [scalar - free form].
615 Args : Name(s) and date(s) [scalar - free form] (optional).
621 return $self->{ "_created" } = shift if(@_);
622 return $self->{ "_created" };
632 Usage : $omim->contributors( "Kelly A. Przylepa - revised: 03/18/2002" );
634 print $omim->contributors();
635 Function: Set/get for the contributors field of the OMIM database.
636 Returns : Name(s) and date(s) [scalar - free form].
637 Args : Name(s) and date(s) [scalar - free form] (optional).
643 $self->{ "_contributors" } = shift if(@_);
644 return $self->{ "_contributors" };
654 Usage : $omim->edited( "alopez: 06/03/1997" );
656 print $omim->edited();
657 Function: Set/get for the edited field of the OMIM database.
658 Returns : Name(s) and date(s) [scalar - free form].
659 Args : Name(s) and date(s) [scalar - free form] (optional).
665 return $self->{ "_edited" } = shift if(@_);
666 return $self->{ "_edited" };
673 =head2 additional_references
675 Title : additional_references
676 Usage : $omim->additional_references( "Miller er al." );
678 print $omim->additional_references();
679 Function: Set/get for the additional references of this OMIM antry
681 Returns : additional reference [scalar].
682 Args : additional reference [scalar] (optional).
686 sub additional_references
{
688 return $self->{ "_additional_references" } = shift if(@_);
689 return $self->{ "_additional_references" };
691 } # additional_references
696 Usage : $omim->miniMIM( $MM );
698 $MM = $omim->miniMIM();
699 Function: Set/get for the Mini MIM associated with this OMIM antry
701 Returns : [Bio::Phenotype::OMIM::MiniMIMentry].
702 Args : [Bio::Phenotype::OMIM::MiniMIMentry] (optional).
708 my ( $self, $value ) = @_;
710 if ( defined $value ) {
711 $self->_check_ref_type( $value, "Bio::Phenotype::OMIM::MiniMIMentry" );
712 $self->{ "_mini_mim" } = $value;
715 return $self->{ "_mini_mim" };
718 =head2 each_AllelicVariant
720 Title : each_AllelicVariant()
721 Usage : @avs = $obj->each_AllelicVariant();
722 Function: Returns a list of Bio::Phenotype::OMIM::OMIMentryAllelicVariant objects
723 associated with this OMIM entry.
724 Returns : A list of Bio::Phenotype::OMIM::OMIMentryAllelicVariant objects.
729 sub each_AllelicVariant
{
732 return @
{$self->{"_allelic_variants"}} if exists($self->{"_allelic_variants"});
734 } # each_AllelicVariant
737 =head2 add_AllelicVariants
739 Title : add_AllelicVariants
740 Usage : $obj->add_AllelicVariants( @avs );
742 $obj->add_AllelicVariants( $av );
743 Function: Pushes one or more OMIMentryAllelicVariant
744 into the list of OMIMentryAllelicVariants.
746 Args : Bio::Phenotype::OMIM::OMIMentryAllelicVariant object(s).
750 sub add_AllelicVariants
{
751 my ( $self, @values ) = @_;
753 return unless( @values );
755 foreach my $value ( @values ) {
756 $self->_check_ref_type( $value, "Bio::Phenotype::OMIM::OMIMentryAllelicVariant" );
759 push( @
{ $self->{ "_allelic_variants" } }, @values );
761 } # add_AllelicVariants
764 =head2 remove_AllelicVariants
766 Title : remove_AllelicVariants
767 Usage : $obj->remove_AllelicVariants();
768 Function: Deletes (and returns) the list of OMIMentryAllelicVariant objects
769 associated with this OMIM entry.
770 Returns : A list of OMIMentryAllelicVariant objects.
775 sub remove_AllelicVariants
{
778 my @a = $self->each_AllelicVariant();
779 $self->{ "_allelic_variants" } = [];
782 } # remove_AllelicVariants
785 # Title : _array_to_string
789 sub _array_to_string
{
790 my( $self, @value ) = @_;
794 for ( my $i = 0; $i < scalar( @value ); ++$i ) {
795 if ( ! ref( $value[ $i ] ) ) {
796 $s .= "#" . $i . "\n-- Value:\n" . $value[ $i ] . "\n";
798 elsif ( $value[ $i ]->isa( "Bio::Phenotype::OMIM::OMIMentryAllelicVariant" )
799 || $value[ $i ]->isa( "Bio::Phenotype::Correlate" ) ) {
800 $s .= "#" . $i . "\n" . ( $value[ $i ] )->to_string() . "\n";
802 elsif ( $value[ $i ]->isa( "Bio::Annotation::Reference" ) ) {
803 $s .= "#".$i."\n-- Authors:\n".( $value[ $i ] )->authors()."\n";
804 $s .= "-- Title:\n".( $value[ $i ] )->title()."\n";
805 $s .= "-- Location:\n".( $value[ $i ] )->location()."\n";
807 elsif ( $value[ $i ]->isa( "Bio::Map::CytoPosition" ) ) {
808 $s .= "#" . $i . "\n-- Value:\n" . ( $value[ $i ] )->value() . "\n";
817 # Title :_is_true_or_false
818 # Function: Checks whether the argument is 1 or 0.
820 # Args : The value to be checked.
821 sub _is_true_or_false
{
822 my ( $self, $value ) = @_;
823 unless ( $value !~ /\D/ && ( $value == TRUE
|| $value == FALSE
) ) {
824 $self->throw( "Found [" . $value
825 . "] where " . TRUE
. " or " . FALSE
. " expected" );
827 } # _is_true_or_false