Bio::EnsEMBL::Analysis::Runnable::Finished
BlastExonerate
Toolbar
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
No synopsis!
Description
No description!
Methods
_make_seqfetcher | No description | Code |
add_output | No description | Code |
analysis | No description | Code |
get_Sequence | No description | Code |
get_db_version | Description | Code |
hard_masked | No description | Code |
new | No description | Code |
run | No description | Code |
run_exonerate | No description | Code |
seqfetcher | No description | Code |
soft_masked | No description | Code |
Methods description
Title : get_db_version [ distinguished from RunnableDB::*::db_version_searched() ] Useage : $self->get_db_version('version string') $obj->get_db_version() Function: Get/Set a blast database version that was searched The actual look up is done in Runnable::Finished_Blast This is just a holding place for the string in this module Returns : String or undef Args : String Caller : $self::run() RunnableDB::BlastExonerate::db_version_searched() |
Methods code
_make_seqfetcher | description | prev | next | Top |
sub add_output
{ my ( $self, $f ) = @_;
my $ana = $self->analysis;
$f->analysis($ana);
$self->{'output'} ||= [];
push ( @{ $self->{'output'} }, $f ); } |
sub analysis
{ my ( $self, $analysis ) = @_;
if ($analysis) {
$self->{'_analysis'} = $analysis;
}
return $self->{'_analysis'}; } |
sub get_Sequence
{ my ($self,$id) = @_;
my $seqfetcher = $self->seqfetcher;
my $seq;
eval {
$seq = $seqfetcher->get_Seq_by_acc($id);
};
if ((!defined($seq)) && $@) {
throw("Couldn't find sequence for [$id]:\n $@");
}
return $seq; } |
sub get_db_version
{ my ($self, $arg) = @_;
$self->{'_db_version_searched'} = $arg if $arg;
return $self->{'_db_version_searched'};
}
1; } |
sub hard_masked
{ my ( $self, $seq ) = @_;
if ($seq) {
unless ( $seq->isa("Bio::PrimarySeqI") || $seq->isa("Bio::Seq") ) {
die Dumper($seq);
throw("Input isn't a Bio::Seq or Bio::PrimarySeq");
}
$self->{'_hard_masked'} = $seq;
}
return $self->{'_hard_masked'}; } |
sub new
{ my ( $class, @args ) = @_;
my $self = bless {}, $class;
my ( $soft_masked, $hard_masked, $analysis, $seqfetcher ) = rearrange(
[
qw{
SOFT_MASKED
HARD_MASKED
ANALYSIS
SEQFETCHER
}
],
@args
);
throw "No SOFT_MASKED query (soft masked genomic sequence) given" unless $soft_masked;
throw "No HARD_MASKED query (hard masked genomic sequence) given" unless $hard_masked;
$self->soft_masked($soft_masked);
$self->hard_masked($hard_masked);
$self->analysis($analysis);
my $indices = [ split(",", $self->analysis->db) ];
$seqfetcher = $self->_make_seqfetcher($indices);
$self->seqfetcher($seqfetcher);
return $self; } |
sub run
{
my ($self) = shift;
my $parser = shift;
my $filter = shift;
my $blastcon = shift;
my $blast = Bio::EnsEMBL::Analysis::Runnable::Finished::Blast->new(
-query => $self->hard_masked,
-program => $blastcon->{-program} || 'wublastn',
-database => $self->analysis->db_file,
-analysis => $self->analysis,
-parser => $parser,
-filter => $filter,
%{$blastcon},
);
my $db_files = $blast->databases;
my $dbv = $blast->get_db_version();
print "using $dbv\n";
$self->get_db_version($dbv);
foreach my $db_file (sort @$db_files) {
print STDOUT "database file $db_file\n";
$blast->clean_output();
$blast->clean_results_files();
$blast->clean_databases();
$blast->databases($db_file);
$blast->run();
my $features = $blast->output ;
if (!$self->analysis->db)
{
print STDOUT "indice file $db_file\n";
my $seqfetcher = $self->_make_seqfetcher([$db_file]);
$self->seqfetcher($seqfetcher);
}
$self->run_exonerate($features,$blastcon) if @$features;
} } |
sub run_exonerate
{ my ( $self, $feat, $exon_options ) = @_;
my $hit_features = {};
for ( my $i = 0 ; $i < @$feat ; $i++ ) {
my $f = $feat->[$i];
my $hid = $f->hseqname or throw("Missing hid");
$hit_features->{$hid} ||= [];
push ( @{ $hit_features->{$hid} }, $f );
}
my @features_ids = sort {$a cmp $b } keys %$hit_features;
print STDOUT "Blast output: ".scalar(@features_ids)." features\n" if $verbose;
my $chunk_size = 200;
for (my $i = 0; $i < @features_ids; $i += $chunk_size) {
my $j = $i + $chunk_size - 1;
$j = $#features_ids if $#features_ids < $j;
my $chunk = [@features_ids[$i..$j]];
print STDOUT "Process chunk of ".scalar(@$chunk)." features\n" if $verbose;
my $seqs = [];
foreach my $id (@$chunk) {
push @$seqs, $self->get_Sequence($id);
}
my $exonerate =
Bio::EnsEMBL::Analysis::Runnable::Finished::Exonerate->new(
-analysis => $self->analysis,
-program => $self->analysis->program,
-target => $self->soft_masked ,
-query_seqs => $seqs,
-exo_options => $exon_options->{-exo_options},
-query_type => $exon_options->{-query_type},
);
$exonerate->run();
my $exon_output = $exonerate->output();
print STDOUT "Exonerate output: ".scalar(@$exon_output)." features\n" if $verbose;
$self->output($exon_output);
} } |
sub seqfetcher
{ my ( $self, $seqfetcher ) = @_;
if ($seqfetcher) {
$self->{'_seqfetcher'} = $seqfetcher;
}
return $self->{'_seqfetcher'}; } |
sub soft_masked
{ my ( $self, $seq ) = @_;
if ($seq) {
unless ( $seq->isa("Bio::PrimarySeqI") || $seq->isa("Bio::Seq") ) {
die Dumper($seq);
throw("Input isn't a Bio::Seq or Bio::PrimarySeq");
}
$self->{'_soft_masked'} = $seq;
}
return $self->{'_soft_masked'}; } |
General documentation
NAME - Bio::EnsEMBL::Analysis::Runnable::BlastExonerate | Top |