Loading bbox-misc-code.pl 0 → 100644 +88 −0 Original line number Diff line number Diff line #!/usr/bin/perl -w use strict; use warnings; use Cwd; # This is a support script, which is loaded by the various "bbox-workflow" # programs. It is not meant to be executed directly. # # This support script has miscellaneous code. # # NOTE: This code relies heavily on dolog, which must be loaded into the same # scope as this code, or else things will fail. # This file is Copyright (C) 2016 The Board of Trustees of the Leland Stanford # Jr. University. All rights reserved. # barcode_path: Given a runfolder, return the path to the laneBarcode.html file. # $runfolder: The path to the runfolder to search. # Returns a path, or undef if the file wasn't found. sub barcode_path { my ($runfolder) = @_; # Start by appeding what we know about the path my $html_path = "$runfolder/Data/Intensities/BaseCalls/Reports/html"; # Look in our html_path for a directory my $html_handle; my $html_dir; opendir($html_handle, $html_path) or do { dolog(<<"EOF"); We have just run into problems trying to find the laneBarcode.html file The directory we tried to access is: $html_path The error we got is: $! EOF return undef; }; while (my $candidate = readdir($html_handle)) { next unless -d "$html_path/$candidate"; $html_dir = "$html_path/$candidate"; } closedir($html_handle); # If we found our directory, then return the full path if (defined($html_dir)) { return "$html_dir/all/all/all/laneBarcode.html"; } else { return undef; } } # validate_path: Make sure a path (a directory) is readable, executable, and is # a directory. # $path: The path to validate. # Returns the absolute path, or undef if there was a problem. sub validate_path { my ($path) = @_; if ( (-r $path) && (-x $path) && (-d $path) ) { $path = Cwd::abs_path($path); return $path; } else { return undef; } } # directory_rename: Append .old to a directory. # $path: The path to the directory to rename. sub directory_rename { my ($path) = @_; my $new_name = "$path.old"; if (-r $new_name) { directory_rename($new_name); } rename($path, $new_name); } # End on a true value. 1; bbox-workflow-miseq +1 −58 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ use lib qw($RealBin); require 'bbox-delivery-code.pl'; require 'bbox-email-code.pl'; require 'bbox-log-lock-code.pl'; require 'bbox-misc-code.pl'; # First, let's set our "constants". These are settings that aren't likely to Loading Loading @@ -501,61 +502,3 @@ sub dolog { my ($msg) = @_; return log_msg($LOGHANDLE, \$LOG, $msg); } # Given a runfolder, return the path to the laneBarcode.html file sub barcode_path { my ($runfolder) = @_; # Start by appeding what we know about the path my $html_path = "$runfolder/Data/Intensities/BaseCalls/Reports/html"; # Look in our html_path for a directory my $html_handle; my $html_dir; opendir($html_handle, $html_path) or do { dolog(<<"EOF"); We have just run into problems trying to find the laneBarcode.html file The directory we tried to access is: $html_path The error we got is: $! EOF return undef; }; while (my $candidate = readdir($html_handle)) { next unless -d "$html_path/$candidate"; $html_dir = "$html_path/$candidate"; } closedir($html_handle); # If we found our directory, then return the full path if (defined($html_dir)) { return "$html_dir/all/all/all/laneBarcode.html"; } else { return undef; } } # Make sure a path is valid sub validate_path { my ($path) = @_; if ( (-r $path) && (-x $path) && (-d $path) ) { $path = Cwd::abs_path($path); return $path; } else { return undef; } } # Append .old to a directory sub directory_rename { my ($path) = @_; my $new_name = "$path.old"; if (-r $new_name) { directory_rename($new_name); } rename($path, $new_name); } Loading
bbox-misc-code.pl 0 → 100644 +88 −0 Original line number Diff line number Diff line #!/usr/bin/perl -w use strict; use warnings; use Cwd; # This is a support script, which is loaded by the various "bbox-workflow" # programs. It is not meant to be executed directly. # # This support script has miscellaneous code. # # NOTE: This code relies heavily on dolog, which must be loaded into the same # scope as this code, or else things will fail. # This file is Copyright (C) 2016 The Board of Trustees of the Leland Stanford # Jr. University. All rights reserved. # barcode_path: Given a runfolder, return the path to the laneBarcode.html file. # $runfolder: The path to the runfolder to search. # Returns a path, or undef if the file wasn't found. sub barcode_path { my ($runfolder) = @_; # Start by appeding what we know about the path my $html_path = "$runfolder/Data/Intensities/BaseCalls/Reports/html"; # Look in our html_path for a directory my $html_handle; my $html_dir; opendir($html_handle, $html_path) or do { dolog(<<"EOF"); We have just run into problems trying to find the laneBarcode.html file The directory we tried to access is: $html_path The error we got is: $! EOF return undef; }; while (my $candidate = readdir($html_handle)) { next unless -d "$html_path/$candidate"; $html_dir = "$html_path/$candidate"; } closedir($html_handle); # If we found our directory, then return the full path if (defined($html_dir)) { return "$html_dir/all/all/all/laneBarcode.html"; } else { return undef; } } # validate_path: Make sure a path (a directory) is readable, executable, and is # a directory. # $path: The path to validate. # Returns the absolute path, or undef if there was a problem. sub validate_path { my ($path) = @_; if ( (-r $path) && (-x $path) && (-d $path) ) { $path = Cwd::abs_path($path); return $path; } else { return undef; } } # directory_rename: Append .old to a directory. # $path: The path to the directory to rename. sub directory_rename { my ($path) = @_; my $new_name = "$path.old"; if (-r $new_name) { directory_rename($new_name); } rename($path, $new_name); } # End on a true value. 1;
bbox-workflow-miseq +1 −58 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ use lib qw($RealBin); require 'bbox-delivery-code.pl'; require 'bbox-email-code.pl'; require 'bbox-log-lock-code.pl'; require 'bbox-misc-code.pl'; # First, let's set our "constants". These are settings that aren't likely to Loading Loading @@ -501,61 +502,3 @@ sub dolog { my ($msg) = @_; return log_msg($LOGHANDLE, \$LOG, $msg); } # Given a runfolder, return the path to the laneBarcode.html file sub barcode_path { my ($runfolder) = @_; # Start by appeding what we know about the path my $html_path = "$runfolder/Data/Intensities/BaseCalls/Reports/html"; # Look in our html_path for a directory my $html_handle; my $html_dir; opendir($html_handle, $html_path) or do { dolog(<<"EOF"); We have just run into problems trying to find the laneBarcode.html file The directory we tried to access is: $html_path The error we got is: $! EOF return undef; }; while (my $candidate = readdir($html_handle)) { next unless -d "$html_path/$candidate"; $html_dir = "$html_path/$candidate"; } closedir($html_handle); # If we found our directory, then return the full path if (defined($html_dir)) { return "$html_dir/all/all/all/laneBarcode.html"; } else { return undef; } } # Make sure a path is valid sub validate_path { my ($path) = @_; if ( (-r $path) && (-x $path) && (-d $path) ) { $path = Cwd::abs_path($path); return $path; } else { return undef; } } # Append .old to a directory sub directory_rename { my ($path) = @_; my $new_name = "$path.old"; if (-r $new_name) { directory_rename($new_name); } rename($path, $new_name); }