These documents are For the HEAD of the CVS repository on July 19, 2007
Api docs for previous releases
Modware::Search
Chromosome
Modware::Search::Chromosome - collection of methods that return iterators of Modware::Feature::CHROMOSOME objects
|
No package variables defined. |
#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' ); }
|
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.
|
Methods description
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
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
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
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;
}
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;
}
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
Copyright © 2006, Northwestern University
All rights reserved.
|
|