Skip to content

Commit

Permalink
Issue #363 add check for duplicate basenames
Browse files Browse the repository at this point in the history
  • Loading branch information
nickp60 committed Dec 14, 2017
1 parent fd7aa27 commit d56d896
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/Bio/Roary/CommandLine/Roary.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use File::Which;
use File::Path qw(make_path);
use Cwd qw(abs_path getcwd);
use File::Temp;
use File::Basename;
extends 'Bio::Roary::CommandLine::Common';

has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
Expand Down Expand Up @@ -120,7 +121,7 @@ sub BUILD {
Pubmed: 26198102\n\n";

$self->help($help) if ( defined($help) );
if( $self->help )
if( $self->help )
{
print $self->usage_text;
return;
Expand All @@ -137,6 +138,18 @@ sub BUILD {
$self->logger->level(10000);
}

if ( @{ $self->args } < 2 ) {
$self->logger->error("Error: You need to provide at least 2 files to build a pan genome");
die $self->usage_text;
}
my %basenames;
foreach my $string (@{$self->args}) {
my($base, $path, $suf) = fileparse($string);
next unless $basenames{$base}++;
$self->logger->error("Error: GFF files must have unique basenames.");
die $self->usage_text;
}

if ( @{ $self->args } < 2 ) {
$self->logger->error("Error: You need to provide at least 2 files to build a pan genome");
die $self->usage_text;
Expand Down Expand Up @@ -246,7 +259,7 @@ sub _setup_output_directory {

sub run {
my ($self) = @_;

return if($self->version || $self->help);

$self->_setup_output_directory;
Expand Down

0 comments on commit d56d896

Please sign in to comment.