BioPerl

 view release on metacpan or  search on metacpan

Bio/Phenotype/Phenotype.pm  view on Meta::CPAN

 Title   : add_Genotypes
 Usage   : $obj->add_Genotypes( @gts );
           or
           $obj->add_Genotypes( $gt );                  
 Function: Pushes one or more "Genotypes"
           into the list of "Genotypes".
 Returns : 
 Args    : "Genotypes(s)".

=cut

sub add_Genotypes {
    my ( $self, @values ) = @_;
    
    return unless( @values );

    #foreach my $value ( @values ) {  
    #    $self->_check_ref_type( $value, "Bio::GenotypeI" );
    #}
        
    push( @{ $self->{ "_genotypes" } }, @values );
    
} # add_Genotypes


=head2 remove_Genotypes

 Title   : remove_Genotypes
 Usage   : $obj->remove_Genotypes();
 Function: Deletes (and returns) the list of "Genotype" objects
           associated with this phenotype.
 Returns : A list of "Genotype" objects.
 Args    :

=cut

sub remove_Genotypes {
    my ( $self ) = @_;

    my @a = $self->each_Genotype();
    $self->{ "_genotypes" } = [];
    return @a;

} # remove_Genotypes


=head2 _check_ref_type

 Title   : _check_ref_type
 Usage   : $self->_check_ref_type( $value, "Bio::Annotation::DBLink" );
 Function: Checks for the correct type.
 Returns : 
 Args    : The value to be checked, the expected class.

=cut

sub _check_ref_type {
    my ( $self, $value, $expected_class ) = @_;

    if ( ! defined( $value ) ) {
        $self->throw( ( caller( 1 ) )[ 3 ] .": Found [undef" 
        ."] where [$expected_class] expected" );
    }
    elsif ( ! ref( $value ) ) {
        $self->throw( ( caller( 1 ) )[ 3 ] .": Found scalar"
        ." where [$expected_class] expected" );
    } 
    elsif ( ! $value->isa( $expected_class ) ) {
        $self->throw( ( caller( 1 ) )[ 3 ] .": Found [". ref( $value ) 
        ."] where [$expected_class] expected" );
    }    
} # _check_ref_type



1;



( run in 4.490 seconds using v1.01-cache-2.11-cpan-d8267643d1d )