3 # Cared for by Tania Oh
7 # You may distribute this module under the same terms as perl itself
9 # POD documentation - main docs before the code
13 Bio::Tools::Run::Eponine-
14 Object for execution of the Eponine which is a mammalian TSS predictor
18 use Bio::Tools::Run::Eponine;
20 my $seq = "/data/seq.fa";
21 my $threshold = "0.999";
22 my @params = ( '-seq' => $seq,
23 '-threshold' => $threshold,
24 '-epojar' => '/usr/local/bin/eponine-scan.jar',
25 '-java' => '/usr/local/bin/java');
27 my $factory = Bio::Tools::Run::Eponine->new(@params);
28 # run eponine against fasta
29 my $r = $factory->run_eponine();
30 my $parser = Bio::Tools::Eponine->new($r);
32 while (my $feat = $parser->next_prediction){
33 #$feat contains array of SeqFeature
34 foreach my $orf($feat){
35 print $orf->seqname. "\n";
42 Various additional options and input formats are available. See the
43 DESCRIPTION section for details.
47 wrapper for eponine.. a mammalian TSS predictor
49 The environment variable EPONINEDIR must be set to point at either the
50 directory which contains eponine-scan.jar or directly at the jar which
51 eponine-scan classfiles.
57 User feedback is an integral part of the evolution of this and other
58 Bioperl modules. Send your comments and suggestions preferably to one
59 of the Bioperl mailing lists. Your participation is much appreciated.
61 bioperl-l@bioperl.org - General discussion
62 http://bio.perl.org/MailList.html - About the mailing lists
66 Report bugs to the Bioperl bug tracking system to help us keep track
67 the bugs and their resolution. Bug reports can be submitted via email
70 bioperl-bugs@bio.perl.org
71 http://bio.perl.org/bioperl-bugs/
75 Email gisoht@nus.edu.sg
79 The rest of the documentation details each of the object
80 methods. Internal methods are usually preceded with a _
84 package Bio
::Tools
::Run
::Eponine
;
86 #tgot to take inmore parameters
88 use vars
qw($AUTOLOAD @ISA @EPONINE_PARAMS %EPONINE_PARAMS
89 $EPOJAR $JAVA $PROGRAMDIR $PROGRAMNAME $PROGRAM
90 $TMPDIR $TMPOUTFILE $DEFAULT_THRESHOLD
94 use Bio::Tools::Eponine;
97 use Bio::Tools::Run::WrapperBase;
100 $DEFAULT_THRESHOLD = 50;
101 $PROGRAMNAME = 'java';
102 $EPOJAR = 'eponine-scan.jar';
104 if( ! defined $PROGRAMDIR ) {
105 $PROGRAMDIR = $ENV{'JAVA_HOME'} || $ENV{'JAVA_DIR'};
107 if (defined $PROGRAMDIR) {
108 foreach my $progname ( [qw(java)],[qw(bin java)] ) {
109 my $f = Bio
::Root
::IO
->catfile($PROGRAMDIR, @
$progname);
110 if( -e
$f && -x
$f ) {
117 if( defined $ENV{'EPONINEDIR'} ) {
118 $EPOJAR = Bio
::Root
::IO
->catfile($ENV{'EPONINEDIR'}, $EPOJAR);
121 %EPONINE_PARAMS = ('SEQ' => '/tmp/test.fa',
122 'THRESHOLD' => '0.999',
123 'EPOJAR' => '/usr/local/bin/eponine-scan.jar',
124 'JAVA' => '/usr/java/jre1.3.1_02/bin/java');
126 @EPONINE_PARAMS=qw(SEQ THRESHOLD JAVA EPOJAR);
128 foreach my $attr ( @EPONINE_PARAMS)
129 { $OK_FIELD{$attr}++; }
132 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
135 my $attr = $AUTOLOAD;
136 $self->debug( "************ attr: $attr\n");
139 $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
140 $self->{$attr} = shift if @_;
141 return $self->{$attr};
145 my ($caller, @args) = @_;
147 my $self = $caller->SUPER::new
(@args);
148 # so that tempfiles are cleaned up
156 (undef,$TMPDIR) = $self->tempdir(CLEANUP
=>1);
157 (undef,$TMPOUTFILE) = $self->tempfile(-dir
=> $TMPDIR);
160 $value = shift @args;
161 next if( $attr =~ /^-/ ); # don't want named parameters
162 if ($attr =~/JAVA/i) {
166 if ($attr =~ /EPOJAR/i){
170 if ($attr =~ /THRESHOLD/i){
174 if ($attr =~ /SEQ/i){
178 $self->$attr($value);
181 $self->{'_java'} = undef; # location of java vm
182 $self->{'_epojar'} = undef; # location of eponine-scan.jar executable JAR file.
183 $self->{'_threshold'} = 0.999; # minimum posterior for filtering predictions
184 $self->{'_filename'} = undef; #location of seq
185 $seq = $EPONINE_PARAMS{'seq'} unless defined $seq;
186 $threshold = $EPONINE_PARAMS{'threshold'} unless defined $threshold;
188 $java = $EPONINE_PARAMS{'JAVA'} unless defined $java;
189 $epojar = $EPONINE_PARAMS{'epojar'} unless defined $epojar;
190 $self->filename($seq) if ($seq);
197 $self->epojar($epojar) if (defined $epojar && -e
$epojar);
199 if (defined $threshold && $threshold >=0 ){
200 $self->threshold($threshold);
202 $self->threshold($DEFAULT_THRESHOLD);
213 Usage : my $filename= $self->filename
214 Function: Get/Set the method to submit the seq
221 my ($self, $val) = @_;
223 $self->{'_filename'} = $val;
225 return $self->{'_filename'};
231 Usage : $obj->java('/usr/opt/java130/bin/java');
232 Function: Get/set method for the location of java VM
233 Args : File path (optional)
237 sub executable
{ shift->java(@_); }
240 my ($self, $exe,$warn) = @_;
243 $self->{'_pathtojava'} = $exe;
246 unless( defined $self->{'_pathtojava'} ) {
247 if( $PROGRAM && -e
$PROGRAM && -x
$PROGRAM ) {
248 $self->{'_pathtojava'} = $PROGRAM;
251 if( ( $exe = $self->io->exists_exe($PROGRAMNAME) ) &&
253 $self->{'_pathtojava'} = $exe;
255 $self->warn("Cannot find executable for $PROGRAMNAME") if $warn;
256 $self->{'_pathtojava'} = undef;
260 $self->{'_pathtojava'};
267 Usage : $obj->epojar('/some/path/to/eponine-scan.jar');
268 Function: Get/set method for the location of the eponine-scan executable JAR
269 Args : Path (optional)
274 my ($self, $location) = @_;
277 unless( $location ) {
278 $self->warn("eponine-scan.jar not found at $location: $!\n");
281 $self->{'_epojar'} = $location ;
283 return $self->{'_epojar'};
291 Usage : my $threshold = $self->threshold
292 Function: Get/Set the threshold for Eponine
294 Args : b/w 0.9 and 1.0
299 my ($self, $threshold) = @_;
300 if (defined $threshold) {
301 $self->{'_threshold'} = $threshold ;
303 return $self->{'_threshold'};
311 Usage : my @genes = $self->predict_TSS($seq)
312 Function: runs Eponine and creates an array of genes
313 Returns : An Array of SeqFeatures
314 Args : A Bio::PrimarySeqI
319 my ($self,$seq) = @_;
320 my $infile = $self->_setinput($seq);
321 my @tss = $self->_run_eponine();
330 Usage : Internal function, not to be called directly
331 Function: writes input sequence to file and return the file name
339 my ($self,$seq) = @_;
340 my ($tfh1,$inputfile) = $self->tempfile(-dir
=>$TMPDIR);
341 my $in = Bio
::SeqIO
->new(-fh
=> $tfh1 , '-format' => 'Fasta');
342 $in->write_seq($seq);
349 Usage : $obj->_run_eponine()
350 Function: execs the Java VM to run eponine
357 my $result = $TMPOUTFILE;
360 $self->debug( "Running eponine-scan\n");
361 my ($java,$epojar) = ( $self->java,
363 unless( defined $java && -e
$java && -x
$java ) {
364 $self->warn("Cannot find java");
367 unless(defined $epojar && -e
$epojar ) {
368 $self->warn("Cannot find Eponine jar");
371 my $cmd = $self->java.' -jar '.$self->epojar.' -seq '.$self->filename.' -threshold '.$self->threshold." > ".$result;
372 $self->throw("Error running eponine-scan on ".$self->filename." \n Eponine crashed ($cmd) crashed: $? \n")
375 #parse results even though it's wierd.. thought parser and wrapper should be separate
376 my $epoParser = Bio
::Tools
::Eponine
->new(-file
=>$result);
378 while (my $tss = $epoParser->next_prediction()){