Bio::Network
Interaction
Toolbar
Summary
Bio::Network::Interaction - describes a protein-protein interaction
Package variables
No package variables defined.
Inherit
Bio::AnnotatableI Bio::Annotation::Collection Bio::Root::Root
Synopsis
# Add an interaction with some attributes
use Bio::Network::Interaction;
my $interx = Bio::Network::Interaction->new(-weight => $score,
-id => $id);
$gr->add_interaction(-nodes => [($node1,$node2)],
-interaction => $interx);
# Retrieve an interaction using an identifier
my $interaction = $gr->get_interaction_by_id($id);
my $id = $interaction->primary_id;
my $wt = $interaction->weight;
my @nodes = $interaction->nodes;
Description
This class contains information about a bi-molecular interaction.
At present it just contains data about a weight (optional) and an
identifier. Subclasses could hold more specific information. A pair
of nodes can have more than one Interaction object associated with it.
Methods
Methods description
Name : new Purpose : Constructor for an Interaction object Usage : my $interx = Bio::Network::Interaction->new(-id => $id); Returns : A new Bio::Network::Interaction object Arguments : -id => interaction id -weight (optional) => weight score |
Name : weight Purpose : Get or set a weight or score Usage : my $weight = $interx->weight() or $interx->weight(3) Returns : a number Arguments : Nothing or a number |
Name : primary_id Purpose : Get or set the primary_id Usage : my $id = $interx->primary_id() or $interx->primary_id("SIB4") Returns : A string identifier Arguments : Nothing or an identifier |
Name : nodes Purpose : Get the pair of nodes for an Interaction Usage : my $count = $interx->nodes or my @nodes = $interx->nodes Returns : Gets an array of 2 Nodes or a count of the number of Nodes Arguments : Notes : Getting a count of the number of Nodes in an Interaction will almost always return 2, but there is a formal possibility that a Node could interact with itself, returning 1 |
Title : annotation Usage : my $annotation = $ix->annotation or $ix->annotation($annotation) Function: Gets or sets the annotation Returns : Bio::AnnotationCollectionI object Args : None or Bio::AnnotationCollectionI object
See Bio::AnnotationCollectionI and Bio::Annotation::Collection for more information |
Name : object_id Purpose : Alias to primary_id Usage : my $id = $edge->object_id() Notes : Deprecated |
Methods code
sub new
{ my ($caller,@args) = @_;
my $class = ref ($caller) || $caller;
my $self = {};
bless ($self, $class);
my ($weight,$id) = $self->_rearrange([qw( WEIGHT ID )], @args);
$self->{_weight} = defined($weight) ? $weight : undef;
$self->{_id} = defined($id) ? $id : undef;
return $self;} |
sub weight
{ my $self = shift;
$self->{_weight} = shift if @_;
return defined($self->{_weight}) ? $self->{_weight} : undef;} |
sub primary_id
{ my $self = shift;
if (@_) {
my $v = shift;
$self->throw ("Primary interaction ID must be a text value, not a [" .
ref($v). "].") if (ref ($v));
$self->{_id} = $v;
}
return defined($self->{_id}) ? $self->{_id} : undef;} |
sub nodes
{ my $self = shift;
my @nodes = @{$self->{_nodes}};
wantarray ? return @nodes : return scalar @nodes;} |
sub annotation
{ my ($obj,$value) = @_;
if ( defined $value ) {
$obj->throw("Object of class " . ref($value) . " does not implement ".
"Bio::AnnotationCollectionI.")
unless $value->isa("Bio::AnnotationCollectionI");
$obj->{'_annotation'} = $value;
} elsif( ! defined $obj->{'_annotation'}) {
$obj->{'_annotation'} = Bio::Annotation::Collection->new();
}
return $obj->{'_annotation'};} |
sub object_id
{ my ($self,$id) = @_;
$id ? $self->primary_id($id) : return $self->primary_id;
}
1;
__END__ } |
General documentation
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
http://bugzilla.open-bio.org/