my $runnable = Bio::EnsEMBL::Analysis::Runnable::EponineTSS->new
(
-query => $slice,
-program => 'java',
);
$runnable->run;
my @simple_features = @{$runnable->output};
sub epojar
{ my $self = shift;
my $epojar = shift;
if($epojar){
if(! -e $epojar){
my $temp = $self->find_file($epojar);
$epojar = $temp;
}
$self->{'epojar'} = $epojar;
}
return $self->{'epojar'}; } |
sub new
{ my ($class,@args) = @_;
my $self = $class->SUPER::new(@args);
my ($epojar, $threshold) = rearrange(['EPOJAR', 'THRESHOLD'], @args);
if(!$self->program){
$self->program('java');
}
$self->epojar('eponine-scan.jar');
$self->threshold(50);
$self->epojar($epojar) if($epojar);
$self->threshold($threshold) if($threshold);
return $self; } |
sub parse_results
{ my ($self, $results) = @_;
if(!$results){
$results = $self->resultsfile;
}
my $ff = $self->feature_factory;
if(!-e $results){
throw("Can't parse an no existance results file ".$results.
" EponineTSS:parse_results");
}
my @output;
open(EponineTSS, $results) or throw("FAILED to open ".$results.
" EponineTSS:parse_results");
LINE:while(<EponineTSS>){
if (! /^\#/){ chomp;
my @element = split;
my ($name, $start, $end, $score, $temp_strand) =
@element[0, 3, 4, 5, 6];
my $strand = 1;
if($temp_strand eq '-'){
$strand = -1;
}
$score = $self->trunc_float_3($score);
my $sf = $ff->create_simple_feature($start, $end, $strand, $score,
'', $name, $self->query);
push(@output, $sf);
}
}
$self->output(\@output);
close(EponineTSS) or throw("FAILED to close ".$results.
" EponineTSS:parse_results"); } |
sub run_analysis
{ my ($self, $program) = @_;
if(!$program){
$program = $self->program;
}
throw($program." is not executable EponineTSS::run_analysis ")
unless($program && -x $program);
my $command = $program." -jar ".$self->epojar." -seq ".$self->queryfile.
" -threshold ".$self->threshold." > ".$self->resultsfile;
print "Running analysis ".$command."\n";
system($command) == 0 or throw("FAILED to run ".$command); } |
sub trunc_float_3
{ my ($self, $arg) = @_;
return $arg unless $arg =~ /^[+-]?\d*\.\d+$/;
return 0.001 * int (1000 * $arg); } |