my $runnable = Bio::EnsEMBL::Analysis::Runnable::Finished::EPCR->new(
-query => $slice,
-program => $self->analysis->dbfile,
%{$self->parameters_hash};
);
$runnable->run;
my @marker_features = @{$runnable->output};
None available.
sub parse_results
{ my ($self, $results) = @_;
if(!$results){
$results = $self->resultsfile;
}
if(!-e $results){
throw("Can't open ".$results." as it doesn't exist");
}
my $ff = $self->feature_factory;
my @output;
my $hash;
my $name;
open(FH, $results) or throw("FAILED to open ".$results);
while(<FH>){
chomp;
my ($start, $end, $dbid);
($name, $start, $end, $dbid) = $_ =~ m!(\S+)\s+(\d+)\.\.(\d+)\s+(\w+)!; $hash->{$dbid} = [] unless $hash->{$dbid};
push @{$hash->{$dbid}}, [$start, $end];
}
DBID:foreach my $dbid (keys %$hash) {
my @markers = sort {$a->[0] <=> $b->[0]} @{$hash->{$dbid}};
M1:foreach my $m1 (@markers) {
next unless $m1;
my $start1 = $m1->[0];
my $end1 = $m1->[1];
M2:for(my $i = 0;$i<scalar(@markers);$i++){
my $m2 = $markers[$i];
next unless $m2;
my $start2 = $m2->[0];
my $end2 = $m2->[1];
next M2 if($start1==$start2 && $end1==$end2);
next M1 if($end1<= $start2);
if($start1<=$start2 && $end1>=$end2){
delete $markers[$i];
}
}
}
$hash->{$dbid} =\@ markers;
}
foreach my $dbid (keys %$hash) {
my $m = $ff->create_marker($dbid);
$m->adaptor($self->analysis->adaptor);
foreach my $coord (@{$hash->{$dbid}}) {
next unless $coord;
my $start = $coord->[0];
my $end = $coord->[1];
my $mf = $ff->create_marker_feature($start, $end, 0, $m, $name,$self->query);
push(@output, $mf);
}
$self->hit_list($dbid);
}
$self->output(\@output);
close(FH) or throw("FAILED to close ".$results);
}
1; } |