| Seeder documentation | Contained in the Seeder distribution. |
Seeder::Index - Index object
Version 0.01
This module provides the get_index method.
use Seeder::Index;
my $index = Seeder::Index->new(
seed_width => "6",
out_file => "6.index",
);
$index -> get_index;
None by default
Title : new
Usage : my $index = Seeder::Index->new(%args);
Function: constructor for the Seeder::Index object
Returns : new Seeder::Index object
Args :
seed_width # Seed width
out_file # Output file
Title : get_background Usage : $background -> get_background; Function: coordination of the collection of index values Args : none
Title : _generate_index
Usage : $self->_generate_index;
Function: generate an index of neighbors for Hamming distances in the range
from 0 to 3
Returns : reference to a 2D array of indices
Args : none
Title : _output_index Usage : $self->_output_index; Function: writes index to output file Args : none
François Fauteux, <ffauteux at cpan.org>
Please report any bugs or feature requests to bug-motif at rt.cpan.org, or
at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Seeder. I will be
notified, and then you'll automatically be notified of progress on your bug as
I make changes.
You can find documentation for this module with the perldoc command.
perldoc Seeder
You can also look for information at:
This algorithm was developed by François Fauteux, Mathieu Blanchette and Martina Strömvik. We thank the Perl Monks <http://www.perlmonks.org/> for their support.
Copyright 2008 François Fauteux, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Seeder documentation | Contained in the Seeder distribution. |
package Seeder::Index; use 5.006; use warnings; use strict; use Seeder qw(:all); use Carp; use base qw(Exporter); our @EXPORT; our %EXPORT_TAGS = ( 'all' => [ qw( new get_index ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our $VERSION = '0.01';
sub new { my ( $class, %args ) = @_; my $self; $self->{seed_width} = defined $args{seed_width} ? $args{seed_width} : croak "Please define a seed width!"; $self->{out_file} = defined $args{out_file} ? $args{out_file} : croak "Please define an output file!"; bless( $self, $class ); return $self; }
sub get_index { my $self = shift; $self->generate_oligo; $self->lookup_coord; $self->_generate_index; $self->_output_index; }
sub _generate_index { my $self = shift; my @index; for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) { my @indices; my $generated = $self->generate_hd_index( \@{ $self->{oligo_ref}->[$oligo_indice] } ); for my $depth ( 0 .. 3 ) { push @indices, ( sort { $a <=> $b } @$generated[ $self->{from_ref}->[ $self->{seed_width} - 1 ][$depth] .. $self->{to_ref}->[ $self->{seed_width} - 1 ][$depth] ] ); } push @index, [@indices]; } $self->{index_ref} = \@index; return \@index; }
sub _output_index { my $self = shift; open( OUT, ">>$self->{out_file}" ) or croak "Cannot open $self->{out_file}\n"; for my $oligo_indice ( 0 .. $#{ $self->{index_ref} } ) { print( OUT "@{$self->{index_ref}->[$oligo_indice]}\n" ); } close OUT; }
1; # End of Seeder::Index