File Coverage

lib/App/SimulateReads/Command/QualityDB.pm
Criterion Covered Total %
statement 6 24 25.0
branch 0 4 0.0
condition n/a
subroutine 2 7 28.5
pod 2 3 66.6
total 10 38 26.3


line stmt bran cond sub pod time code
1             package App::SimulateReads::Command::QualityDB;
2             # ABSTRACT: qualitydb command class. Manage quality profile database.
3              
4 1     1   427 use App::SimulateReads::Base 'class';
  1         2  
  1         5  
5 1     1   7 use App::SimulateReads::Quality::Handle;
  1         3  
  1         515  
6              
7             extends 'App::SimulateReads::CLI::Command';
8              
9             our $VERSION = '0.06'; # VERSION
10              
11             has 'db' => (
12             is => 'ro',
13             isa => 'App::SimulateReads::Quality::Handle',
14             builder => '_build_db',
15             lazy_build => 1,
16             handles => [qw/insertdb restoredb deletedb make_report/]
17             );
18              
19             sub _build_db {
20 0     0     return App::SimulateReads::Quality::Handle->new;
21             }
22              
23             override 'opt_spec' => sub {
24             super
25             };
26              
27             sub subcommand_map {
28 0     0 0   add => 'App::SimulateReads::Command::QualityDB::Add',
29             remove => 'App::SimulateReads::Command::QualityDB::Remove',
30             restore => 'App::SimulateReads::Command::QualityDB::Restore'
31             }
32              
33             sub validate_args {
34 0     0 1   my ($self, $args) = @_;
35 0 0         die "Too many arguments: '@$args'\n" if @$args;
36             }
37              
38             sub execute {
39 0     0 1   my ($self, $opts, $args) = @_;
40 0           return $self->_print_report;
41             }
42              
43             sub _print_report {
44 0     0     my $self = shift;
45 0           my $report_ref = $self->make_report;
46 0 0         return if not defined $report_ref;
47              
48 0           my $format = "\t%*s\t%*s\t%*s\t%*s\n";
49 0           my ($s1, $s2, $s3, $s4) = map {length} qw/sequencing_system/x4;
  0            
50 0           printf $format => $s1, "sequencing system", $s2, "size", $s3, "source", $s4, "provider";
51              
52 0           for my $sequencing_system (sort keys %$report_ref) {
53 0           my $attr = $report_ref->{$sequencing_system};
54 0           for my $entry (sort { $a->{size} <=> $b->{size} } @$attr) {
  0            
55 0           printf $format => $s1, $sequencing_system, $s2, $entry->{size}, $s3, $entry->{source}, $s4, $entry->{provider};
56             }
57             }
58             }
59              
60             __END__
61              
62             =pod
63              
64             =encoding UTF-8
65              
66             =head1 NAME
67              
68             App::SimulateReads::Command::QualityDB - qualitydb command class. Manage quality profile database.
69              
70             =head1 VERSION
71              
72             version 0.06
73              
74             =head1 SYNOPSIS
75              
76             simulate_reads qualitydb
77             simulate_reads qualitydb [options]
78             simulate_reads qualitydb <command>
79              
80             Options:
81             -h, --help brief help message
82             -M, --man full documentation
83            
84             Subcommands:
85             add add a new quality profile to database
86             remove remove an user quality profle from database
87             restore restore the database
88              
89             =head1 DESCRIPTION
90              
91             B<simulate_reads> will read the given input file and do something
92             useful with the contents thereof.
93              
94             =head1 AUTHOR
95              
96             Thiago L. A. Miller <tmiller@mochsl.org.br>
97              
98             =head1 COPYRIGHT AND LICENSE
99              
100             This software is Copyright (c) 2017 by Teaching and Research Institute from Sírio-Libanês Hospital.
101              
102             This is free software, licensed under:
103              
104             The GNU General Public License, Version 3, June 2007
105              
106             =cut