comparison nanopolish_index.pl @ 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 32cb27adeb34
children
comparison
equal deleted inserted replaced
11:550ac6458c07 12:f64b148e6189
2 2
3 use strict; 3 use strict;
4 use warnings; 4 use warnings;
5 use 5.012; 5 use 5.012;
6 6
7 use autodie;
8
7 use Cwd qw/getcwd abs_path/; 9 use Cwd qw/getcwd abs_path/;
8 use File::Copy qw/copy/; 10 use File::Copy qw/copy/;
11 use File::Temp qw/tempdir/;
9 use Getopt::Long qw/:config pass_through/; 12 use Getopt::Long qw/:config pass_through/;
10 use threads; 13 use threads;
11 use threads::shared; 14 use threads::shared;
12 use BioX::Seq::Stream; 15 use BioX::Seq::Stream;
13 16
24 'outfile=s' => \$fn_outfile, 27 'outfile=s' => \$fn_outfile,
25 ); 28 );
26 29
27 my $ret; 30 my $ret;
28 31
32 my $cwd = abs_path( getcwd() );
33
29 $fn_fast5 = abs_path($fn_fast5); 34 $fn_fast5 = abs_path($fn_fast5);
30 $fn_reads = abs_path($fn_reads); 35 $fn_reads = abs_path($fn_reads);
31 $fn_outfile = abs_path($fn_outfile); 36 $fn_outfile = abs_path($fn_outfile);
37
38 my $tmpdir = tempdir( CLEANUP => 1 );
39
40 chdir $tmpdir;
32 41
33 # extract FAST5 files to path where they are expected 42 # extract FAST5 files to path where they are expected
34 my $fast5_dir = 'fast5'; 43 my $fast5_dir = 'fast5';
35 if (-e $fast5_dir) { 44 if (-e $fast5_dir) {
36 warn "$fast5_dir exists, won't overwrite"; 45 warn "$fast5_dir exists, won't overwrite";
37 exit; 46 exit;
38 } 47 }
39 mkdir $fast5_dir; 48 mkdir $fast5_dir;
40 my $cwd = abs_path( getcwd() );
41 chdir $fast5_dir; 49 chdir $fast5_dir;
42 50
43 # use system 'tar' to transparently and safely handle absolute paths 51 # use system 'tar' to transparently and safely handle absolute paths
44 $ret = system( 52 $ret = system(
45 'tar', 53 'tar',
47 $fn_fast5 55 $fn_fast5
48 ); 56 );
49 die "Failed to extract tarball: $!\n" 57 die "Failed to extract tarball: $!\n"
50 if ($ret); 58 if ($ret);
51 59
52 chdir $cwd; 60 chdir $tmpdir;
53 61
54 symlink( $fn_reads, $fn_link ) 62 symlink( $fn_reads, $fn_link )
55 or die "Failed to create symlink: $@"; 63 or die "Failed to create symlink: $@";
56 64
57 # index reads 65 # index reads