Bio::Ontology Relationship
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Relationship - a relationship for an ontology
Package variables
No package variables defined.
Included modules
Bio::Ontology::RelationshipI
Bio::Ontology::TermI
Bio::Root::Root
Inherit
Bio::Ontology::RelationshipI
Synopsis
  $rel = Bio::Ontology::Relationship->new( -identifier        => "16847",
                                           -parent_term       => $parent,
                                           -child_term        => $child,
                                           -relationship_type => $type );
Description
This is a basic implementation of Bio::Ontology::RelationshipI.
Methods
newDescriptionCode
initDescriptionCode
identifierDescriptionCode
parent_termDescriptionCode
child_termDescriptionCode
relationship_typeDescriptionCode
to_stringDescriptionCode
_check_class
No description
Code
Methods description
newcode    nextTop
 Title   : new
 Usage   : $rel = Bio::Ontology::Relationship->new( -identifier        => "16847",
                                                    -parent_term       => $parent,
                                                    -child_term        => $child,
                                                    -relationship_type => $type );                   
 Function: Creates a new Bio::Ontology::Relationship.
 Returns : A new Bio::Ontology::Relationship object.
 Args    : -identifier            => the identifier of this relationship [scalar]
           -parent_term           => the parent term [Bio::Ontology::TermI]
           -child_term            => the child term [Bio::Ontology::TermI]  
           -relationship_type     => the relationship type [Bio::Ontology::TermI]
initcodeprevnextTop
 Title   : init()
 Usage   : $rel->init();   
 Function: Initializes this Relationship to all undef.
 Returns : 
 Args    :
identifiercodeprevnextTop
 Title   : identifier
 Usage   : $rel->identifier( "100050" );
           or
           print $rel->identifier();
 Function: Set/get for the identifier of this Relationship.
 Returns : The identifier [scalar].
 Args    : The identifier [scalar] (optional).
parent_termcodeprevnextTop
 Title   : parent_term
 Usage   : $rel->parent_term( $parent );
           or
           $parent = $rel->parent_term();
 Function: Set/get for the parent term of this Relationship.
 Returns : The parent term [Bio::Ontology::TermI].
 Args    : The parent term [Bio::Ontology::TermI] (optional).
child_termcodeprevnextTop
 Title   : child_term
 Usage   : $rel->child_term( $child );
           or
           $child = $rel->child_term();
 Function: Set/get for the child term of this Relationship.
 Returns : The child term [Bio::Ontology::TermI].
 Args    : The child term [Bio::Ontology::TermI] (optional).
relationship_typecodeprevnextTop
 Title   : relationship_type
 Usage   : $rel->relationship_type( $type );
           or
           $type = $rel->relationship_type();
 Function: Set/get for the relationship type of this relationship.
 Returns : The relationship type [Bio::Ontology::TermI].
 Args    : The relationship type [Bio::Ontology::TermI] (optional).
to_stringcodeprevnextTop
 Title   : to_string()
 Usage   : print $rel->to_string();
 Function: to_string method for Relationship.
 Returns : A string representation of this Relationship.
 Args    :
Methods code
newdescriptionprevnextTop
sub new {
    my( $class, @args ) = @_;
    
    my $self = $class->SUPER::new( @args );
   
    my ( $identifier,
         $parent_term,
         $child_term,
         $relationship_type )
    = $self->_rearrange( [ qw( IDENTIFIER
                               PARENT_TERM
                               CHILD_TERM
                               RELATIONSHIP_TYPE ) ], @args );
   
    $self->init(); 
    
    $identifier        && $self->identifier( $identifier );
    $parent_term       && $self->parent_term( $parent_term );
    $child_term        && $self->child_term( $child_term );
    $relationship_type && $self->relationship_type( $relationship_type );   
                                                    
    return $self;
    
} # new
}
initdescriptionprevnextTop
sub init {
   my( $self ) = @_;

    $self->{ "_identifier" }        = undef;
    $self->{ "_parent_term" }       = undef;
    $self->{ "_child_term" }        = undef;
    $self->{ "_relationship_type" } = undef;
  
} # init
}
identifierdescriptionprevnextTop
sub identifier {
    my ( $self, $value ) = @_;

    if ( defined $value ) {
        $self->{ "_identifier" } = $value;
    }

    return $self->{ "_identifier" };
} # identifier
}
parent_termdescriptionprevnextTop
sub parent_term {
    my ( $self, $term ) = @_;
  
    if ( defined $term ) {
        $self->_check_class( $term, "Bio::Ontology::TermI" );
        $self->{ "_parent_term" } = $term;
    }

    return $self->{ "_parent_term" };
    
} # parent_term
}
child_termdescriptionprevnextTop
sub child_term {
    my ( $self, $term ) = @_;
  
    if ( defined $term ) {
        $self->_check_class( $term, "Bio::Ontology::TermI" );
        $self->{ "_child_term" } = $term;
    }

    return $self->{ "_child_term" };
}
relationship_typedescriptionprevnextTop
sub relationship_type {
    my ( $self, $term ) = @_;
  
    if ( defined $term ) {
        $self->_check_class( $term, "Bio::Ontology::TermI" );
        $self->{ "_relationship_type" } = $term;
    }

    return $self->{ "_relationship_type" };
}
to_stringdescriptionprevnextTop
sub to_string {
    my( $self ) = @_;
    
    local $^W = 0;

    my $s = "";

    $s .= "-- Identifier:\n";
    $s .= $self->identifier()."\n";
    $s .= "-- Parent Term Identifier:\n";
    $s .= $self->parent_term()->identifier()."\n";
    $s .= "-- Child Term Identifier:\n";
    $s .= $self->child_term()->identifier()."\n";
    $s .= "-- Relationship Type Identifier:\n";
    $s .= $self->relationship_type()->identifier();
    
    return $s;
    
} # to_string
}
_check_classdescriptionprevnextTop
sub _check_class {
    my ( $self, $value, $expected_class ) = @_;
    
    if ( ! defined( $value ) ) {
        $self->throw( "Found [undef] where [$expected_class] expected" );
    }
    elsif ( ! ref( $value ) ) {
        $self->throw( "Found [scalar] where [$expected_class] expected" );
    } 
    elsif ( ! $value->isa( $expected_class ) ) {
        $self->throw( "Found [" . ref( $value ) . "] where [$expected_class] expected" );
    }    

} # _check_type
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to the
Bioperl mailing lists Your participation is much appreciated.
  bioperl-l@bioperl.org                         - General discussion
  http://bio.perl.org/MailList.html             - About the mailing lists
Reporting BugsTop
report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via
email or the web:
  bioperl-bugs@bio.perl.org
  http://bio.perl.org/bioperl-bugs/
AUTHORTop
Christian M. Zmasek
Email: czmasek@gnf.org or cmzmasek@yahoo.com
WWW: http://www.genetics.wustl.edu/eddy/people/zmasek/
Address:
  Genomics Institute of the Novartis Research Foundation
  10675 John Jay Hopkins Drive
  San Diego, CA 92121
APPENDIXTop
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _