Bio-Roary
view release on metacpan or search on metacpan
lib/Bio/Roary/CommandLine/UniqueGenesPerSample.pm view on Meta::CPAN
undef $VERSION;
package Bio::Roary::CommandLine::UniqueGenesPerSample;
$Bio::Roary::CommandLine::UniqueGenesPerSample::VERSION = '3.13.0';
# ABSTRACT: Take in the clustered file and produce a sorted file with the frequency of each samples unique genes
use Moose;
use Getopt::Long qw(GetOptionsFromArray);
use Bio::Roary::UniqueGenesPerSample;
extends 'Bio::Roary::CommandLine::Common';
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 'clustered_proteins' => ( is => 'rw', isa => 'Str', default => 'clustered_proteins' );
has 'output_filename' => ( is => 'rw', isa => 'Str', default => 'unique_genes_per_sample.tsv' );
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
has '_error_message' => ( is => 'rw', isa => 'Str' );
sub BUILD {
my ($self) = @_;
my ( $clustered_proteins, $output_filename, $verbose, $help );
GetOptionsFromArray(
$self->args,
'o|output=s' => \$output_filename,
'c|clustered_proteins=s' => \$clustered_proteins,
'v|verbose' => \$verbose,
'h|help' => \$help,
);
if ( defined($verbose) ) {
$self->verbose($verbose);
$self->logger->level(10000);
}
$self->help($help) if ( defined($help) );
( !$self->help ) or die $self->usage_text;
$self->output_filename($output_filename) if ( defined($output_filename) );
if ( defined($clustered_proteins) && ( -e $clustered_proteins ) ) {
$self->clustered_proteins($clustered_proteins);
}
else {
$self->_error_message("Error: Cant access the clustered proteins file");
}
}
sub run {
my ($self) = @_;
if ( defined( $self->_error_message ) ) {
print $self->_error_message . "\n";
die $self->usage_text;
}
my $obj = Bio::Roary::UniqueGenesPerSample->new(
clustered_proteins => $self->clustered_proteins,
output_filename => $self->output_filename,
);
$obj->write_unique_frequency;
}
sub usage_text {
my ($self) = @_;
return <<USAGE;
Usage: roary-unique_genes_per_sample [options] -c clustered_proteins
Take in the clustered file and produce a sorted file with the frequency of each samples unique genes
( run in 1.312 second using v1.01-cache-2.11-cpan-98e64b0badf )