/usr/share/perl5/Bio/Tools/Run/Eponine.pm is in libbio-perl-run-perl 1.7.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | #
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Tania Oh
#
# Copyright Tania Oh
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Tools::Run::Eponine - Object for execution of the Eponine which
is a mammalian TSS predictor
=head1 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.
=head1 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.
=head1 FEEDBACK
=head2 Mailing Lists
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
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<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.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
http://redmine.open-bio.org/projects/bioperl/
=head1 AUTHOR
Email gisoht@nus.edu.sg
=head1 APPENDIX
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
=cut
package Bio::Tools::Run::Eponine;
#tgot to take inmore parameters
use vars qw($AUTOLOAD @ISA @EPONINE_PARAMS %EPONINE_PARAMS
$EPOJAR $JAVA $PROGRAMDIR $PROGRAMNAME $PROGRAM
$TMPDIR $TMPOUTFILE $DEFAULT_THRESHOLD
%OK_FIELD);
use strict;
use Bio::Tools::Eponine;
use Bio::Root::Root;
use Bio::Root::IO;
use Bio::Tools::Run::WrapperBase;
@ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
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) = @_;
# chained new
my $self = $caller->SUPER::new(@args);
# so that tempfiles are cleaned up
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 =~ /^-/ ); # don't want named parameters
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; # location of java vm
$self->{'_epojar'} = undef; # location of eponine-scan.jar executable JAR file.
$self->{'_threshold'} = 0.999; # minimum posterior for filtering predictions
$self->{'_filename'} = undef; #location of seq
$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) {
# full path assumed
$self->java($java);
}
$self->epojar($epojar) if (defined $epojar);
if (defined $threshold && $threshold >=0 ){
$self->threshold($threshold);
} else {
$self->threshold($DEFAULT_THRESHOLD);
}
return $self;
}
=head2 java
Title : java
Usage : $obj->java('/usr/opt/java130/bin/java');
Function: Get/set method for the location of java VM
Args : File path (optional)
=cut
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'};
}
=head2 epojar
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)
=cut
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'};
}
=head2 threshold
Title : threshold
Usage : my $threshold = $self->threshold
Function: Get/Set the threshold for Eponine
Returns : string
Args : b/w 0.9 and 1.0
=cut
sub threshold{
my ($self, $threshold) = @_;
if (defined $threshold) {
$self->{'_threshold'} = $threshold ;
}
return $self->{'_threshold'};
}
=head2 run
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
=cut
sub run{
my ($self,$seq) = @_;
my $infile = $self->_setinput($seq);
my @tss = $self->_run_eponine($infile);
return @tss;
}
=head2 predict_TSS
Title : predict_TSS
Usage : Alias for run()
=cut
sub predict_TSS {
return shift->run(@_);
}
=head2 _setinput()
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 :
=cut
sub _setinput {
my ($self,$seq) = @_;
#better be a file
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);
}
=head2 _run_eponine
Title : run_eponine
Usage : $obj->_run_eponine()
Function: execs the Java VM to run eponine
Returns : none
Args : none
=cut
sub _run_eponine {
my ($self,$infile) = @_;
my $result = $TMPOUTFILE;
my @tss;
#run eponine
$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));
#parse results even though it's wierd.. thought parser and wrapper should be separate
my $epoParser = Bio::Tools::Eponine->new(-file =>$result);
while (my $tss = $epoParser->next_prediction()){
push (@tss, $tss);
}
return @tss;
}
1;
__END__
|