Mercurial > repos > jdv > nanopolish
comparison nanopolish_variants.pl @ 7:32cb27adeb34 draft
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/nanopolish commit 2dabc22c3707cc87100b094b25705160b842e9f9-dirty
author | jdv |
---|---|
date | Mon, 12 Feb 2018 00:58:10 -0500 |
parents | bdd6c1ab07c5 |
children | b437c0a7ca04 |
comparison
equal
deleted
inserted
replaced
6:36cc4ae4160e | 7:32cb27adeb34 |
---|---|
15 my $threads = 1; | 15 my $threads = 1; |
16 my $fn_outfile; | 16 my $fn_outfile; |
17 my $fn_consensus; | 17 my $fn_consensus; |
18 my $fn_fast5; | 18 my $fn_fast5; |
19 my $fn_reads; | 19 my $fn_reads; |
20 my $fn_index; | |
20 | 21 |
21 # remember full command string (with proper binary) | 22 # remember full command string (with proper binary) |
22 | 23 |
23 # parse genome filename and add back to arg stack | 24 # parse genome filename and add back to arg stack |
24 GetOptions( | 25 GetOptions( |
26 'threads=i' => \$threads, | 27 'threads=i' => \$threads, |
27 'outfile=s' => \$fn_outfile, | 28 'outfile=s' => \$fn_outfile, |
28 'consensus=s' => \$fn_consensus, | 29 'consensus=s' => \$fn_consensus, |
29 'fast5=s' => \$fn_fast5, | 30 'fast5=s' => \$fn_fast5, |
30 'reads=s' => \$fn_reads, | 31 'reads=s' => \$fn_reads, |
32 'index=s' => \$fn_index, | |
31 ); | 33 ); |
32 | 34 |
33 my $ret; | 35 my $ret; |
34 | 36 |
37 my $fn_link = 'reads'; | |
35 my $tmp_dir = 'tmp_dir'; | 38 my $tmp_dir = 'tmp_dir'; |
36 mkdir $tmp_dir; | 39 mkdir $tmp_dir; |
37 | 40 |
38 $fn_fast5 = abs_path($fn_fast5); | 41 $fn_fast5 = abs_path($fn_fast5); |
39 | 42 |
43 mkdir $fast5_dir; | 46 mkdir $fast5_dir; |
44 my $cwd = abs_path( getcwd() ); | 47 my $cwd = abs_path( getcwd() ); |
45 chdir $fast5_dir; | 48 chdir $fast5_dir; |
46 $ret = system( | 49 $ret = system( |
47 'tar', | 50 'tar', |
48 '-xvf', | 51 '-xf', |
49 $fn_fast5 | 52 $fn_fast5 |
50 ); | 53 ); |
51 die "Failed to extract tarball: $!\n" | 54 die "Failed to extract tarball: $!\n" |
52 if ($ret); | 55 if ($ret); |
53 chdir $cwd; | 56 chdir $cwd; |
54 | 57 |
58 symlink( $fn_reads, $fn_link ) | |
59 or die "Failed to create symlink"; | |
60 | |
55 | 61 |
56 # index reads | 62 # index reads |
57 $ret = system( | 63 if (defined $fn_index) { |
58 'nanopolish', | 64 $ret = system( |
59 'index', | 65 'tar', |
60 '--directory' => $fast5_dir, | 66 '-xf', |
61 $fn_reads, | 67 $fn_index |
62 ); | 68 ); |
63 die "Failed nanopolish indexing: $!\n" | 69 die "Failed to extract tarball: $!\n" |
64 if ($ret); | 70 if ($ret); |
71 } | |
72 else { | |
73 $ret = system( | |
74 'nanopolish', | |
75 'index', | |
76 '--directory' => $fast5_dir, | |
77 $fn_link, | |
78 ); | |
79 die "Failed nanopolish indexing: $!\n" | |
80 if ($ret); | |
81 } | |
65 | 82 |
66 my @cmd = @ARGV; | 83 my @cmd = @ARGV; |
67 unshift @cmd, 'nanopolish'; | 84 unshift @cmd, 'nanopolish'; |
68 push @cmd, '--genome', $fn_genome; | 85 push @cmd, '--genome', $fn_genome; |
69 push @cmd, '--reads', $fn_reads; | 86 push @cmd, '--reads', $fn_link; |
70 | 87 |
71 my @regions :shared; | 88 my @regions :shared; |
72 | 89 |
73 # build region tags to pass to nanopolish | 90 # build region tags to pass to nanopolish |
74 my $parser = BioX::Seq::Stream->new($fn_genome); | 91 my $parser = BioX::Seq::Stream->new($fn_genome); |