Bio::Tools::Run
Eponine
Toolbar
Summary
Bio::Tools::Run::Eponine - Object for execution of the Eponine which
is a mammalian TSS predictor
Package variables
No package variables defined.
Included modules
Bio::Root::IO
Bio::Root::Root
Bio::Tools::Eponine
Bio::Tools::Run::WrapperBase
Inherit
Bio::Root::Root Bio::Tools::Run::WrapperBase
Synopsis
use Bio::Tools::Run::Eponine;
use strict;
my $seq = "/data/seq.fa";
my $threshold = "0.999";
my @params = ( '-seq' => $seq,
'-threshold' => $threshold,
'-epojar' => '/usr/local/bin/eponine-scan.jar',
'-java' => '/usr/local/bin/java');
my $factory = Bio::Tools::Run::Eponine->new(@params);
# run eponine against fasta
my $r = $factory->run($seq);
my $parser = Bio::Tools::Eponine->new($r);
while (my $feat = $parser->next_prediction){
#$feat contains array of SeqFeature
foreach my $orf($feat){
print $orf->seqname. "\n";
}
}
# Various additional options and input formats are available. See
# the DESCRIPTION section for details.
Description
wrapper for eponine, a mammalian TSS predictor.
The environment variable EPONINEDIR must be set to point at either the
directory which contains eponine-scan.jar or directly at the jar which
eponine-scan classfiles. NOTE: EPONINEDIR must point at the real file
not a symlink.
Methods
Methods description
Title : java Usage : $obj->java('/usr/opt/java130/bin/java'); Function: Get/set method for the location of java VM Args : File path (optional) |
Title : epojar Usage : $obj->epojar('/some/path/to/eponine-scan.jar'); Function: Get/set method for the location of the eponine-scan executable JAR Args : Path (optional) |
Title : threshold Usage : my $threshold = $self->threshold Function: Get/Set the threshold for Eponine Returns : string Args : b/w 0.9 and 1.0 |
Title : run Usage : my @genes = $self->run($seq) Function: runs Eponine and creates an array of features Returns : An Array of SeqFeatures Args : A Bio::PrimarySeqI |
Title : predict_TSS Usage : Alias for run() |
Title : _setinput Usage : Internal function, not to be called directly Function: writes input sequence to file and return the file name Example : Returns : string Args : |
Title : run_eponine Usage : $obj->_run_eponine() Function: execs the Java VM to run eponine Returns : none Args : none |
Methods code
BEGIN { $DEFAULT_THRESHOLD = 50;
$PROGRAMNAME = 'java';
$EPOJAR = 'eponine-scan.jar';
if( ! defined $PROGRAMDIR ) {
$PROGRAMDIR = $ENV{'JAVA_HOME'} || $ENV{'JAVA_DIR'};
}
if (defined $PROGRAMDIR) {
foreach my $progname ( [qw(java)],[qw(bin java)] ) {
my $f = Bio::Root::IO->catfile($PROGRAMDIR, @$progname);
if( -e $f && -x $f ) {
$PROGRAM = $f;
last;
}
}
}
if( $ENV{'EPONINEDIR'} ) {
if ( -d $ENV{'EPONINEDIR'} ) {
$EPOJAR = Bio::Root::IO->catfile($ENV{'EPONINEDIR'}, $EPOJAR)
} elsif(-e $ENV{'EPONINEDIR'}) {
$EPOJAR = $ENV{'EPONINEDIR'};
}
if ( ! -e $EPOJAR) {
$EPOJAR =undef;
}
}
%EPONINE_PARAMS = ('SEQ' => '/tmp/test.fa',
'THRESHOLD' => '0.999',
'EPOJAR' => '/usr/local/bin/eponine-scan.jar',
'JAVA' => '/usr/java/jre1.3.1_02/bin/java');
@EPONINE_PARAMS=qw(SEQ THRESHOLD JAVA EPOJAR);
foreach my $attr ( @EPONINE_PARAMS)
{ $OK_FIELD{$attr}++;} |
sub AUTOLOAD
{ my $self = shift;
my $attr = $AUTOLOAD;
$self->debug( "************ attr: $attr\n");
$attr =~ s/.*:://;
$attr = uc $attr;
$self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
$self->{$attr} = shift if @_;
return $self->{$attr};} |
sub new
{ my ($caller, @args) = @_;
my $self = $caller->SUPER::new(@args);
my $java;
my $seq;
my $threshold;
my $epojar;
my ($attr, $value);
($TMPDIR) = $self->tempdir(CLEANUP=>1);
my $tfh;
($tfh,$TMPOUTFILE) = $self->io->tempfile(-dir => $TMPDIR);
close($tfh);
undef $tfh;
while (@args) {
$attr = shift @args;
$value = shift @args;
next if( $attr =~ /^-/ ); if ($attr =~/JAVA/i) {
$java = $value;
next;
}
if ($attr =~ /EPOJAR/i){
$epojar = $value;
next;
}
if ($attr =~ /THRESHOLD/i){
$threshold = $value;
next;
}
if ($attr =~ /SEQ/i){
$seq = $value;
next;
}
$self->$attr($value);
}
$self->{'_java'} = undef; $self->{'_epojar'} = undef; $self->{'_threshold'} = 0.999; $self->{'_filename'} = undef; $seq = $EPONINE_PARAMS{'seq'} unless defined $seq;
$threshold = $EPONINE_PARAMS{'threshold'} unless defined $threshold;
if (! defined $epojar && defined $EPOJAR) {
$epojar = $EPOJAR;
}
else {
$epojar = $EPONINE_PARAMS{'epojar'} unless defined $epojar;
}
if (! defined $java && defined $PROGRAM) {
$java = $PROGRAM;
}
else {
$java = $EPONINE_PARAMS{'JAVA'} unless defined $java;
}
$self->filename($seq) if ($seq);
if (-x $java) {
$self->java($java);
}
$self->epojar($epojar) if (defined $epojar);
if (defined $threshold && $threshold >=0 ){
$self->threshold($threshold);
} else {
$self->threshold($DEFAULT_THRESHOLD);
}
return $self;} |
sub executable
{ shift->java(@_); } |
sub java
{ my ($self, $exe,$warn) = @_;
if( defined $exe ) {
$self->{'_pathtojava'} = $exe;
}
unless( defined $self->{'_pathtojava'} ) {
if( $PROGRAM && -e $PROGRAM && -x $PROGRAM ) {
$self->{'_pathtojava'} = $PROGRAM;
} else {
my $exe;
if( ( $exe = $self->io->exists_exe($PROGRAMNAME) ) &&
-x $exe ) {
$self->{'_pathtojava'} = $exe;
} else {
$self->warn("Cannot find executable for $PROGRAMNAME") if $warn;
$self->{'_pathtojava'} = undef;
}
}
}
$self->{'_pathtojava'};} |
sub epojar
{ my ($self, $location) = @_;
if ($location)
{
unless( $location ) {
$self->warn("eponine-scan.jar not found at $location: $!\n");
return;
}
$self->{'_epojar'} = $location ;
}
return $self->{'_epojar'};} |
sub threshold
{ my ($self, $threshold) = @_;
if (defined $threshold) {
$self->{'_threshold'} = $threshold ;
}
return $self->{'_threshold'};} |
sub run
{ my ($self,$seq) = @_;
my $infile = $self->_setinput($seq);
my @tss = $self->_run_eponine($infile);
return @tss;} |
sub predict_TSS
{ return shift->run(@_); } |
sub _setinput
{ my ($self,$seq) = @_;
if(!ref $seq){
return $seq;
}
my ($tfh1,$inputfile) = $self->tempfile(-dir=>$TMPDIR);
my $in = Bio::SeqIO->new(-fh=> $tfh1 , '-format' => 'Fasta');
$in->write_seq($seq);
close($tfh1);
undef $tfh1;
return ($inputfile);} |
sub _run_eponine
{ my ($self,$infile) = @_;
my $result = $TMPOUTFILE;
my @tss;
$self->debug( "Running eponine-scan\n");
my ($java,$epojar) = ( $self->java,
$self->epojar);
unless( defined $java && -e $java && -x $java ) {
$self->warn("Cannot find java");
return;
}
if (! defined $epojar) { $self->warn("Don't know the name of the Eponine jar file"); return; }
if (! -e $epojar) {
$self->warn("Cannot find Eponine jar: $epojar - either you specified an incorrect path in\nEPONINEDIR or it was not in the current working directory");
return;
}
my $cmd = $self->java.' -jar '.$self->epojar.' -seq '.$infile.' -threshold '.$self->threshold." > ".$result;
$self->throw("Error running eponine-scan on ".$self->filename.
"\n Check your java version, it has to be version 1.2 or later. Eponine crashed ($cmd) crashed: $?\n ")
if (system ($cmd));
my $epoParser = Bio::Tools::Eponine->new(-file =>$result);
while (my $tss = $epoParser->next_prediction()){
push (@tss, $tss);
}
return @tss;
}
1;
__END__} |
General documentation
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _