changeset 12:f64b148e6189 draft default tip

planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/nanopolish commit ba4c46d7717e3acd346c9c6bf0bbc9bbecccc190
author jdv
date Fri, 09 Mar 2018 21:56:08 -0500
parents 550ac6458c07
children
files nanopolish_index.pl
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nanopolish_index.pl	Fri Mar 09 21:50:06 2018 -0500
+++ b/nanopolish_index.pl	Fri Mar 09 21:56:08 2018 -0500
@@ -4,8 +4,11 @@
 use warnings;
 use 5.012;
 
+use autodie;
+
 use Cwd qw/getcwd abs_path/;
 use File::Copy qw/copy/;
+use File::Temp qw/tempdir/;
 use Getopt::Long qw/:config pass_through/;
 use threads;
 use threads::shared;
@@ -26,10 +29,16 @@
 
 my $ret;
 
+my $cwd = abs_path( getcwd() );
+
 $fn_fast5   = abs_path($fn_fast5);
 $fn_reads   = abs_path($fn_reads);
 $fn_outfile = abs_path($fn_outfile);
 
+my $tmpdir = tempdir( CLEANUP => 1 );
+
+chdir $tmpdir;
+
 # extract FAST5 files to path where they are expected
 my $fast5_dir = 'fast5';
 if (-e $fast5_dir) {
@@ -37,7 +46,6 @@
     exit;
 }
 mkdir $fast5_dir;
-my $cwd = abs_path( getcwd() );
 chdir $fast5_dir;
 
 # use system 'tar' to transparently and safely handle absolute paths
@@ -49,7 +57,7 @@
 die "Failed to extract tarball: $!\n"
     if ($ret);
 
-chdir $cwd;
+chdir $tmpdir;
 
 symlink( $fn_reads, $fn_link )
     or die "Failed to create symlink: $@";