Skip to content

Commit

Permalink
Version display (#353)
Browse files Browse the repository at this point in the history
* clean printed message and add AGAT header to know which version is ran

---------

Co-authored-by: Jacques Dainat <jacques.dainat@ird.fr>
  • Loading branch information
Juke34 and Juke34 authored Apr 25, 2023
1 parent d613f0e commit f07ca0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/AGAT/OmniscientI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ sub slurp_gff3_file_JD {
# +----------------- Check we receive a hash as ref ------------------+
if(ref($args) ne 'HASH'){ print "Hash Arguments expected for slurp_gff3_file_JD. Please check the call.\n"; exit; }

# +----------------- Declare all variables and fill them ------------------+
# +----------------- Declare all variables and fill them ------------------+
my ( $file, $gff_in_format, $locus_tag, $verbose, $merge_loci,
$log, $debug, $throw_fasta, $progress_bar);

Expand Down Expand Up @@ -148,13 +148,15 @@ sub slurp_gff3_file_JD {
my $log_name = $filename.".agat.log";
open($log, '>', $log_name ) or
dual_print($log, "Can not open $log_name for printing: $!", 1) && die;
print $log AGAT::AGAT::get_agat_header(); # print AGAT header
print $log file_text_line({ string => (strftime "%m/%d/%Y at %Hh%Mm%Ss", localtime),
char => " ",
extra => "\n"});
}
}

# +----------------- Print header ------------------+
dual_print ($log, AGAT::AGAT::get_agat_header(), $verbose);

# +----------------- debug param ------------------+
$debug = $config->{debug};

Expand All @@ -175,7 +177,8 @@ sub slurp_gff3_file_JD {
$throw_fasta = $config->{throw_fasta};

# +---------------------------------- Write header info ----------------------------------+
dual_print ($log, surround_text("- Start parsing -",80,"*"), $verbose);
dual_print ($log,sizedPrint("\n",80, "\n"), $verbose);
dual_print ($log,sizedPrint("------ Start parsing ------",80, "\n"), $verbose);
dual_print ($log, file_text_line({ string => "parse options and metadata", char => "-" }), $verbose);

# +-- load files --+
Expand Down Expand Up @@ -405,7 +408,7 @@ sub slurp_gff3_file_JD {
}

# Parsing time
dual_print ($log, surround_text("- End parsing -\ndone in ".(time() - $start_run)." seconds",80,"*","\n"), $verbose );
dual_print ($log,sizedPrint("------ End parsing (done in ".(time() - $start_run)." second) ------",80, "\n\n\n"), $verbose);
$previous_time = time();
my $check_time = $previous_time;

Expand All @@ -415,7 +418,7 @@ sub slurp_gff3_file_JD {

# -------------------- Mandatory checks --------------------
my $check_cpt = 1;
dual_print ($log, surround_text("- Start checks -",80,"*"), $verbose);
dual_print ($log,sizedPrint("------ Start checks ------",80, "\n"), $verbose);

dual_print ($log, file_text_line({ string => "Check$check_cpt: feature types", char => "-" }), $verbose );
_handle_globalWARNS({ warning => \%globalWARNS, ontology => $ontology, log => $log, type => "ontology", verbose => $verbose });
Expand Down Expand Up @@ -544,9 +547,7 @@ sub slurp_gff3_file_JD {
}
}

dual_print ($log, surround_text("- End checks -\ndone in ".(time() - $check_time)." seconds",80,"*","\n"), $verbose );

dual_print ($log, "=> OmniscientI total time: ".(time() - $start_run)." seconds\n", $verbose );
dual_print ($log,sizedPrint("------ End checks (done in ".(time() - $check_time)." second) ------",80, "\n\n\n"), $verbose);

#return
return \%omniscient, \%mRNAGeneLink ;
Expand Down
8 changes: 8 additions & 0 deletions lib/AGAT/Utilities.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ sub activate_warning_limit{
# Char (character to use to make the frame),
# String (extra to print at the end after the frame)
# @output 1 => String
#e.g. surround_text("- Start parsing -",80,"*")
# ********************************************************************************
# * - Start parsing - *
# ********************************************************************************
#
sub surround_text{
my ($term, $size, $char, $extra) = @_;

Expand Down Expand Up @@ -156,6 +161,9 @@ sub surround_text{
return $result;
}

# e.g. file_text_line({ string => "parse options and metadata", char => "-" })
# -------------------------- parse options and metadata --------------------------
#
sub file_text_line{
my ($args) = @_;

Expand Down

0 comments on commit f07ca0b

Please sign in to comment.