line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::SeqUtils::Promoter::Sequences; |
2
|
|
|
|
|
|
|
#################################################################### |
3
|
|
|
|
|
|
|
# Charles Stephen Embry # |
4
|
|
|
|
|
|
|
# MidSouth Bioinformatics Center # |
5
|
|
|
|
|
|
|
# University of Arkansas Little Rock # |
6
|
|
|
|
|
|
|
#################################################################### |
7
|
2
|
|
|
2
|
|
29252
|
use base qw(BioX::SeqUtils::Promoter::Base); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
875
|
|
8
|
|
|
|
|
|
|
use Class::Std; |
9
|
|
|
|
|
|
|
use Class::Std::Utils; |
10
|
|
|
|
|
|
|
use BioX::SeqUtils::Promoter::Sequence; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use warnings; |
13
|
|
|
|
|
|
|
use strict; |
14
|
|
|
|
|
|
|
use Carp; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use version; our $VERSION = qv('0.1.1'); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
my %sequences_of :ATTR( :get :set :default<{}> :init_arg ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub BUILD { |
22
|
|
|
|
|
|
|
my ($self, $ident, $arg_ref) = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub START { |
29
|
|
|
|
|
|
|
my ($self, $ident, $arg_ref) = @_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add_sequence { |
36
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
37
|
|
|
|
|
|
|
my $sequence = defined $arg_ref->{sequence} ? $arg_ref->{sequence} : ''; |
38
|
|
|
|
|
|
|
my $label = defined $arg_ref->{label} ? $arg_ref->{label} : ''; |
39
|
|
|
|
|
|
|
my $seqobj = $self->get_sequence({label => $label}); |
40
|
|
|
|
|
|
|
if (! $seqobj) { |
41
|
|
|
|
|
|
|
#if seequnece object with this label does not exist this creates one |
42
|
|
|
|
|
|
|
$seqobj = BioX::SeqUtils::Promoter::Sequence->new($arg_ref); |
43
|
|
|
|
|
|
|
my $sequences = $self->get_sequences(); |
44
|
|
|
|
|
|
|
$sequences->{$label} = $seqobj; |
45
|
|
|
|
|
|
|
$self->set_sequences($sequences); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_dna { |
51
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
52
|
|
|
|
|
|
|
my $sequences = $self->get_sequences(); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return join('',@$sequences); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub get_objects { |
58
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
59
|
|
|
|
|
|
|
my $objects = $self->get_sequences(); |
60
|
|
|
|
|
|
|
my @objects = values %$objects; |
61
|
|
|
|
|
|
|
#returns actual objects and not reference for use by other objects |
62
|
|
|
|
|
|
|
return @objects; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub add_segment { |
66
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
67
|
|
|
|
|
|
|
my $sequence = defined $arg_ref->{sequence} ? $arg_ref->{sequence} : ''; |
68
|
|
|
|
|
|
|
my $label = defined $arg_ref->{label} ? $arg_ref->{label} : ''; |
69
|
|
|
|
|
|
|
#adds a segment of dna data to a sequence object |
70
|
|
|
|
|
|
|
my $seqobj = $self->get_sequence({label => $label}); |
71
|
|
|
|
|
|
|
if ($seqobj) { |
72
|
|
|
|
|
|
|
$seqobj->add_segment({sequence => $sequence}); |
73
|
|
|
|
|
|
|
my $sequences = $self->get_sequences(); |
74
|
|
|
|
|
|
|
$sequences->{$label} = $seqobj; |
75
|
|
|
|
|
|
|
$self->set_sequences($sequences); |
76
|
|
|
|
|
|
|
} else { |
77
|
|
|
|
|
|
|
$self->add_sequence($arg_ref); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
return; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub set_color { |
83
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
84
|
|
|
|
|
|
|
my $bases = defined $arg_ref->{bases} ? $arg_ref->{bases} : ''; |
85
|
|
|
|
|
|
|
my $colors = defined $arg_ref->{colors} ? $arg_ref->{colors} : ''; |
86
|
|
|
|
|
|
|
#label identifies which sequence object in this collection object to set color |
87
|
|
|
|
|
|
|
my $label = defined $arg_ref->{label} ? $arg_ref->{label} : ''; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $colorobj = $self->get_sequence({label => $label}); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
if (! $colorobj) { $colorobj = $self->add_sequence($arg_ref); } |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$colorobj->set_color({bases => $bases, colors => $colors}); |
94
|
|
|
|
|
|
|
my $sequences = $self->get_sequences(); |
95
|
|
|
|
|
|
|
$sequences->{$label} = $colorobj; $self->set_sequences($sequences); |
96
|
|
|
|
|
|
|
#sets color list in a sequence object |
97
|
|
|
|
|
|
|
return; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub get_sequence { |
101
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
102
|
|
|
|
|
|
|
my $label = defined $arg_ref->{label} ? $arg_ref->{label} : ''; |
103
|
|
|
|
|
|
|
my $found; |
104
|
|
|
|
|
|
|
my $sequences = $self->get_sequences(); |
105
|
|
|
|
|
|
|
foreach my $key (keys %$sequences ){ |
106
|
|
|
|
|
|
|
if ($key eq $label){ |
107
|
|
|
|
|
|
|
$found = $sequences->{$key}; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
#returns a sequence from a seqeunce object |
111
|
|
|
|
|
|
|
return $found; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
116
|
|
|
|
|
|
|
__END__ |