File Coverage

lib/App/SimulateReads/Fastq.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 22 24 91.6


line stmt bran cond sub pod time code
1             package App::SimulateReads::Fastq;
2             # ABSTRACT: Base class to simulate fastq entries
3              
4 6     6   73342 use App::SimulateReads::Base 'class';
  6         12  
  6         45  
5 6     6   2323 use App::SimulateReads::Quality;
  6         2277  
  6         1445  
6              
7             our $VERSION = '0.06'; # VERSION
8              
9             has 'quality_profile' => (
10             is => 'ro',
11             isa => 'My:QualityP',
12             required => 1,
13             coerce => 1
14             );
15              
16             has 'read_size' => (
17             is => 'ro',
18             isa => 'My:IntGt0',
19             required => 1
20             );
21              
22             has '_quality' => (
23             is => 'ro',
24             isa => 'App::SimulateReads::Quality',
25             builder => '_build_quality',
26             lazy_build => 1,
27             handles => [qw{ gen_quality }]
28             );
29              
30             sub BUILD {
31 60     60 0 105 my $self = shift;
32             ## Just to ensure that the lazy attributes are built before &new returns
33 60         1580 $self->_quality;
34             }
35              
36             sub _build_quality {
37 60     60   110 my $self = shift;
38 60         1675 App::SimulateReads::Quality->new(
39             quality_profile => $self->quality_profile,
40             read_size => $self->read_size
41             );
42             }
43              
44             sub fastq_template {
45 2325     2325 0 13716 my ($self, $header_ref, $seq_ref) = @_;
46 2325         5926 my $quality_ref = $self->gen_quality;
47              
48 2325         5177 my $fastq = "\@$$header_ref\n";
49 2325         5169 $fastq .= "$$seq_ref\n";
50 2325         3117 $fastq .= "+\n";
51 2325         3157 $fastq .= "$$quality_ref";
52              
53 2325         8226 return \$fastq;
54             }
55              
56             __END__
57              
58             =pod
59              
60             =encoding UTF-8
61              
62             =head1 NAME
63              
64             App::SimulateReads::Fastq - Base class to simulate fastq entries
65              
66             =head1 VERSION
67              
68             version 0.06
69              
70             =head1 AUTHOR
71              
72             Thiago L. A. Miller <tmiller@mochsl.org.br>
73              
74             =head1 COPYRIGHT AND LICENSE
75              
76             This software is Copyright (c) 2017 by Teaching and Research Institute from Sírio-Libanês Hospital.
77              
78             This is free software, licensed under:
79              
80             The GNU General Public License, Version 3, June 2007
81              
82             =cut