Mercurial > repos > jdv > nanopolish
comparison nanopolish_variants.pl @ 4:bdd6c1ab07c5 draft
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/nanopolish commit 83364d7d78ca5524a08065daef995bfcd54a379d
author | jdv |
---|---|
date | Fri, 01 Dec 2017 21:22:01 -0500 |
parents | a1d433401bc2 |
children | 32cb27adeb34 |
comparison
equal
deleted
inserted
replaced
3:a1d433401bc2 | 4:bdd6c1ab07c5 |
---|---|
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 Archive::Tar; | |
8 use Cwd qw/getcwd abs_path/; | 7 use Cwd qw/getcwd abs_path/; |
9 use File::Copy qw/copy/; | 8 use File::Copy qw/copy/; |
10 use Getopt::Long qw/:config pass_through/; | 9 use Getopt::Long qw/:config pass_through/; |
11 use threads; | 10 use threads; |
12 use threads::shared; | 11 use threads::shared; |
29 'consensus=s' => \$fn_consensus, | 28 'consensus=s' => \$fn_consensus, |
30 'fast5=s' => \$fn_fast5, | 29 'fast5=s' => \$fn_fast5, |
31 'reads=s' => \$fn_reads, | 30 'reads=s' => \$fn_reads, |
32 ); | 31 ); |
33 | 32 |
33 my $ret; | |
34 | |
34 my $tmp_dir = 'tmp_dir'; | 35 my $tmp_dir = 'tmp_dir'; |
35 mkdir $tmp_dir; | 36 mkdir $tmp_dir; |
36 | 37 |
37 $fn_fast5 = abs_path($fn_fast5); | 38 $fn_fast5 = abs_path($fn_fast5); |
38 | 39 |
39 # extract FAST5 files to path where they are expected | 40 # extract FAST5 files to path where they are expected |
41 # use system 'tar' to transparently and safely handle absolute paths | |
40 my $fast5_dir = 'fast5'; | 42 my $fast5_dir = 'fast5'; |
41 mkdir $fast5_dir; | 43 mkdir $fast5_dir; |
42 my $cwd = abs_path( getcwd() ); | 44 my $cwd = abs_path( getcwd() ); |
43 chdir $fast5_dir; | 45 chdir $fast5_dir; |
44 my $tar = Archive::Tar->new(); | 46 $ret = system( |
45 $tar->read($fn_fast5); | 47 'tar', |
46 $tar->extract(); | 48 '-xvf', |
47 say "done extracting $fn_fast5 here"; | 49 $fn_fast5 |
50 ); | |
51 die "Failed to extract tarball: $!\n" | |
52 if ($ret); | |
48 chdir $cwd; | 53 chdir $cwd; |
49 | 54 |
50 | 55 |
51 # index reads | 56 # index reads |
52 my $ret = system( | 57 $ret = system( |
53 'nanopolish', | 58 'nanopolish', |
54 'index', | 59 'index', |
55 '--directory' => $fast5_dir, | 60 '--directory' => $fast5_dir, |
56 $fn_reads, | 61 $fn_reads, |
57 ); | 62 ); |