line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::ConnectDots::DotSet; |
2
|
2
|
|
|
2
|
|
46298
|
use vars qw(@ISA @AUTO_ATTRIBUTES @OTHER_ATTRIBUTES %SYNONYMS); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
239
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
674
|
use Bio::ConnectDots::Connector; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
60
|
|
5
|
2
|
|
|
2
|
|
2470
|
use Bio::ConnectDots::Dot; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
87
|
|
6
|
2
|
|
|
2
|
|
15
|
use Class::AutoClass; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2197
|
|
7
|
|
|
|
|
|
|
@ISA = qw(Class::AutoClass); # AutoClass must be first!! |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@AUTO_ATTRIBUTES=qw(name db db_id _id2dot); |
10
|
|
|
|
|
|
|
@OTHER_ATTRIBUTES=qw(); |
11
|
|
|
|
|
|
|
%SYNONYMS=(); |
12
|
|
|
|
|
|
|
Class::AutoClass::declare(__PACKAGE__); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _init_self { |
15
|
2
|
|
|
2
|
|
960
|
my($self,$class,$args)=@_; |
16
|
2
|
50
|
|
|
|
12
|
return unless $class eq __PACKAGE__; # to prevent subclasses from re-running this |
17
|
2
|
50
|
|
|
|
76
|
return if $self->db_id; # already fetched |
18
|
2
|
50
|
|
|
|
88
|
return unless $self->db; |
19
|
0
|
|
|
|
|
0
|
my $saved=Bio::ConnectDots::DB::DotSet->get($self); |
20
|
0
|
0
|
|
|
|
0
|
unless ($saved) { |
21
|
0
|
|
|
|
|
0
|
Bio::ConnectDots::DB::DotSet->put($self); |
22
|
|
|
|
|
|
|
} else { # copy relevant attributes from db object to self |
23
|
0
|
|
|
|
|
0
|
$self->db_id($saved->db_id); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
sub id2dot { |
27
|
12
|
|
|
12
|
0
|
1604
|
my $self=shift; |
28
|
12
|
|
66
|
|
|
424
|
my $id2dot=$self->_id2dot || $self->_id2dot({}); |
29
|
12
|
100
|
33
|
|
|
209
|
if (@_==0) { |
|
|
50
|
66
|
|
|
|
|
|
|
100
|
|
|
|
|
|
30
|
2
|
50
|
|
|
|
9
|
return wantarray? %$id2dot: $id2dot; |
31
|
|
|
|
|
|
|
} elsif (@_==1 && ('HASH' eq ref $_[0] || !defined $_[0])) { |
32
|
0
|
|
|
|
|
0
|
my $result=$self->_id2dot($_[0]); |
33
|
0
|
0
|
|
|
|
0
|
return wantarray? %$result: $result; |
34
|
|
|
|
|
|
|
} elsif (@_==1) { |
35
|
6
|
|
|
|
|
19
|
return $id2dot->{$_[0]}; |
36
|
|
|
|
|
|
|
} else { |
37
|
4
|
|
|
|
|
18
|
return $id2dot->{$_[0]}=$_[1]; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
sub instances { |
41
|
1
|
|
|
1
|
0
|
473
|
my($self)=@_; |
42
|
1
|
|
|
|
|
3
|
my $id2dot=$self->id2dot; |
43
|
1
|
|
|
|
|
4
|
my @instances=values %$id2dot; |
44
|
1
|
50
|
|
|
|
7
|
wantarray? @instances: [@instances]; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
sub lookup_connect { |
47
|
1
|
|
|
1
|
0
|
33
|
my($self,$id,$connector)=@_; |
48
|
1
|
|
|
|
|
3
|
my $dot=$self->id2dot($id); |
49
|
1
|
50
|
|
|
|
5
|
unless ($dot) { |
50
|
0
|
|
|
|
|
0
|
$dot=new Dot(-id=>$id); |
51
|
0
|
|
|
|
|
0
|
$self->id2dot($id,$dot); |
52
|
|
|
|
|
|
|
} |
53
|
1
|
|
|
|
|
6
|
$dot->put($connector); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
sub lookup { |
56
|
4
|
|
|
4
|
0
|
449
|
my($self,$id)=@_; |
57
|
4
|
|
|
|
|
9
|
my $dot=$self->id2dot($id); |
58
|
4
|
50
|
|
|
|
15
|
unless ($dot) { |
59
|
0
|
|
|
|
|
0
|
$dot=new Bio::ConnectDots::Dot(-id=>$id); |
60
|
0
|
|
|
|
|
0
|
$self->id2dot($id,$dot); |
61
|
|
|
|
|
|
|
} |
62
|
4
|
|
|
|
|
17
|
$dot; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
1; |