File Coverage

blib/lib/BioX/Map/CLIS/Cmd/MapCompare.pm
Criterion Covered Total %
statement 24 38 63.1
branch 0 2 0.0
condition n/a
subroutine 8 9 88.8
pod 1 1 100.0
total 33 50 66.0


line stmt bran cond sub pod time code
1             package BioX::Map::CLIS::Cmd::MapCompare;
2 1     1   2016 use Modern::Perl;
  1         1  
  1         4  
3 1     1   76 use IO::All;
  1         2  
  1         3  
4 1     1   33 use Carp "confess";
  1         1  
  1         28  
5 1     1   2 use Moo;
  1         1  
  1         4  
6 1     1   165 use MooX::Options prefer_commandline => 1, with_config_from_file => 1;
  1         2  
  1         4  
7 1     1   2074 use MooX::Cmd;
  1         1  
  1         4  
8 1     1   1025 use BioX::Map;
  1         1  
  1         4  
9 1     1   19 use Types::Standard qw(Int Str Bool Enum);
  1         1  
  1         5  
10              
11             our $VERSION = '0.0.12'; # VERSION:
12             # ABSTRACT: a wrapper for mapping software
13              
14              
15             around _build_config_identifier => sub { 'berry' };
16             around _build_config_prefix => sub { 'biox_map' };
17              
18              
19              
20             option indir => (
21             is => 'ro',
22             format => 's',
23             short => 'i',
24             default => '',
25             doc => "path of indir include fastq files",
26             );
27              
28              
29             option outdir => (
30             is => 'ro',
31             format => 's',
32             short => 'o',
33             doc => "path of output dir include mapping result",
34             default => './',
35             );
36              
37              
38             option summary_file => (
39             is => 'ro',
40             format => 's',
41             short => 's',
42             doc => 'path of summary file',
43             default => "summary.txt",
44             );
45              
46              
47             option process_tool => (
48             is => 'ro',
49             format => 'i',
50             short => 'p',
51             doc => "cpu number used by soap or bwa",
52             default => 1,
53             );
54              
55              
56             option process_sample => (
57             is => 'ro',
58             format => 'i',
59             short => 'P',
60             doc => "number of samples running parallel",
61             default => 1,
62             );
63              
64              
65             option genome => (
66             is => 'ro',
67             format => 's',
68             short => 'g',
69             doc => "path of genome file",
70             required => 1,
71             );
72              
73              
74             option tool => (
75             is => 'ro',
76             isa => Enum['soap', 'bwa'],
77             format => 's',
78             short => 't',
79             required => 1,
80             default => 'soap',
81             doc => "mapping software",
82             );
83              
84              
85             sub execute {
86 0     0 1   my ($self, $args_ref, $chain_ref) = @_;
87 0           my $stamp = time;
88 0           my $pre_message = "please input parameters, indir is required";
89 0           my ($indir, $outdir) = ($self->indir, $self->outdir);
90 0 0         $self->options_usage(1, $pre_message) unless ( $indir);
91 0           my ($genome, $tool, $process_tool, $process_sample) = ($self->genome, $self->tool, $self->process_tool, $self->process_sample);
92 0           my $bm = BioX::Map->new(
93             indir => $indir,
94             outdir => $outdir,
95             genome => $genome,
96             tool => $tool,
97             process_tool => $process_tool,
98             process_sample => $process_sample,
99             );
100 0           $bm->map;
101 0           $bm->tool('bwa');
102 0           $bm->map;
103 0           my $summary = $self->summary_file;
104 0           system("biox-map compare -i $outdir -o $summary -s soap -b bwa");
105 0           my $m = time - $stamp;
106 0           say "duration second" . (time - $stamp) . "\nduration minute" . (int ($m / 60));
107             }
108              
109             1;
110              
111             __END__