Bio-AutomatedAnnotation
view release on metacpan or search on metacpan
lib/Bio/AutomatedAnnotation/CommandLine/ParseGenesFromGFFs.pm view on Meta::CPAN
package Bio::AutomatedAnnotation::CommandLine::ParseGenesFromGFFs;
$Bio::AutomatedAnnotation::CommandLine::ParseGenesFromGFFs::VERSION = '1.182770';
# ABSTRACT: provide a commandline interface to pull out genes from multiple GFF files
use Moose;
use Getopt::Long qw(GetOptionsFromArray);
use Bio::AutomatedAnnotation::ParseGenesFromGFFs;
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 'amino_acids' => ( is => 'rw', isa => 'Bool', default => 0);
has 'gff_files' => ( is => 'rw', isa => 'ArrayRef' );
has 'search_query' => ( is => 'rw', isa => 'Str' );
has 'search_qualifiers' => ( is => 'rw', isa => 'ArrayRef', default => sub { ['gene'] } );
has 'output_filename' => ( is => 'rw', isa => 'Str' );
has '_error_message' => ( is => 'rw', isa => 'Str' );
sub BUILD {
my ($self) = @_;
my (
$nucleotides, $gff_files, $search_query, $search_qualifiers, $output_filename, $help
);
GetOptionsFromArray(
$self->args,
'g|gene=s' => \$search_query,
'p|search_products' => \$search_qualifiers,
'o|output=s' => \$output_filename,
'n|nucleotides' => \$nucleotides,
'h|help' => \$help,
);
if(defined($nucleotides))
{
$self->amino_acids(0);
}
else
{
$self->amino_acids(1);
}
if(defined($search_query))
{
$self->search_query($search_query);
}
else
{
$self->_error_message("Error: You must provide a gene to search for");
}
$self->output_filename($output_filename) if(defined($output_filename));
push(@{$self->search_qualifiers}, 'product') if(defined($search_qualifiers));
if(@{$self->args} == 0)
{
$self->_error_message("Error: You need to provide at least 1 GFF file");
}
for my $filename (@{$self->args})
{
if(! -e $filename)
{
$self->_error_message("Error: Cant access file $filename");
last;
}
( run in 2.172 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )