Skip to content

Commit

Permalink
Fix #475 : Added an option to refer a folder of GFF files (#476)
Browse files Browse the repository at this point in the history
* Added an option to refer a folder of GFF/GTF files
  • Loading branch information
IvanUgrin authored Sep 3, 2024
1 parent 83641ef commit a959981
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bin/agat_sp_merge_annotations.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Pod::Usage;
use List::MoreUtils qw(uniq);
use AGAT::AGAT;
use File::Spec;
use File::Glob ':glob';

my $header = get_agat_header();
my $config;
Expand Down Expand Up @@ -34,6 +36,16 @@
-message => "$header\n" } );
}

my @expanded_files;
foreach my $file_or_dir (@opt_files) {
if (-d $file_or_dir) {
push @expanded_files, bsd_glob(File::Spec->catfile($file_or_dir, '*.{gff,gtf}'));
} else {
push @expanded_files, $file_or_dir;
}
}
@opt_files = @expanded_files;

if ( ! @opt_files or (@opt_files and ($#opt_files < 1) ) ){
pod2usage( {
-message => "$header\nAt least 2 files are mandatory:\n --gff file1 --gff file2\n\n",
Expand Down Expand Up @@ -101,6 +113,7 @@ =head1 DESCRIPTION
=head1 SYNOPSIS
agat_sp_merge_annotations.pl --gff infile1 --gff infile2 --out outFile
agat_sp_merge_annotations.pl --gff /path/to/folder/with/gff --out outFile
agat_sp_merge_annotations.pl --help
=head1 OPTIONS
Expand All @@ -109,7 +122,7 @@ =head1 OPTIONS
=item B<--gff> or B<-f>
Input GTF/GFF file(s). You can specify as much file you want like so: -f file1 -f file2 -f file3
Input GTF/GFF file(s). You can specify a folder containing GFF3 files with the format .gff or GTF files with .gtf format . You can also specify as much file you want like so: -f file1 -f file2 -f file3
=item B<--out>, B<--output> or B<-o>
Expand Down

0 comments on commit a959981

Please sign in to comment.