Edge.pm

filter: Statementstmt 100% 21 / 21 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 76.7% 33 / 43 CC 7 SCAR 15.7
CC
7
Cov
82%
new
7.0
nodes
2.0
BEGIN
1.0
CRAP 4.8
« Node.pm ↑ Summary IO.pm »
1 #
2 # BioPerl module for Bio::Network::Edge
3 #
4 # You may distribute this module under the same terms as perl itself
5 # POD documentation - main docs before the code
6  
7 =head1 NAME
8  
9 Bio::Network::Edge - holds the names of pairs of Nodes
10  
11 =head1 SYNOPSIS
12  
13 use Bio::Network;
14  
15 # get a network, somehow, then:
16 my @edges = $graph->edges;
17 for my $edge (@edges) {
18 for my $node ($edge->[0],$edge->[1]) {
19 my @proteins = $node->proteins;
20 for my $protein (@proteins) {
21 print "Sequence is: ", $protein->seq, "\n";
22 }
23 }
24 }
25  
26 =head1 DESCRIPTION
27  
28 This class contains the names of the Nodes in a bi-molecular
29 interaction. An Edge object is extremely simple as most of the
30 experimental or biological detail goes into the Interaction
31 objects.
32  
33 =head1 FEEDBACK
34  
35 =head2 Mailing Lists
36  
37 User feedback is an integral part of the evolution of this and other
38 Bioperl modules. Send your comments and suggestions preferably to one
39 of the Bioperl mailing lists. Your participation is much appreciated.
40  
41 bioperl-l@bioperl.org - General discussion
42 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
43  
44 =head2 Support
45  
46 Please direct usage questions or support issues to the mailing list:
47  
48 I<bioperl-l@bioperl.org>
49  
50 rather than to the module maintainer directly. Many experienced and
51 reponsive experts will be able look at the problem and quickly
52 address it. Please include a thorough description of the problem
53 with code and data examples if at all possible.
54  
55 =head2 Reporting Bugs
56  
57 Report bugs to the Bioperl bug tracking system to help us keep track
58 the bugs and their resolution. Bug reports can be submitted via the
59 web:
60  
61 http://bugzilla.open-bio.org/
62  
63 =head1 AUTHORS
64  
65 Brian Osborne bosborne at alum.mit.edu
66 Richard Adams richard.adams@ed.ac.uk
67  
68 Maintained by Brian Osborne
69  
70 =cut
71  
72 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
73 package Bio::Network::Edge;
74 1 ▶use base 'Bio::Root::Root';
Subroutine BEGIN: called CC=1 SCAR=0.0
75  
76 =head2 new
77  
78 Name : new
79 Purpose : Constructor for an Edge object
80 Usage : my $edge = Bio::Network::Edge->new(-nodes => \@nodes);
81 Returns : A new Bio::Network::Edge object
82 Arguments : -nodes => reference to an array containing a
83 pair of Nodes
84  
85 =cut
86  
87 2 ▶sub new {
Subroutine new: called CC=6 SCAR=19.4
Pod documented
88 2 my ($caller,@args) = @_;
89 2 ▶ my $class = ref ($caller) || $caller;
Condition33%1/3
ref $caller || $caller
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $caller || $caller
ref $caller $caller
Truth table33%1/3
A || B
A= ref $callerB= $caller
ABresult
1X1
011
000
90 2 my $self = {};
91 2 bless ($self,$class);
92  
93 2 my ($nodes) = $self->_rearrange([qw( NODES )], @args);
94 2 ▶ $self->throw("You must pass 1 or 2 Nodes to Bio::Network::Edge, not ",
Branch: 1 branch
BranchTrueFalseTotal
if scalar @$nodes == 0 or scalar @$nodes > 2 0 2 2
Condition33%1/3
scalar @$nodes == 0 or scalar @$nodes > 2
l!l&&r!l&&!r
002
MC/DC0%0/2
scalar @$nodes == 0 or scalar @$nodes > 2
scalar @$nodes == 0 scalar @$nodes > 2
Truth table33%1/3
A or B
A= scalar @$nodes == 0B= scalar @$nodes > 2
ABresult
1X1
011
000
95 scalar @$nodes, " nodes") if (scalar @$nodes == 0 || scalar @$nodes > 2);
96 2 for my $node (@$nodes) {
97 3 ▶ $self->throw("You must pass Bio::Network::Node objects to Bio::Network::Edge->new, not ",
Branch: 1 branch
BranchTrueFalseTotal
unless $node->isa("Bio::Network::Node") 0 3 3
98 ref($node), " objects") unless ($node->isa("Bio::Network::Node"));
99 }
100 2 $self->{_nodes} = $nodes;
101 2 return $self;
102 }
103  
104 =head2 nodes
105  
106 Name : nodes
107 Purpose : Get the pair of nodes for an Edge
108 Usage : my $count = $edge->nodes
109 or
110 my @nodes = $edge->nodes
111 Returns : Gets an array of 2 Nodes or a count of the number of
112 Nodes
113 Arguments :
114 Notes : Getting a count of the number of Nodes in an edge will
115 almost always return 2, but there is a formal possibility
116 that a Node could interact with itself, returning 1
117  
118 =cut
119  
120 4 ▶sub nodes {
Subroutine nodes: called CC=2 SCAR=6.9
Pod documented
121 4 my $self = shift;
122 4 my @nodes = @{$self->{_nodes}};
123 4 ▶ wantarray ? return @nodes : return scalar @nodes;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 2 4
124 }
125  
126 1 1;
127  
128 __END__
« Node.pm ↑ Summary IO.pm »