File Coverage

blib/lib/BioX/Map/CLIS/Cmd/Map.pm
Criterion Covered Total %
statement 24 34 70.5
branch 0 2 0.0
condition 0 3 0.0
subroutine 8 9 88.8
pod 1 1 100.0
total 33 49 67.3


line stmt bran cond sub pod time code
1             package BioX::Map::CLIS::Cmd::Map;
2 1     1   2489 use Modern::Perl;
  1         1  
  1         7  
3 1     1   107 use IO::All;
  1         2  
  1         5  
4 1     1   43 use Carp "confess";
  1         1  
  1         32  
5 1     1   3 use Moo;
  1         1  
  1         5  
6 1     1   190 use MooX::Options prefer_commandline => 1, with_config_from_file => 1;
  1         1  
  1         5  
7 1     1   2036 use MooX::Cmd;
  1         1  
  1         7  
8 1     1   1184 use BioX::Map;
  1         2  
  1         4  
9 1     1   20 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             option infile => (
20             is => 'ro',
21             format => 's',
22             short => 'i',
23             doc => "path of one fastq file",
24             default => '',
25             );
26              
27              
28             option outfile => (
29             is => 'ro',
30             format => 's',
31             short => 'o',
32             doc => "path of outfile",
33             default => '',
34             );
35              
36              
37             option indir => (
38             is => 'ro',
39             format => 's',
40             short => 'I',
41             default => '',
42             doc => "path of indir include fastq file",
43             );
44              
45              
46             option outdir => (
47             is => 'ro',
48             format => 's',
49             short => 'O',
50             doc => "path of outdir",
51             default => './',
52             );
53              
54              
55             option process_tool => (
56             is => 'ro',
57             format => 'i',
58             short => 'p',
59             doc => "cpu number used by mapping software",
60             default => 1,
61             );
62              
63              
64             option process_sample => (
65             is => 'ro',
66             format => 'i',
67             short => 'P',
68             doc => "number of samples running parallel",
69             default => 1,
70             );
71              
72              
73             option genome => (
74             is => 'ro',
75             format => 's',
76             short => 'g',
77             required => 1,
78             doc => "path of genome file",
79             );
80              
81              
82             option tool => (
83             is => 'ro',
84             isa => Enum['soap', 'bwa'],
85             format => 's',
86             short => 't',
87             required => 1,
88             default => 'soap',
89             doc => "mapping software",
90             );
91              
92              
93             sub execute {
94 0     0 1   my ($self, $args_ref, $chain_ref) = @_;
95 0           my $stamp = time;
96 0           my $pre_message = "please input parameters, genome is required, either infile or indir is required";
97 0           my ($infile, $indir, $outfile, $outdir) = ($self->infile, $self->indir, $self->outfile, $self->outdir);
98 0 0 0       $self->options_usage(1, $pre_message) unless ($infile or $indir);
99 0           my ($genome, $tool, $process_tool, $process_sample) = ($self->genome, $self->tool, $self->process_tool, $self->process_sample);
100 0           my $bm = BioX::Map->new(
101             infile => $infile,
102             indir => $indir,
103             outfile => $outfile,
104             outdir => $outdir,
105             genome => $genome,
106             tool => $tool,
107             process_tool => $process_tool,
108             process_sample => $process_sample,
109             );
110 0           $bm->map;
111 0           my $m = time - $stamp;
112 0           say "duration second:" . (time - $stamp) . "\nduration minute:" . (int($m/60));
113             }
114              
115             1;
116              
117             __END__