Bio-InterProScanWrapper

 view release on metacpan or  search on metacpan

lib/Bio/InterProScanWrapper/CommandLine/AnnotateEukaryotes.pm  view on Meta::CPAN

package Bio::InterProScanWrapper::CommandLine::AnnotateEukaryotes;

# ABSTRACT: provide a commandline interface to the annotation wrappers


use Moose;
use Getopt::Long qw(GetOptionsFromArray);
use Cwd;
use File::Basename;
use Bio::InterProScanWrapper;

has 'args'                    => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'script_name'             => ( is => 'ro', isa => 'Str',      required => 1 );
has 'help'                    => ( is => 'rw', isa => 'Bool',     default  => 0 );
has 'cpus'                    => ( is => 'rw', isa => 'Int',      default  => 100 );
has 'exec_script'             => ( is => 'rw', isa => 'Str',      default  => '/software/pathogen/external/apps/usr/local/iprscan-5.0.7/interproscan.sh' );
has 'proteins_file'           => ( is => 'rw', isa => 'Str' );
has 'tmp_directory'           => ( is => 'rw', isa => 'Str', default => '/tmp' );
has 'output_filename'         => ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build_output_filename' );
has 'no_lsf'                  => ( is => 'rw', isa => 'Bool', default => 0 );
has 'intermediate_output_dir' => ( is => 'rw', isa => 'Maybe[Str]');

sub BUILD {
    my ($self) = @_;
    my ( $proteins_file, $tmp_directory, $help, $exec_script, $cpus, $output_filename, $no_lsf,$intermediate_output_dir );

    GetOptionsFromArray(
        $self->args,
        'a|proteins_file=s'   => \$proteins_file,
        't|tmp_directory=s'   => \$tmp_directory,
        'e|exec_script=s'     => \$exec_script,
        'p|cpus=s'            => \$cpus,
        'o|output_filename=s' => \$output_filename,
        'l|no_lsf'            => \$no_lsf,
        'intermediate_output_dir=s' => \$intermediate_output_dir,
        'h|help'              => \$help,
    );

    $self->proteins_file($proteins_file) if ( defined($proteins_file) );
    if ( defined($tmp_directory) ) { $self->tmp_directory($tmp_directory); }
    else {
        $self->tmp_directory( getcwd() );
    }
    $self->exec_script($exec_script)         if ( defined($exec_script) );
    $self->cpus($cpus)                       if ( defined($cpus) );
    $self->output_filename($output_filename) if ( defined($output_filename) );
    $self->no_lsf(1)                         if (  defined($no_lsf) );
    $self->intermediate_output_dir($intermediate_output_dir)  if (  defined($intermediate_output_dir) );

}

sub _build_output_filename
{
  my ($self) = @_;
  my $output_filename = 'iprscan_results.gff';
  if(defined($self->proteins_file))
  {
    my($filename, $directories, $suffix) = fileparse($self->proteins_file);
    $output_filename = getcwd().'/'.$filename.'.iprscan.gff';
  }
  return $output_filename;
}

sub merge_results
{
   my ($self) = @_;
   ( ( -e $self->proteins_file ) && !$self->help ) or die $self->usage_text;
  
   my $obj = Bio::InterProScanWrapper->new(
       input_file      => $self->proteins_file,
       _tmp_directory  => $self->tmp_directory,
       cpus            => $self->cpus,



( run in 2.187 seconds using v1.01-cache-2.11-cpan-98e64b0badf )