These documents are For the HEAD of the CVS repository on July 19, 2007 Api docs for previous releases

Modware::Search

Chromosome

Summary Package variables Synopsis Description General documentation Methods

Summary
   Modware::Search::Chromosome - collection of methods that return iterators of Modware::Feature::CHROMOSOME objects
Package variables top
No package variables defined.
Included modulestop
Modware::DBH
Modware::Feature
Modware::Iterator
Modware::Root
Synopsistop
   #USE CASE: print the sequence of all of the chromosomes to a file for a blast database
open FILE, ">chromosomes.fa" or die "could not open file for writing\n";

my @chromosomes = Modware::Search::Chromosome->Search_all_chromosomes();

foreach my $chromosome (@chromosomes) {
print FILE $chromosome->sequence( -format => 'fasta' );
}
Descriptiontop
   Modules in the Modware::Search are all class methods.  These methods
return iterators or arrays of objects (depending on the context)
So Modware:::Search::Gene contains methods that return iterators or arrays of
Modware::Feature::CHROMOSOME objects.
Methodstop
Search_all_chromosomesDescriptionCode
Search_chromosome_by_nameDescriptionCode
sth_to_iteratorDescriptionCode

Methods description

Search_all_chromosomescodetopprevnext
 Title    : Search_all_chromosomes
:
Function : returns array of all chromosomes
:
Usage : my @features = Modware::Search::Chromosome->Search_all_chromosomes();
:
Returns : Iterator or array of Modware::Features (depending on context)
Args : none
Search_chromosome_by_namecodetopprevnext
 Title    : Search_chromosome_by_name
:
Function : returns a chromosome with a name such as '1' or '2' or 'M'
:
Usage : my $chromosome = Modware::Search::Chromosome->Search_chromosome_by_name();
:
Returns : Iterator or array of Modware::Features (depending on context)
Args : STRING: chromosome name
sth_to_iteratorcodetopprevnext
 Title    : sth_to_iterator
:
Function : Given a statement handle pointing to feature_ids,
: create an iterator of Modware::Features containing
: the features identified by the feature_ids
:
Returns : an iterator of Features
Args : an active statement handle pointing to feature_ids

Methods code

Search_all_chromosomesdescriptiontopprevnext
sub Search_all_chromosomes {
   my ($self, @args) = @_;

   my $dbh    = new Modware::DBH;
   my @results;

   my $sth = $dbh->prepare("
        SELECT FEATURE_ID FROM V_CHROMOSOME_FEATURES
   ");

   $sth->execute();

   while (  my $feature_id  = $sth->fetchrow() ) {
      my $feat = new Modware::Feature( -feature_id => $feature_id );
      push @results, $feat;
   }
   $sth->finish;

   return @results;
}
Search_chromosome_by_namedescriptiontopprevnext
sub Search_chromosome_by_name {
   my ($self, $chromosome_name ) = @_;

   my $dbh    = new Modware::DBH;
   my @results;

   my $sth = $dbh->prepare("
        SELECT FEATURE_ID FROM V_CHROMOSOME_FEATURES WHERE NAME = ?
   ");

   $sth->execute($chromosome_name);

   while (  my $feature_id  = $sth->fetchrow() ) {
      my $feat = new Modware::Feature( -feature_id => $feature_id );
      push @results, $feat;
   }
   $sth->finish;

   return @results;
}
sth_to_iteratordescriptiontopprevnext
sub sth_to_iterator {
    my ( $self, $sth ) = @_;

    my @data;
    while ( my $row = $sth->fetchrow() ) {
        my $args   = { -feature_id => $row };
        push( @data, $args );
    }

    my $itr = new Modware::Iterator(
        -CLASS => "Modware::Feature",
        -DATA  =>\@ data
    );

    return $itr;
}

General documentation

AUTHOR - Eric Just top
   Eric Just e-just@northwestern.edu
APPENDIX top
   The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _