my $blast = Bio::EnsEMBL::Analysis::Runnable::PSILC_BlastP->new
(
'-trans' => $transcript,
'-analysis' => $analysis,
);
$blast->run;
my $output = $blast->output;
sub new
{ my ($class,@args) = @_;
my $self = $class->SUPER::new(@args);
$self->{'_trans'} = {};
my( $trans) = $self->_rearrange([qw(
TRANS
)], @args);
if ($trans) {
$self->trans($trans);
}
return $self; } |
sub output
{ my ($self, $trans) = @_;
if ($trans) {
$self->{'_output'} = $trans;
}
return $self->{'_output'};
}
1; } |
sub run_blast
{ my ($self,$trans)=@_;
my %transcript_hash;
print STDERR "Blast search of ".$trans->dbID.".\n";
my $bplitewrapper = Bio::EnsEMBL::Analysis::Tools::BPliteWrapper-> new
(
-query_type => 'dna',
-database_type => 'dna',
);
my $query = Bio::Seq->new(
'-display_id' => $trans->dbID,
'-seq' => $trans->translate->seq,
);
my $blast = Bio::EnsEMBL::Analysis::Runnable::Blast->new
('-query' => $query,
'-program' => 'blastp',
'-database' => "$PSILC_BLAST_DB/multi_species.fasta",
'-threshold' => 1e-6,
'-parser' => $bplitewrapper,
'-options' => 'V=10 -cpus=1',
'-analysis' => $self->analysis,
);
$blast->run();
my $results = $blast->output;
foreach my $daf (@{$results}) {
my $coverage = $daf->length/length($query->seq); if ($daf->percent_id <= 99 &&
$coverage > 0.8 &&
$daf->percent_id > 50 ){
if ($daf->hseqname =~ /(\w+)_(\w+)/) {
push @{$transcript_hash{$2}},$1;
} else {
$self->throw("Cannot recognise trans_id ".$daf->hseqname." $@\n");
}
}
}
$self->output(\%transcript_hash);
}
} |
sub trans
{ my ($self, $trans) = @_;
if ($trans) {
unless ($trans->isa("Bio::EnsEMBL::Transcript")){
$self->throw("Input isn't a Bio::EnsEMBL::Transcript, it is a $trans\n$@");
}
$self->{'_trans'} = $trans;
}
return $self->{'_trans'}; } |