Promoter/Alignment.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/Text.pm ↑ Summary Promoter/Annotations.pm »
1 package BioX::SeqUtils::Promoter::Alignment;
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 use BioX::SeqUtils::Promoter::Sequences;
11 use BioX::SeqUtils::Promoter::Annotations;
12 use BioX::SeqUtils::Promoter::Annotations::Consensus;
13 use BioX::SeqUtils::Promoter::SaveTypes;
14 use warnings;
15 use strict;
16 use Carp;
17 use Bio::Perl;
18 use Bio::Seq;
19 use Bio::SeqIO;
20 use Bio::Tools::Run::Alignment::TCoffee;
21  
22 use version; our $VERSION = qv('0.1.1');
23  
24 {
25 my %sequences_of :ATTR( :get<sequences> :set<sequences> :default<''> :init_arg<sequences> );
26
27 sub BUILD {
28 my ($self, $ident, $arg_ref) = @_;
29
30
31 return;
32 }
33  
34 sub START {
35 my ($self, $ident, $arg_ref) = @_;
36 my $sequences = BioX::SeqUtils::Promoter::Sequences->new();
37 $self->set_sequences($sequences);
38 return;
39 }
40  
41 sub annotate {
42 my ($self, $arg_ref) = @_;
43 my $filename = defined $arg_ref->{filename} ? $arg_ref->{filename} : '';
44 my $annotations = BioX::SeqUtils::Promoter::Annotations->new({type => 'Consensus', motifs => $self->get_default_motifs() });
45 $annotations->print_motifs();
46
47 return;
48 }
49  
50 sub m_align {
51 my ($self, $arg_ref) = @_;
52 #a file of fasta sequences will be a parameter
53 my $afilename = defined $arg_ref->{afilename} ? $arg_ref->{afilename} : '';
54 #matrix used multiple alignment, can be Pam, Blosum or none
55 my $matrix = defined $arg_ref->{matrix} ? $arg_ref->{matrix} : '';
56 #the pentaly for opening a gap in the alignment
57 my $gap_open = defined $arg_ref->{gap_open} ? $arg_ref->{gap_open} : '';
58 #the pentaly for exiting a gap
59 my $gap_ext = defined $arg_ref->{gap_ext} ? $arg_ref->{gap_ext} : '';
60 #name and location of output file
61 my $outfile = '/home/stephen/BioCapstone/BioX-SeqUtils-Promoter/data/tnrab1000';
62 # Build a tcoffee alignment factory
63 #my @params = ('ktuple' => 2, 'matrix' => 'BLOSUM', 'OUTFILE' => tnrab1000.aln );
64 my @params = ('ktuple' => 2, 'matrix' => $matrix, 'GAPOPEN' => $gap_open, 'GAPEXT' => $gap_ext, 'OUTFILE' => $outfile);
65 #my @params = ('ktuple' => 2, 'matrix' => 'Pam', 'GAPOPEN' => 10, 'GAPEXT' => 2, 'OUTFILE' => p_GO10GE2_hexr );
66 #my @params = ('ktuple' => 2, 'matrix' => 'BLOSUM', 'OUTFILE' => $outfile);
67 # feed a list of parameters to Tcoffee
68 my $factory = Bio::Tools::Run::Alignment::TCoffee->new(@params);
69 # Pass the factory a list of sequences to be aligned.
70 # $aln is a SimpleAlign object.
71 my $aln = $factory->align($afilename);
72
73 return;
74 }
75  
76 sub load_alignmentfile {
77 my ($self, $arg_ref) = @_;
78 #load a output file from a multiple sequence alignment
79 my $filename = defined $arg_ref->{filename} ? $arg_ref->{filename} : '';
80 my $text;
81 #my $line;
82 my $sequences = $self->get_sequences();
83  
84 open(IN,"<$filename");
85
86 # takes each gene name and uses it as a key for a hash and the data for teh values
87 <IN>;
88 while($text = <IN>){
89 if($text) {
90 #if($text =~/^$|^\s/){print "blank line\n"; next;}
91 if($text =~/^$|^\s/){next;}
92 my ($key, $value) = split /\s+/, $text;
93 $sequences->add_segment({label => $key, sequence => $value});
94 }
95 }
96 my $seqs = $sequences->get_sequences();
97 foreach my $key (keys %$seqs ){ print $seqs->{$key}->get_sequence(),"\n"; }
98  
99 return;
100 }
101  
102 }
103  
104 1; # Magic true value required at end of module
105 __END__
« Promoter/SaveTypes/Text.pm ↑ Summary Promoter/Annotations.pm »