line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RL::Command::genome; |
2
|
13
|
|
|
13
|
|
9633
|
use strict; |
|
13
|
|
|
|
|
36
|
|
|
13
|
|
|
|
|
392
|
|
3
|
13
|
|
|
13
|
|
72
|
use warnings; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
352
|
|
4
|
13
|
|
|
13
|
|
68
|
use autodie; |
|
13
|
|
|
|
|
31
|
|
|
13
|
|
|
|
|
79
|
|
5
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
69261
|
use App::RL -command; |
|
13
|
|
|
|
|
31
|
|
|
13
|
|
|
|
|
166
|
|
7
|
13
|
|
|
13
|
|
4768
|
use App::RL::Common; |
|
13
|
|
|
|
|
30
|
|
|
13
|
|
|
|
|
350
|
|
8
|
|
|
|
|
|
|
|
9
|
13
|
|
|
13
|
|
66
|
use constant abstract => 'convert chr.size to full genome runlists'; |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
7030
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub opt_spec { |
12
|
|
|
|
|
|
|
return ( |
13
|
4
|
|
|
4
|
1
|
23
|
[ "outfile|o=s", "Output filename. [stdout] for screen." ], |
14
|
|
|
|
|
|
|
[ "remove|r", "Remove 'chr0' from chromosome names." ], |
15
|
|
|
|
|
|
|
{ show_defaults => 1, } |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub usage_desc { |
20
|
4
|
|
|
4
|
1
|
32086
|
return "runlist genome [options] "; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub description { |
24
|
1
|
|
|
1
|
1
|
667
|
my $desc; |
25
|
1
|
|
|
|
|
3
|
$desc .= ucfirst(abstract) . ".\n"; |
26
|
1
|
|
|
|
|
3
|
return $desc; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub validate_args { |
30
|
3
|
|
|
3
|
1
|
2093
|
my ( $self, $opt, $args ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
3
|
100
|
|
|
|
4
|
if ( @{$args} != 1 ) { |
|
3
|
|
|
|
|
11
|
|
33
|
1
|
|
|
|
|
3
|
my $message = "This command need one input file.\n\tIt found"; |
34
|
1
|
|
|
|
|
2
|
$message .= sprintf " [%s]", $_ for @{$args}; |
|
1
|
|
|
|
|
4
|
|
35
|
1
|
|
|
|
|
3
|
$message .= ".\n"; |
36
|
1
|
|
|
|
|
8
|
$self->usage_error($message); |
37
|
|
|
|
|
|
|
} |
38
|
2
|
|
|
|
|
5
|
for ( @{$args} ) { |
|
2
|
|
|
|
|
5
|
|
39
|
2
|
50
|
|
|
|
7
|
next if lc $_ eq "stdin"; |
40
|
2
|
100
|
|
|
|
10
|
if ( !Path::Tiny::path($_)->is_file ) { |
41
|
1
|
|
|
|
|
108
|
$self->usage_error("The input file [$_] doesn't exist."); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
1
|
50
|
|
|
|
55
|
if ( !exists $opt->{outfile} ) { |
46
|
0
|
|
|
|
|
0
|
$opt->{outfile} = Path::Tiny::path( $args->[0] )->absolute . ".yml"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub execute { |
51
|
1
|
|
|
1
|
1
|
7
|
my ( $self, $opt, $args ) = @_; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#----------------------------# |
54
|
|
|
|
|
|
|
# Loading |
55
|
|
|
|
|
|
|
#----------------------------# |
56
|
1
|
|
|
|
|
10
|
my $length_of = App::RL::Common::read_sizes( $args->[0], $opt->{remove} ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#----------------------------# |
59
|
|
|
|
|
|
|
# Operating |
60
|
|
|
|
|
|
|
#----------------------------# |
61
|
1
|
|
|
|
|
4
|
my $r_of = {}; |
62
|
1
|
|
|
|
|
3
|
for my $key ( keys %{$length_of} ) { |
|
1
|
|
|
|
|
6
|
|
63
|
16
|
|
|
|
|
473
|
my $set = App::RL::Common::new_set(); |
64
|
16
|
|
|
|
|
160
|
$set->add_pair( 1, $length_of->{$key} ); |
65
|
16
|
|
|
|
|
874
|
$r_of->{$key} = $set->runlist; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#----------------------------# |
69
|
|
|
|
|
|
|
# Output |
70
|
|
|
|
|
|
|
#----------------------------# |
71
|
1
|
|
|
|
|
33
|
my $out_fh; |
72
|
1
|
50
|
|
|
|
6
|
if ( lc( $opt->{outfile} ) eq "stdout" ) { |
73
|
1
|
|
|
|
|
4
|
$out_fh = *STDOUT; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else { |
76
|
0
|
|
|
|
|
0
|
open $out_fh, ">", $opt->{outfile}; |
77
|
|
|
|
|
|
|
} |
78
|
1
|
|
|
|
|
3
|
print {$out_fh} YAML::Syck::Dump($r_of); |
|
1
|
|
|
|
|
6
|
|
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
154
|
close $out_fh; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |