my $blast = Bio::EnsEMBL::Analysis::Runnable::BlastTranscriptPep->
new(
-transcript => $transcript,
-program => 'wublastn',
-database => 'embl_vertrna',
-options => 'hitdist=40 -cpus=1',
-parser => $bplitewrapper,
-filter => $featurefilter,
);
$blast->run;
my @output =@{$blast->output};
This module acts as an intermediate between blast and transcripts. It
is primarily used by the runnabledb BlastGenscanPep to blast
the protein sequence of a genscan or any other ab initio prediction
againsts a protein database. It instantiates a blast runnable passing it
the Bio::Seq of the transcript translation as the query sequence. This
module expects all the same arguments as a standard blast with the
exception or a query sequence as these must be passed into the blast
runnable it instantiates
sub align_hits_to_query
{ my ($self, $features) = @_;
my $ff = $self->feature_factory();
my @output;
for my $feature ( @$features ) {
my %exon_hash = ();
foreach my $ugFeature ( $feature->ungapped_features() ) {
my $cdna_total = 1;
my @split = $self->transcript->pep2genomic($ugFeature->start(),
$ugFeature->end());
foreach my $gcoord ( @split ) {
if($gcoord->isa('Bio::EnsEMBL::Mapper::Gap')) {
$cdna_total += $gcoord->end - $gcoord->start + 1;
next;
}
my $gstart = $gcoord->start;
my $gend = $gcoord->end;
my $gstrand = $gcoord->strand;
my $cdna_start = $cdna_total;
my $cdna_end = $cdna_start + $gend - $gstart;
$cdna_total += $gend - $gstart + 1;
my $exon;
foreach my $e (@{$self->transcript->get_all_Exons}) {
if($gstart >= $e->start && $gend <= $e->end) {
$exon = $e;
last;
}
}
while(( $cdna_start - 1 ) % 3 != 0 ) {
$cdna_start++;
if( $gstrand == 1 ) {
$gstart++;
} else {
$gend--;
}
}
while( $cdna_end % 3 != 0 ) {
$cdna_end--;
if( $gstrand == 1 ) {
$gend--;
} else {
$gstart++;
}
}
if( $cdna_end <= $cdna_start ) {
next;
}
my $hstart = (($cdna_start+2)/3) + $ugFeature->hstart() - 1; my $hend = ($cdna_end / 3) + $ugFeature->hstart() - 1; my $fp = $ff->create_feature_pair($gstart, $gend, $gstrand,
$feature->score, $hstart,
$hend, 1,
$feature->hseqname,
$feature->percent_id,
$feature->p_value,
undef,
$self->query,
$feature->analysis);
push( @{$exon_hash{$exon}}, $fp );
}
}
foreach my $ex ( keys %exon_hash ) {
my $dna_align_feature = Bio::EnsEMBL::DnaPepAlignFeature->new
(-features => $exon_hash{$ex});
push(@output, $dna_align_feature);
}
}
$self->output(\@output); } |
sub new
{ my ($class,@args) = @_;
my $self = $class->SUPER::new(@args);
my ($pt) = rearrange(['TRANSCRIPT'], @args);
$self->transcript($pt);
return $self; } |
sub output
{ my ($self, $arr_ref, $reset) = @_;
if(!$self->{'output'}){
$self->{'output'} = [];
}
if($arr_ref){
throw("Must pass Runnable:output an arrayref not a ".$arr_ref)
unless(ref($arr_ref) eq 'ARRAY');
if ($reset) {
$self->{'output'} = $arr_ref;
} else {
push(@{$self->{'output'}}, @$arr_ref);
}
}
return $self->{'output'}; } |
sub run
{ my ($self, $dir) = @_;
my $pep = $self->transcript->translate;
$pep->id($self->transcript->dbID);
if($pep->length <= 3){
return;
}
my $query = $self->query;
$self->query($pep);
$self->SUPER::run($dir);
$self->query($query);
my $out = $self->output;
$self->output([], 1);
$self->align_hits_to_query($out); } |
sub transcript
{ my ($self, $pt) = @_;
if($pt){
throw("BlastGenscanPep:transcript must be a ".
"Bio::EnsEMBL::Transcript ")
unless($pt->isa("Bio::EnsEMBL::Transcript"));
$self->{'prediction_transcript'} = $pt;
}
return $self->{'prediction_transcript'}; } |