Skip to content

Commit

Permalink
Config file can now be called as you wish and located where you want (#…
Browse files Browse the repository at this point in the history
…376)

* change config.yaml by agat_config.yaml

* add config option (can be called and located anywhere)
  • Loading branch information
Juke34 committed Jul 10, 2023
1 parent 7adaa83 commit 1ec3a98
Show file tree
Hide file tree
Showing 164 changed files with 1,495 additions and 246 deletions.
14 changes: 9 additions & 5 deletions bin/agat
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ a GFF3 output by default. This can be tuned via the config file.
Configuration (optional)
========================
To access the config.yaml configuration file: agat config --expose
To access the agat_config.yaml configuration file: agat config --expose
The file will appear in the working folder. By default, AGAT uses the config file from the working directory when any.
Feature levels (optional)
Expand All @@ -71,7 +71,7 @@ The file will appear in the working folder. By default, AGAT uses the config fil
# 'config-files' => ["/etc/$APPNAME.json"],
options => [
{
getopt => 'help|h!',
getopt => 'h|help!',
shortbool => 1, #shortbool added by JDainat to avoid --no-help
help => 'Display the help',
},
Expand Down Expand Up @@ -108,7 +108,7 @@ file. Indeed, if the feature_levels.yaml file exists in your working directory,
used by default.',
options => [
{
getopt => 'help|h!',
getopt => 'h|help!',
shortbool => 1,
help => 'Display the help',
},
Expand Down Expand Up @@ -136,15 +136,19 @@ force_gff_input_version, gtf_output_version, gff_output_version and output_forma
',
options => [
{
getopt => 'help|h!',
getopt => 'h|help!',
help => 'Display the help',
shortbool => 1,
},
{
getopt => 'expose|e!',
help => 'Expose the config file (A config.yaml will be set in your working directory). If any AGAT use the config.yaml from the current directory over the default one.',
help => 'Expose the config file. By default agat_config.yaml, but you can change the config file name using output option.',
shortbool => 1,
},
{
getopt => 'output=s',
help => 'To create a config file with the desired name instead of the default agat_config.yaml. Do not forget to mention your config file name when using AGAT, otherwise AGAT will use the agat_config.yaml in your working directory if any or the original agat_config.yaml file shiped along the tool.',
},
{
getopt => 'verbose=i',
help => 'Verbosity during the GFF/GTF parsing. 0 is quiet. 1,2,3 or 4 to increase verbosity.[Default 1]',
Expand Down
29 changes: 20 additions & 9 deletions bin/agat_convert_bed2gff.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use AGAT::AGAT;

my $header = get_agat_header();
my $config = get_agat_config();
my $config;
my $outfile = undef;
my $bed = undef;
my $source_tag = "data";
Expand All @@ -18,14 +18,16 @@
my $verbose = undef;
my $help;

if( !GetOptions( "help" => \$help,
"bed=s" => \$bed,
"source=s" => \$source_tag,
"verbose|v!" => \$verbose,
"primary_tag=s" => \$primary_tag,
"inflate_off!" => \$inflating_off,
"inflate_type=s" => \$inflate_type,
"outfile|output|o|out|gff=s" => \$outfile ) )

if( !GetOptions( 'c|config=s' => \$config,
"h|help" => \$help,
"bed=s" => \$bed,
"source=s" => \$source_tag,
"verbose|v!" => \$verbose,
"primary_tag=s" => \$primary_tag,
"inflate_off!" => \$inflating_off,
"inflate_type=s" => \$inflate_type,
"outfile|output|o|out|gff=s" => \$outfile ) )
{
pod2usage( { -message => "Failed to parse command line.\n",
-verbose => 1,
Expand All @@ -46,6 +48,9 @@
-exitval => 1 } );
}

# --- Manage config ---
$config = get_agat_config({config_file_in => $config});

## Manage output file
my $gffout = prepare_gffout($config, $outfile);

Expand Down Expand Up @@ -487,6 +492,12 @@ =head1 OPTIONS
Output GFF file. If no output file is specified, the output will be
written to STDOUT.
=item B<-c> or B<--config>
String - Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any,
otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose".
The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
=item B<-h> or B<--help>
Display this helpful text.
Expand Down
16 changes: 13 additions & 3 deletions bin/agat_convert_embl2gff.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
use AGAT::AGAT;

my $header = get_agat_header();
my $config = get_agat_config();
my $config;
my $outfile;
my $embl;
my $emblmygff3;
my $throw_fasta=$config->{"throw_fasta"};
my $primaryTags;
my $discard;
my $keep;
my $help;

if( !GetOptions(
"help" => \$help,
'c|config=s' => \$config,
"h|help" => \$help,
"embl=s" => \$embl,
"primary_tag|pt|t=s" => \$primaryTags,
"d!" => \$discard,
Expand All @@ -48,6 +48,10 @@
-exitval => 1 } );
}

# --- Manage config ---
$config = get_agat_config({config_file_in => $config});
my $throw_fasta=$config->{"throw_fasta"};

##################
# MANAGE OPTION #
if($discard and $keep){
Expand Down Expand Up @@ -256,6 +260,12 @@ =head1 OPTIONS
Output GFF file. If no output file is specified, the output will be
written to STDOUT.
=item B<-c> or B<--config>
String - Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any,
otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose".
The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
=item B<-h> or B<--help>
Display this helpful text.
Expand Down
23 changes: 17 additions & 6 deletions bin/agat_convert_genscan2gff.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use AGAT::AGAT;

my $header = get_agat_header();
my $config = get_agat_config();
my $config;
my $outfile = undef;
my $genscan = undef;
my $seq_id = "unknown";
Expand All @@ -19,11 +19,13 @@
my $verbose = undef;
my $help;

if( !GetOptions( "help" => \$help,
"g|genscan=s" => \$genscan,
"seqid=s" => \$seq_id,
"verbose|v!" => \$verbose,
"outfile|output|o|out|gff=s" => \$outfile ) )

if( !GetOptions( 'c|config=s' => \$config,
"h|help" => \$help,
"g|genscan=s" => \$genscan,
"seqid=s" => \$seq_id,
"verbose|v!" => \$verbose,
"outfile|output|o|out|gff=s" => \$outfile ) )
{
pod2usage( { -message => "Failed to parse command line.\n",
-verbose => 1,
Expand All @@ -44,6 +46,9 @@
-exitval => 1 } );
}

# --- Manage config ---
$config = get_agat_config({config_file_in => $config});

## Manage output file
my $gffout = prepare_gffout($config, $outfile);

Expand Down Expand Up @@ -301,6 +306,12 @@ =head1 OPTIONS
Output GFF file. If no output file is specified, the output will be
written to STDOUT.
=item B<-c> or B<--config>
String - Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any,
otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose".
The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
=item B<-h> or B<--help>
Display this helpful text.
Expand Down
14 changes: 12 additions & 2 deletions bin/agat_convert_mfannot2gff.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use AGAT::AGAT;

my $header = get_agat_header();
my $config = get_agat_config();
my $config;
my $mfannot_file;
my $verbose;
my $gff_file;
Expand All @@ -25,14 +25,18 @@
'mfannot|m|i=s' => \$mfannot_file,
'gff|g|o=s' => \$gff_file,
'v|verbose!' => \$verbose,
'help|h' => sub { pod2usage( -exitstatus=>0, -verbose=>99, -message => "$header\n" ); },
'c|config=s' => \$config,
'h|help' => sub { pod2usage( -exitstatus=>0, -verbose=>99, -message => "$header\n" ); },
'man' => sub { pod2usage(-exitstatus=>0, -verbose=>2); }
) or pod2usage ( -exitstatus=>2, -verbose=>2 );

if (!defined $mfannot_file) {
pod2usage( -message=>"Insufficient options supplied", -exitstatus=>2 );
}

# --- Manage config ---
$config = get_agat_config({config_file_in => $config});

## Manage output file
my $gffout = prepare_gffout($config, $gff_file);

Expand Down Expand Up @@ -456,6 +460,12 @@ =head1 OPTIONS
the gff output file
=item B<-c> or B<--config>
String - Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any,
otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose".
The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
=item B<-h> or B<--help>
Display this helpful text.
Expand Down
12 changes: 11 additions & 1 deletion bin/agat_convert_minimap2_bam2gff.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


my $header = get_agat_header();
my $config = get_agat_config();
my $config;
my $opt_in;
my $opt_bam;
my $opt_sam;
Expand All @@ -20,6 +20,7 @@
'b|bam!' => \$opt_bam,
's|sam!' => \$opt_sam,
'o|out|output=s' => \$opt_output,
'c|config=s' => \$config,
'h|help!' => \$opt_help ) )
{
pod2usage( { -message => 'Failed to parse command line',
Expand All @@ -41,6 +42,9 @@
-exitval => 1 } );
}

# --- Manage config ---
$config = get_agat_config({config_file_in => $config});

# ---- set output -----
my $out_stream = prepare_gffout($config, $opt_output);

Expand Down Expand Up @@ -377,6 +381,12 @@ =head1 OPTIONS
Output GFF file. If no output file is specified, the output will be
written to STDOUT.
=item B<-c> or B<--config>
String - Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any,
otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose".
The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
=item B<-h> or B<--help>
Display this helpful text.
Expand Down
14 changes: 12 additions & 2 deletions bin/agat_convert_sp_gff2bed.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
use AGAT::AGAT;

my $header = get_agat_header();
my $config = get_agat_config();
my $config;
my $outfile = undef;
my $gff = undef;
my $sub = "exon";
my $opt_nc = "keep";
my $help;

if( !GetOptions(
"help|h" => \$help,
'c|config=s' => \$config,
"h|help" => \$help,
"gff=s" => \$gff,
"sub=s" => \$sub,
"nc=s" => \$opt_nc,
Expand All @@ -39,6 +40,9 @@
-exitval => 1 } );
}

# --- Manage config ---
$config = get_agat_config({config_file_in => $config});

## Manage output file
my $bedout;
if ($outfile) {
Expand Down Expand Up @@ -258,6 +262,12 @@ =head1 OPTIONS
File where will be written the result. If no output file is specified, the output will be written to STDOUT.
=item B<-c> or B<--config>
String - Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any,
otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose".
The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
=item B<-h> or B<--help>
Display this helpful text.
Expand Down
14 changes: 12 additions & 2 deletions bin/agat_convert_sp_gff2gtf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use AGAT::AGAT;

my $header = get_agat_header();
my $config = get_agat_config();
my $config;
my $outfile = undef;
my $gff = undef;
my $relax = undef;
Expand All @@ -17,7 +17,8 @@


if( !GetOptions(
"help" => \$help,
'c|config=s' => \$config,
"h|help" => \$help,
"gff|gtf|i=s" => \$gff,
"gtf_version=s" => \$gtf_version,
"verbose|v!" => \$verbose,
Expand All @@ -42,6 +43,9 @@
-exitval => 1 } );
}

# --- Manage config ---
$config = get_agat_config({config_file_in => $config});

## Manage output file
my $gtf_out;
if ($outfile) {
Expand Down Expand Up @@ -134,6 +138,12 @@ =head1 OPTIONS
Output GTF file. If no output file is specified, the output will be
written to STDOUT.
=item B<-c> or B<--config>
String - Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any,
otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose".
The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
=item B<-h> or B<--help>
Display this helpful text.
Expand Down

0 comments on commit 1ec3a98

Please sign in to comment.