Promoter/Sequence.pm

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 4 / 4 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« Promoter/SaveTypes/RImage.pm ↑ Summary Promoter/Sequences.pm »
1 package BioX::SeqUtils::Promoter::Sequence;
2 ####################################################################
3 # Charles Stephen Embry #
4 # MidSouth Bioinformatics Center #
5 # University of Arkansas Little Rock #
6 ####################################################################
7 1 ▶use base qw(BioX::SeqUtils::Promoter::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 use Class::Std;
9 use Class::Std::Utils;
10  
11 use warnings;
12 use strict;
13 use Carp;
14  
15 use version; our $VERSION = qv('0.1.1');
16  
17 {
18 my %base_list_of :ATTR( :get<base_list> :set<base_list> :default<[]> :init_arg<base_list> );
19 my %color_list_of :ATTR( :get<color_list> :set<color_list> :default<[]> :init_arg<color_list> );
20 my %label_of :ATTR( :get<label> :set<label> :default<''> :init_arg<label> );
21
22  
23  
24  
25 sub BUILD {
26 my ($self, $ident, $arg_ref) = @_;
27
28  
29 return;
30 }
31  
32 sub START {
33 my ($self, $ident, $arg_ref) = @_;
34 #assigned default value
35 my $sequence = defined $arg_ref->{sequence} ? $arg_ref->{sequence} : '';
36 #splits a list on every character
37 my @sequence = split('',$sequence);
38 #reference a list
39 $self->set_base_list(\@sequence);
40 return;
41 }
42
43 sub get_sequence {
44 my ($self, $arg_ref) = @_;
45 my $base_list = $self->get_base_list();
46 #returns the list of nucleotides as a single string
47 return join('',@$base_list);
48 }
49
50 sub get_labels {
51 my ($self, $arg_ref) = @_;
52 my $label = $self->get_label();
53 return join('',@$label);
54 }
55 sub add_segment {
56 my ($self, $arg_ref) = @_;
57 #takes a sequence and adds it to base_list
58 my $sequence = defined $arg_ref->{sequence} ? $arg_ref->{sequence} : '';
59 my @sequence = split('',$sequence);
60  
61 my $base_list = $self->get_base_list();
62 my @base_list = @$base_list;
63  
64 push @base_list, @sequence;
65 $self->set_base_list(\@base_list);
66 }
67  
68 sub set_color {
69 my ($self, $arg_ref) = @_;
70  
71 my $bases = defined $arg_ref->{bases} ? $arg_ref->{bases} : '';
72 my $colors = defined $arg_ref->{colors} ? $arg_ref->{colors} : '';
73
74 my $color_list = $self->get_color_list({colors => $colors});
75
76 my $count = @$bases;
77 for (my $i = 0; $i< $count; $i++) {
78 my $base = $bases->[$i];
79 my $color = $colors->[$i];
80 $color_list->[$base] = $color;
81
82 }
83  
84 $self->set_color_list($color_list);
85 #color list will be used to give each character from a mulitple alignment file a color
86 return;
87 }
88  
89 sub add_tag {
90 my ($self, $arg_ref) = @_;
91 my $tag = defined $arg_ref->{tag} ? $arg_ref->{tag} : '';
92 my @tag = split('',$tag);
93  
94 my $label = $self->get_label();
95 my @label = @$label;
96  
97 push @label, @tag;
98 $self->set_label(\@label);
99 }
100  
101  
102 }
103  
104 1; # Magic true value required at end of module
105 __END__
« Promoter/SaveTypes/RImage.pm ↑ Summary Promoter/Sequences.pm »