These documents are For the HEAD of the CVS repository on July 19, 2007 Api docs for previous releases

Modware

Has_synonyms

Summary Package variables Synopsis Description General documentation Methods

Summary
   Modware::Has_synonyms - Mixin class, provides accessor methods for classes tha have synonyms.
Package variables top
No package variables defined.
Synopsistop
  USE CASE: ADD A SYNONYM TO OBJECT

my $gene = new Modware::Gene( -name => 'testGene' );
$gene->add_synoym( 'new synonym' );


USE CASE: PRINT A LIST OF SYNONYMS FOR OBJECT

my $gene = new Modware::Gene( -name => 'testGene' );

foreach $synonym ( @{ $gene->synonyms() } ) {
print $synonym."\n";
}
Descriptiontop
  Abstract class to provide methods for objects which carry arrays of synonyms
Never instantiate this object, only inherit

All database operations are handled in the implementing class
for example see _get_synonyms and _update_synonyms in
Modware::Feature::GENE

_update_synonyms must be called in both the insert() and update()
method of the implementor.
Methodstop
_get_synonymsDescriptionCode
_update_synonymsDescriptionCode
add_synonymDescriptionCode
remove_synonymDescriptionCode
synonymsDescriptionCode

Methods description

_get_synonymscodetopprevnext
 Title    : _get_synonyms
Usage : $gene->_get_synonyms();
Function : gets the synonyms for this gene ( arrayref of strings )
Returns : nothing
Args : none
_update_synonymscodetopprevnext
 Title    : _update_synonyms
Function : adds/links/unlinks synonyms from this gene
: compares list from database to current gene product list, inserts/deletes as necessary
Returns : nothing
Args : none
add_synonymcodetopprevnext
 Title    : add_synonym
Usage : $gene->add_synonym( 'test synonym' );
Function : adds an synonym to the synonym array IF IT DOES NOT EXIST
Returns : nothing
Args : string
TO DO : need to add second argument (is_automated) to set the is automated property of a new gene product
remove_synonymcodetopprevnext
 Title    : remove_synonym
Usage : $gene->remove_synonym( 'test product' );
Function : removes a synonym the synonyms array if the synonym_name matches
Returns : nothing
Args : string
synonymscodetopprevnext
 Title    : synonyms
Usage : foreach my $synonym ( @{ $gene->synonyms() ) {
: print $synonym."\n";
: }
Function : get/set synonyms for this gene
Returns : reference to array of strings
Args : reference to array of strings ( optional )

Methods code

_get_synonymsdescriptiontopprevnext
sub _get_synonyms {
   my ($self) = @_;
   $self->throw_not_implemented();
}
_update_synonymsdescriptiontopprevnext
sub _update_synonyms {
   my ($self, @args) = @_;
   $self->throw_not_implemented();
}
add_synonymdescriptiontopprevnext
sub add_synonym {
   my ($self, $synonym_name ) = @_;

   $self->throw( "need synonym to add") if !$synonym_name;

   if ( !grep { $_ eq $synonym_name } @{ $self->synonyms() } ) {
      push @{ $self->synonyms }, $synonym_name;
   }
}
remove_synonymdescriptiontopprevnext
sub remove_synonym {
   my ($self, $synonym_name) = @_;

   $self->throw( "need synonym to remove") if !$synonym_name;

   my @synonyms = grep { $_ ne $synonym_name } @{ $self->synonyms() };

   $self->synonyms (\@ synonyms );
}
synonymsdescriptiontopprevnext
sub synonyms {
   my ($self, $obj) = @_;

  #
# fetches synonyms from database (_get_synonyms) if synonyms is not yet defined
# and the user is not attempting to set the synonyms options
#
exists $self->{synonyms} || scalar @_ > 1 || $self->_get_synonyms(); if(scalar @_ > 1) { $self->{synonyms} = $obj; } return $self->{synonyms};
}

General documentation

AUTHOR - Eric Just top
   Eric Just e-just@northwestern.edu
APPENDIX top
   The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _