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