From 804d9e8389b01c8cd27194a2c3ddbbe0f836610a Mon Sep 17 00:00:00 2001 From: Jacques Dainat Date: Wed, 20 May 2020 09:55:30 +0200 Subject: [PATCH] polish parameter call --- annotation/tools/fasta/gaas_fasta_splitter.pl | 13 ++++++++----- bin/gaas_fasta_splitter.pl | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/annotation/tools/fasta/gaas_fasta_splitter.pl b/annotation/tools/fasta/gaas_fasta_splitter.pl index 0823aea1a..44290ed31 100755 --- a/annotation/tools/fasta/gaas_fasta_splitter.pl +++ b/annotation/tools/fasta/gaas_fasta_splitter.pl @@ -13,7 +13,7 @@ my $start_run = time(); my $opt_fastafile; -my $opt_output; +my $opt_output="split_result"; my $opt_help = undef; my $opt_nb_chunk; my $opt_leftover="attach"; @@ -48,10 +48,10 @@ } # ---- check options ---- -if (! ( $opt_fastafile or $opt_output ) ) { +if (! ( $opt_fastafile and ($opt_nb_chunk or $opt_nb_seq_by_chunk)) ) { pod2usage( { -message => "\nAt least 2 parameters are mandatory:\nInput reference fasta file (-f)". - "Output folder (-o)\n\n". + "\nnumber of chuncks (--nb_chunks) or/and number of sequences by chunk (--nb_seq_by_chunk)\n\n". "Look at the help documentation to know more.\n", -verbose => 0, -exitval => 2 } ); @@ -92,6 +92,10 @@ print "=> option is $opt_leftover\n"; } } + +if(! -f $opt_fastafile){ + print "$opt_fastafile is not a file\n."; exit; +} # ----- output ------- my ($inputname,$path,$ext) = fileparse($opt_fastafile,qr/\.[^.]*/); @@ -460,8 +464,7 @@ =head1 OPTIONS =item B<-o> or B<--output> -Output fasta file. If no output file is specified, the output will be -written to STDOUT. +Output folder. Default split_result =item B<-h> or B<--help> diff --git a/bin/gaas_fasta_splitter.pl b/bin/gaas_fasta_splitter.pl index 0823aea1a..44290ed31 100755 --- a/bin/gaas_fasta_splitter.pl +++ b/bin/gaas_fasta_splitter.pl @@ -13,7 +13,7 @@ my $start_run = time(); my $opt_fastafile; -my $opt_output; +my $opt_output="split_result"; my $opt_help = undef; my $opt_nb_chunk; my $opt_leftover="attach"; @@ -48,10 +48,10 @@ } # ---- check options ---- -if (! ( $opt_fastafile or $opt_output ) ) { +if (! ( $opt_fastafile and ($opt_nb_chunk or $opt_nb_seq_by_chunk)) ) { pod2usage( { -message => "\nAt least 2 parameters are mandatory:\nInput reference fasta file (-f)". - "Output folder (-o)\n\n". + "\nnumber of chuncks (--nb_chunks) or/and number of sequences by chunk (--nb_seq_by_chunk)\n\n". "Look at the help documentation to know more.\n", -verbose => 0, -exitval => 2 } ); @@ -92,6 +92,10 @@ print "=> option is $opt_leftover\n"; } } + +if(! -f $opt_fastafile){ + print "$opt_fastafile is not a file\n."; exit; +} # ----- output ------- my ($inputname,$path,$ext) = fileparse($opt_fastafile,qr/\.[^.]*/); @@ -460,8 +464,7 @@ =head1 OPTIONS =item B<-o> or B<--output> -Output fasta file. If no output file is specified, the output will be -written to STDOUT. +Output folder. Default split_result =item B<-h> or B<--help>