line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::Map::CLIS::Cmd::Compare; |
2
|
1
|
|
|
1
|
|
2307
|
use Modern::Perl; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
104
|
use IO::All; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
45
|
use Carp "confess"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
199
|
use MooX::Options prefer_commandline => 1, with_config_from_file => 1; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
28402
|
use MooX::Cmd; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
1163
|
use BioX::Map; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
9
|
1
|
|
|
1
|
|
20
|
use Types::Standard qw(Int Str Bool Enum); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
551
|
use Parallel::ForkManager; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
7
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.0.12'; # VERSION: |
13
|
|
|
|
|
|
|
# ABSTRACT: a wrapper for mapping software |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around _build_config_identifier => sub { 'berry' }; |
17
|
|
|
|
|
|
|
around _build_config_prefix => sub { 'biox_map' }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
option indir => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
format => 's', |
24
|
|
|
|
|
|
|
short => 'i', |
25
|
|
|
|
|
|
|
default => '', |
26
|
|
|
|
|
|
|
doc => "path of one fastq file", |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
option soap_suffix => ( |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
format => 's', |
34
|
|
|
|
|
|
|
short => 's', |
35
|
|
|
|
|
|
|
doc => "suffix of all samples' soap result", |
36
|
|
|
|
|
|
|
default => 'soap', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
option bwa_suffix => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
format => 's', |
43
|
|
|
|
|
|
|
short => 'b', |
44
|
|
|
|
|
|
|
doc => "suffix of all samples' bwa result", |
45
|
|
|
|
|
|
|
default => 'bwa', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
option process => ( |
50
|
|
|
|
|
|
|
is => 'ro', |
51
|
|
|
|
|
|
|
format => 's', |
52
|
|
|
|
|
|
|
short => 'p', |
53
|
|
|
|
|
|
|
doc => 'number of process will be used', |
54
|
|
|
|
|
|
|
default => 2, |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
option outfile => ( |
60
|
|
|
|
|
|
|
is => 'ro', |
61
|
|
|
|
|
|
|
format => 's', |
62
|
|
|
|
|
|
|
short => 'o', |
63
|
|
|
|
|
|
|
default => 'summary.txt', |
64
|
|
|
|
|
|
|
doc => "file used to store summary file", |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub execute { |
69
|
0
|
|
|
0
|
1
|
|
my ($self, $args_ref, $chain_ref) = @_; |
70
|
0
|
|
|
|
|
|
my $pre_message = "please input parameters, genome is required, either infile or indir is required"; |
71
|
0
|
|
|
|
|
|
my ($indir, $outfile, $soap_suffix, $bwa_suffix) = ($self->indir, $self->outfile, $self->soap_suffix, $self->bwa_suffix); |
72
|
0
|
0
|
0
|
|
|
|
$self->options_usage(1, $pre_message) unless ($outfile and $indir and $soap_suffix and $bwa_suffix); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $bm = BioX::Map->new; |
74
|
0
|
|
|
|
|
|
say "indir:$indir"; |
75
|
0
|
|
|
0
|
|
|
my @soap_result = io($indir)->filter( sub {$_->filename =~/\.$soap_suffix$/} )->all_files; |
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
0
|
|
|
my @bwa_result = io($indir)->filter( sub {$_->filename =~/\.$bwa_suffix$/} )->all_files; |
|
0
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$outfile = io($outfile); |
78
|
0
|
|
|
|
|
|
$outfile->print("samplename\tsoap0\tsoap1\tsoap2\tbwa0\tbwa1\tbwa2\n"); |
79
|
0
|
|
|
|
|
|
my $pm = Parallel::ForkManager->new($self->process); |
80
|
|
|
|
|
|
|
DATA_LOOP: |
81
|
0
|
|
|
|
|
|
for my $sr (@soap_result) { |
82
|
0
|
0
|
|
|
|
|
my $pid = $pm->start and next DATA_LOOP; |
83
|
0
|
|
|
|
|
|
$bm->tool("soap"); |
84
|
0
|
|
|
|
|
|
my $filename = $sr->filename; |
85
|
0
|
|
|
|
|
|
say "###########sr: $sr ######filename: $filename"; |
86
|
0
|
|
|
|
|
|
$filename =~s/\.$soap_suffix$//i; |
87
|
0
|
|
|
|
|
|
say "soap result:$sr"; |
88
|
0
|
|
|
|
|
|
my $s_r = $bm->statis_result("$sr"); |
89
|
0
|
|
|
|
|
|
$bm->tool("bwa"); |
90
|
0
|
|
|
|
|
|
$sr =~s/$soap_suffix$/$bwa_suffix/i; |
91
|
0
|
|
|
|
|
|
say "bwa result:$sr"; |
92
|
0
|
|
|
|
|
|
my $b_r = $bm->statis_result("$sr"); |
93
|
0
|
|
|
|
|
|
$sr =~s/\.$bwa_suffix//i; |
94
|
0
|
|
|
|
|
|
$outfile->lock->println(join "\t", $filename, @$s_r, @$b_r)->unlock; |
95
|
0
|
|
|
|
|
|
$pm->finish; |
96
|
|
|
|
|
|
|
} |
97
|
0
|
|
|
|
|
|
$pm->wait_all_children; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |