Skip to content

Commit

Permalink
Merge pull request #167 from aassie/master
Browse files Browse the repository at this point in the history
Removing <NONE> tag
  • Loading branch information
HRGV authored Feb 16, 2023
2 parents 7073d78 + e4afc0b commit ce098b7
Show file tree
Hide file tree
Showing 19 changed files with 1,528 additions and 579 deletions.
4 changes: 3 additions & 1 deletion ENA_phyloFlash.pl
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ sub get_fastq_urls {

=head1 COPYRIGHT AND LICENSE
Copyright (C) 2017 - Brandon Seah <[email protected]>
Copyright (C) 2017-2018 by Brandon Seah <[email protected]>
Harald Gruber-Vodicka <[email protected]>
Elmar A. Pruesse <[email protected]>
LICENCE
Expand Down
63 changes: 55 additions & 8 deletions PhyloFlash.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ This module contains helper functions shared by the phyloFlash scripts.
=cut

our $VERSION = "3.3b1";
our $VERSION = "3.4.1";
our @ISA = qw(Exporter);
our @EXPORT = qw(
$VERSION
get_cpus
msg
@msg_log
write_logfile
err
version_sort
file_is_newer
Expand Down Expand Up @@ -100,6 +101,20 @@ sub msg {
print STDERR $line."\n";
}

=item write_logfile ($file)
Saves message log to file
=cut
sub write_logfile {
my $file = shift;
msg ("Saving log to file $file");
my $fh;
open_or_die(\$fh, ">>", $file);
print $fh join "\n", @PhyloFlash::msg_log;
close($fh);
}

=item err($msg)
Logs an error message to STDERR and dies
Expand All @@ -109,6 +124,7 @@ sub err {
my @msg = (@_,"Aborting.");
$msg[0] = "FATAL: ".$msg[0];
msg(@msg);
write_logfile("phyloFlash_log_on_error");
exit(3);
}

Expand Down Expand Up @@ -342,9 +358,18 @@ sub run_prog {
$cmd .= " 2>".$redir_stderr if ($redir_stderr);

msg("running subcommand:","$cmd");
system($cmd) == 0
or err("Tool execution failed!.",
"Error was '$!' and return code '$?'");
my $return = system($cmd);
if ($return != 0) {
my @errmsg = ("Tool execution failed!.",
"Error was '$!' and return code '$?'");
if ($redir_stdout) {
push @errmsg, "Check log file $redir_stdout";
}
if ($redir_stderr) {
push @errmsg, "Check error log file $redir_stderr";
}
err(@errmsg);
}

# FIXME: print tail of stderr if redirected
}
Expand Down Expand Up @@ -389,8 +414,15 @@ sub run_prog_nodie {
msg("running subcommand:","$cmd");
my $return = system($cmd);
if ($return != 0) {
msg ("Tool execution failed!.",
"Error was '$!' and return code '$?'");
my @errmsg = ("Tool execution failed!.",
"Error was '$!' and return code '$?'");
if ($redir_stdout) {
push @errmsg, "Check log file $redir_stdout";
}
if ($redir_stderr) {
push @errmsg, "Check error log file $redir_stderr";
}
msg(@errmsg);
}
return ($return);
# FIXME: print tail of stderr if redirected
Expand Down Expand Up @@ -1764,6 +1796,20 @@ sub initialize_outfiles_hash {
filename => "$libraryNAME.sortmerna.log",
intable => 1,
},
"readlength_out",
{
description => "Histogram of read lengths in input file(s)",
discard => 1,
filename => "$libraryNAME.readlength.out",
intable => 0,
},
"readlength_err",
{
description => "Log file produced by readlength.sh",
discard => 1,
filename => "$libraryNAME.readlength.err",
intable => 0,
},
#"",
#{
# description => "",
Expand All @@ -1779,8 +1825,9 @@ sub initialize_outfiles_hash {
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2015 Elmar Pruesse <[email protected]>
Harald Gruber-Vodicka <[email protected]>
Copyright (C) 2015-2018 by Elmar Pruesse <[email protected]>
Harald Gruber-Vodicka <[email protected]>
Brandon Seah <[email protected]>
LICENCE
This program is free software: you can redistribute it and/or modify
Expand Down
Loading

0 comments on commit ce098b7

Please sign in to comment.