From 72f1e633f340e5a59673c2da52f369bd019808be Mon Sep 17 00:00:00 2001 From: Jillian Rowe Date: Thu, 6 Jul 2017 14:48:12 +0400 Subject: [PATCH] bug fix for stats with --select_rules --- lib/BioX/Workflow/Command/run/Rules/Rules.pm | 6 ++-- .../Command/run/Utils/Files/ResolveDeps.pm | 3 ++ .../Command/run/Utils/Files/TrackChanges.pm | 15 ++------ lib/BioX/Workflow/Command/stats.pm | 36 ++++++++++--------- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/lib/BioX/Workflow/Command/run/Rules/Rules.pm b/lib/BioX/Workflow/Command/run/Rules/Rules.pm index 07d96f5..ebf5f68 100644 --- a/lib/BioX/Workflow/Command/run/Rules/Rules.pm +++ b/lib/BioX/Workflow/Command/run/Rules/Rules.pm @@ -695,7 +695,7 @@ sub walk_indir_outdir { my $text = $attr->interpol_directive( $attr->outdir ); - $DB::single = 2; + # $DB::single = 2; $self->walk_indir_outdir_sample( $attr, $text ); } @@ -846,7 +846,7 @@ sub check_indir_outdir { my $self = shift; my $attr = shift; - $DB::single = 2; + # $DB::single = 2; return unless $attr->by_sample_outdir; return unless $self->has_sample; return if $attr->override_process; @@ -893,7 +893,7 @@ Outdir should be global_attr->outdir/rule_name sub carry_directives { my $self = shift; - $DB::single = 2; + # $DB::single = 2; $self->local_attr->outdir( $self->global_attr->outdir . '/' . $self->rule_name ); diff --git a/lib/BioX/Workflow/Command/run/Utils/Files/ResolveDeps.pm b/lib/BioX/Workflow/Command/run/Utils/Files/ResolveDeps.pm index 9a50ecf..c363446 100644 --- a/lib/BioX/Workflow/Command/run/Utils/Files/ResolveDeps.pm +++ b/lib/BioX/Workflow/Command/run/Utils/Files/ResolveDeps.pm @@ -44,6 +44,9 @@ sub add_graph { my $self = shift; my $cond = shift; + return unless $self->files; + return unless $self->has_files; + for my $file ( $self->all_files ) { if ( !exists $self->rule_deps->{ $self->rule_name }->{$cond}->{$file} ) { diff --git a/lib/BioX/Workflow/Command/run/Utils/Files/TrackChanges.pm b/lib/BioX/Workflow/Command/run/Utils/Files/TrackChanges.pm index 9adcfc6..f9fd8d8 100644 --- a/lib/BioX/Workflow/Command/run/Utils/Files/TrackChanges.pm +++ b/lib/BioX/Workflow/Command/run/Utils/Files/TrackChanges.pm @@ -17,17 +17,6 @@ Files just for this rule ##TODO Make this a hash? =cut -# has 'files' => ( -# traits => ['Hash'], -# is => 'rw', -# isa => 'HashRef', -# default => sub { {} }, -# handles => { -# files_pairs => 'kv', -# clear_files => 'clear', -# }, -# ); - has 'files' => ( traits => ['Array'], is => 'rw', @@ -87,7 +76,9 @@ sub walk_INPUT { return unless $ref_name; return unless $ref_name eq 'Path::Tiny'; - $self->push_files( $ref->absolute ); + my $file = $ref->absolute; + $file = "$file"; + $self->push_files( $file ); } 1; diff --git a/lib/BioX/Workflow/Command/stats.pm b/lib/BioX/Workflow/Command/stats.pm index 5b4ac97..a6644d4 100644 --- a/lib/BioX/Workflow/Command/stats.pm +++ b/lib/BioX/Workflow/Command/stats.pm @@ -47,28 +47,25 @@ has 'app_log_file' => ( return $log_file; } ); - -has '+app_log' => ( +has 'app_log' => ( + is => 'rw', default => sub { - my $self = shift; - my $app_log_file = $self->app_log_file; - my $log_conf = <init( \$log_conf ); + my $self = shift; + Log::Log4perl->init( \ <<'EOT'); + log4perl.category = FATAL, Screen + log4perl.appender.Screen = \ + Log::Log4perl::Appender::ScreenColoredLevels + log4perl.appender.Screen.layout = \ + Log::Log4perl::Layout::PatternLayout + log4perl.appender.Screen.layout.ConversionPattern = \ + [%d] %m %n +EOT return get_logger(); }, + lazy => 1, ); + has 'table_log' => ( is => 'rw', default => sub { @@ -120,6 +117,11 @@ around 'pre_FILES' => sub { $self->$orig( $attr, $cond ); + return unless $self->has_files; + return unless $self->files; + + $DB::single=2; + for my $file ( $self->all_files ) { $self->preprocess_row( $file, $cond ); }