| 1 | package Seeder::Background; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Seeder qw(:all); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Bio::SeqIO; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Algorithm::Loops qw(NestedLoops); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use List::MoreUtils; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | our @EXPORT; | |||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||
| 15 | 'all' => [ | ||||||||||||||||||||||||||||||||||||||||||
| 16 | qw( | ||||||||||||||||||||||||||||||||||||||||||
| 17 | new | ||||||||||||||||||||||||||||||||||||||||||
| 18 | get_background | ||||||||||||||||||||||||||||||||||||||||||
| 19 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 20 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | Seeder::Background - Background object | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | Version 0.01 | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | This module provides the get_background method. | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | use Seeder::Background; | ||||||||||||||||||||||||||||||||||||||||||
| 43 | my $background = Seeder::Background->new( | ||||||||||||||||||||||||||||||||||||||||||
| 44 | seed_width => "6", | ||||||||||||||||||||||||||||||||||||||||||
| 45 | hd_index_file => "6.index", | ||||||||||||||||||||||||||||||||||||||||||
| 46 | seq_file => "seq.fasta", | ||||||||||||||||||||||||||||||||||||||||||
| 47 | out_file => "seq.bkgd", | ||||||||||||||||||||||||||||||||||||||||||
| 48 | strand => "forward", | ||||||||||||||||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 50 | $background -> get_background; | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | =head1 EXPORT | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | None by default | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 61 | Usage : my $background = Seeder::Background->new(%args); | ||||||||||||||||||||||||||||||||||||||||||
| 62 | Function: constructor for the Seeder::Background object | ||||||||||||||||||||||||||||||||||||||||||
| 63 | Returns : new Seeder::Background object | ||||||||||||||||||||||||||||||||||||||||||
| 64 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 65 | seed_width # Seed width | ||||||||||||||||||||||||||||||||||||||||||
| 66 | hd_index_file # Index file | ||||||||||||||||||||||||||||||||||||||||||
| 67 | seq_file # Sequence file | ||||||||||||||||||||||||||||||||||||||||||
| 68 | out_file # Output file | ||||||||||||||||||||||||||||||||||||||||||
| 69 | strand # Strand (forward or revcom) | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | my ( $class, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | my $self; | |||||||||||||||||||||||||||||||||||||||||
| 76 | $self->{seed_width} = | ||||||||||||||||||||||||||||||||||||||||||
| 77 | ( ( defined $args{seed_width} ) | ||||||||||||||||||||||||||||||||||||||||||
| 78 | && ( $args{seed_width} >= 6 ) | ||||||||||||||||||||||||||||||||||||||||||
| 79 | && ( $args{seed_width} <= 8 ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 80 | ? $args{seed_width} | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | : croak "Please define a seed width between 6 and 8!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $args{"seed_width"} and $args{"seed_width"} >= 6 and $args{"seed_width"} <= 8
defined $args{"seed_width"} and $args{"seed_width"} >= 6
MC/DC0%0/3
defined $args{"seed_width"} and $args{"seed_width"} >= 6 and $args{"seed_width"} <= 8
defined $args{"seed_width"}
$args{"seed_width"} >= 6
$args{"seed_width"} <= 8
Truth table25%1/4
A and B and C
A= defined $args{"seed_width"}B= $args{"seed_width"} >= 6C= $args{"seed_width"} <= 8
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | $self->{seq_file} = | ||||||||||||||||||||||||||||||||||||||||||
| 83 | defined $args{seq_file} | ||||||||||||||||||||||||||||||||||||||||||
| 84 | ? $args{seq_file} | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | ▶ | : croak "Please define a promoter seq file!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | $self->{hd_index_file} = | ||||||||||||||||||||||||||||||||||||||||||
| 87 | defined $args{hd_index_file} | ||||||||||||||||||||||||||||||||||||||||||
| 88 | ? $args{hd_index_file} | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | ▶ | : croak "Please define a hamming dist index file!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | $self->{out_file} = | ||||||||||||||||||||||||||||||||||||||||||
| 91 | defined $args{out_file} | ||||||||||||||||||||||||||||||||||||||||||
| 92 | ? $args{out_file} | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | ▶ | : croak "Please define an output file!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | $self->{strand} = | ||||||||||||||||||||||||||||||||||||||||||
| 95 | defined $args{strand} | ||||||||||||||||||||||||||||||||||||||||||
| 96 | ? $args{strand} | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | ▶ | : croak "Please define strand(s)!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | bless( $self, $class ); | |||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | =head2 get_background | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | Title : get_background | ||||||||||||||||||||||||||||||||||||||||||
| 105 | Usage : $background -> get_background; | ||||||||||||||||||||||||||||||||||||||||||
| 106 | Function: coordinate the collection of Hamming distances | ||||||||||||||||||||||||||||||||||||||||||
| 107 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | ▶ | sub get_background { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_background: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | $self->read_hd_index; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | $self->generate_oligo; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | $self->_generate_word; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | $self->lookup_coord; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | $self->_get_distance; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | $self->_output_bkgd; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | =head2 _generate_word | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | Title : _generate_word | ||||||||||||||||||||||||||||||||||||||||||
| 124 | Usage : $self->_generate_word; | ||||||||||||||||||||||||||||||||||||||||||
| 125 | Function: generate all combinations of nucleotides (A, C, G, T) | ||||||||||||||||||||||||||||||||||||||||||
| 126 | Returns : reference to an array of words | ||||||||||||||||||||||||||||||||||||||||||
| 127 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | ▶ | sub _generate_word { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generate_word: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | my @position; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | for my $depth ( 0 .. $self->{seed_width} - 1 ) { | |||||||||||||||||||||||||||||||||||||||||
| 135 | 6 | push @position, [qw(A C G T)]; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | ▶ | my @word = NestedLoops( \@position, sub { join( q{}, @_ ) } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | $self->{word_ref} = \@word; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | return \@word; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | =head2 _get_distance | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | Title : _get_distance | ||||||||||||||||||||||||||||||||||||||||||
| 145 | Usage : $self->_get_distance; | ||||||||||||||||||||||||||||||||||||||||||
| 146 | Function: collect distance occurences for each oligo | ||||||||||||||||||||||||||||||||||||||||||
| 147 | Returns : reference to a 2D array of occurences | ||||||||||||||||||||||||||||||||||||||||||
| 148 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 1 | ▶ | sub _get_distance { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_distance: called CC=19 SCAR=32.1
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | my @bkgd; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | $self->{nucleotide} = [qw ( 0 0 0 0 )]; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 157 | 4096 | push @bkgd, [ split( q{}, 0 x ( $self->{seed_width} + 1 ) ) ]; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | my $seqIO = | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | Bio::SeqIO->new( '-format' => 'fasta', -file => $self->{seq_file} ); | |||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | ▶ | while ( my $seq_obj = $seqIO->next_seq() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 10 | my @seq_oligo; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 10 | my $seq = $seq_obj->seq; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 10 | $seq = uc $seq; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 10 | $seq =~ s{[^ACGT]}{X}g; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 10 | $seq =~ tr{ACGT}{0123}; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 10 | my @seq = split( q{}, $seq ); | |||||||||||||||||||||||||||||||||||||||||
| 168 | 10 | for my $n (@seq) { | |||||||||||||||||||||||||||||||||||||||||
| 169 | 5000 | ▶ | $self->{nucleotide}->[$n] += 1 if ( $n =~ m{\d} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 10 | for my $x ( 0 .. ( length($seq) - $self->{seed_width} ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 172 | 4950 | my $subseq = substr( $seq, $x, $self->{seed_width} ); | |||||||||||||||||||||||||||||||||||||||||
| 173 | 4950 | ▶ | if ( $subseq !~ m{X} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 4950 | $subseq =~ tr{ACGT}{0123}; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 4950 | my $oligo_indice = decode($subseq, 4); | |||||||||||||||||||||||||||||||||||||||||
| 176 | 4950 | $seq_oligo[$oligo_indice] = 1; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 10 | ▶ | if ( $self->{strand} eq "revcom" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 10 | my $revcom = reverse $seq; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 10 | $revcom =~ tr{0123}{3210}; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 10 | for my $x ( 0 .. ( length($revcom) - $self->{seed_width} ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 186 | 4950 | my $subseq = substr( $revcom, $x, $self->{seed_width} ); | |||||||||||||||||||||||||||||||||||||||||
| 187 | 4950 | ▶ | if ( $subseq !~ m{X} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 4950 | $subseq =~ tr{ACGT}{0123}; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 4950 | my $oligo_indice = decode($subseq, 4); | |||||||||||||||||||||||||||||||||||||||||
| 190 | 4950 | $seq_oligo[$oligo_indice] = 1; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 10 | for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 201 | 40960 | ▶ | if ( defined $seq_oligo[$oligo_indice] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 7384 | $bkgd[$oligo_indice][0] += 1; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 33576 | my $status; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 33576 | HD: for my $depth ( 1 .. 3 ) { | |||||||||||||||||||||||||||||||||||||||||
| 207 | 37698 | ▶ | if (List::MoreUtils::any { defined $seq_oligo[$_]; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 37698 | @{ $self->{hd_index_ref}->[$oligo_indice] }[ | |||||||||||||||||||||||||||||||||||||||||
| 209 | $self->{from_ref}->[ $self->{seed_width} - 1 ][$depth] | ||||||||||||||||||||||||||||||||||||||||||
| 210 | .. $self->{to_ref} | ||||||||||||||||||||||||||||||||||||||||||
| 211 | ->[ $self->{seed_width} - 1 ][$depth] | ||||||||||||||||||||||||||||||||||||||||||
| 212 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 213 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 214 | { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 33576 | $status = 1; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 33576 | ▶ | $bkgd[$oligo_indice][$depth] += 1 and last HD; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 4122 | (); | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 33576 | ▶ | if ( !defined $status ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | my $live_hd_index = $self->generate_hd_index( | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | \@{ $self->{oligo_ref}->[$oligo_indice] } ); | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | HD: for my $depth ( 4 .. $self->{seed_width} ) { | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | if (List::MoreUtils::any { defined $seq_oligo[$_]; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | @$live_hd_index[ | ||||||||||||||||||||||||||||||||||||||||||
| 228 | $self->{from_ref} | ||||||||||||||||||||||||||||||||||||||||||
| 229 | ->[ $self->{seed_width} - 1 ][$depth] | ||||||||||||||||||||||||||||||||||||||||||
| 230 | .. $self->{to_ref} | ||||||||||||||||||||||||||||||||||||||||||
| 231 | ->[ $self->{seed_width} - 1 ][$depth] | ||||||||||||||||||||||||||||||||||||||||||
| 232 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 233 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 234 | { | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | $bkgd[$oligo_indice][$depth] += 1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | and last HD; | ||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 33576 | (); | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 1 | $self->{bkgd_ref} = \@bkgd; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 1 | return \@bkgd; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | =head2 _output_bkgd | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | Title : _output_bkgd | ||||||||||||||||||||||||||||||||||||||||||
| 256 | Usage : $self->_output_bkgd; | ||||||||||||||||||||||||||||||||||||||||||
| 257 | Function: writes background Hamming distances to output file | ||||||||||||||||||||||||||||||||||||||||||
| 258 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | ▶ | sub _output_bkgd { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_output_bkgd: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | ▶ | open( OUT, ">>$self->{out_file}" ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | or croak "Cannot open $self->{out_file}\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | print( OUT "A\t$self->{nucleotide}->[0]\n" ); | |||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | print( OUT "C\t$self->{nucleotide}->[1]\n" ); | |||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | print( OUT "G\t$self->{nucleotide}->[2]\n" ); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | print( OUT "T\t$self->{nucleotide}->[3]\n" ); | |||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | for my $oligo_indice ( 0 .. $#{ $self->{bkgd_ref} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 271 | 4096 | print( OUT "$self->{word_ref}->[$oligo_indice]", | |||||||||||||||||||||||||||||||||||||||||
| 272 | 4096 | "\t@{$self->{bkgd_ref}->[$oligo_indice]}\n" | |||||||||||||||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | close OUT; | |||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | François Fauteux, C<< <ffauteux at cpan.org> >> | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | Please report any bugs or feature requests to C<bug-Seeder at rt.cpan.org>, or | ||||||||||||||||||||||||||||||||||||||||||
| 285 | at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Seeder>. I will be | ||||||||||||||||||||||||||||||||||||||||||
| 286 | notified, and then you'll automatically be notified of progress on your bug as | ||||||||||||||||||||||||||||||||||||||||||
| 287 | I make changes. | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | perldoc Seeder | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Seeder> | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | L<http://annocpan.org/dist/Seeder> | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | L<http://cpanratings.perl.org/d/Seeder> | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | L<http://search.cpan.org/dist/Seeder> | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | This algorithm was developed by François Fauteux, Mathieu Blanchette and | ||||||||||||||||||||||||||||||||||||||||||
| 320 | Martina Strömvik. We thank the Perl Monks <http://www.perlmonks.org/> for | ||||||||||||||||||||||||||||||||||||||||||
| 321 | their support. | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | Copyright 2008 François Fauteux, all rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||
| 328 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 2 | 1; # End of Seeder::Background | |||||||||||||||||||||||||||||||||||||||||