File Coverage

lib/App/SimulateReads/Fastq/SingleEnd.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
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::SingleEnd;
2             # ABSTRACT: App::SimulateReads::Fastq subclass for simulate single-end fastq entries.
3              
4 6     6   2025 use App::SimulateReads::Base 'class';
  6         13  
  6         30  
5 6     6   2092 use App::SimulateReads::Read::SingleEnd;
  6         1707  
  6         1632  
6              
7             extends 'App::SimulateReads::Fastq';
8              
9             our $VERSION = '0.06'; # VERSION
10              
11             has 'sequencing_error' => (
12             is => 'ro',
13             isa => 'My:NumHS',
14             required => 1
15             );
16              
17             has '_read' => (
18             is => 'ro',
19             isa => 'App::SimulateReads::Read::SingleEnd',
20             builder => '_build_read',
21             lazy_build => 1,
22             handles => [qw{ gen_read }]
23             );
24              
25             sub BUILD {
26 25     25 0 40 my $self = shift;
27             ## Just to ensure that the lazy attributes are built before &new returns
28 25         685 $self->_read;
29             }
30              
31             sub _build_read {
32 25     25   40 my $self = shift;
33 25         720 App::SimulateReads::Read::SingleEnd->new(
34             sequencing_error => $self->sequencing_error,
35             read_size => $self->read_size
36             );
37             }
38              
39             sub sprint_fastq {
40 1150     1150 0 16673 my ($self, $id, $seq_name, $seq_ref, $seq_size, $is_leader) = @_;
41              
42 1150         3093 my ($read_ref, $pos) = $self->gen_read($seq_ref, $seq_size, $is_leader);
43              
44 1150 100       30636 my $seq_pos = $is_leader ?
45             "$seq_name:" . ($pos + 1) . "-" . ($pos + $self->read_size) :
46             "$seq_name:" . ($pos + $self->read_size) . "-" . ($pos + 1);
47              
48 1150         26795 my $header = "$id simulation_read length=" . $self->read_size . " position=$seq_pos";
49              
50 1150         3432 return $self->fastq_template(\$header, $read_ref);
51             }
52              
53             __END__
54              
55             =pod
56              
57             =encoding UTF-8
58              
59             =head1 NAME
60              
61             App::SimulateReads::Fastq::SingleEnd - App::SimulateReads::Fastq subclass for simulate single-end fastq entries.
62              
63             =head1 VERSION
64              
65             version 0.06
66              
67             =head1 AUTHOR
68              
69             Thiago L. A. Miller <tmiller@mochsl.org.br>
70              
71             =head1 COPYRIGHT AND LICENSE
72              
73             This software is Copyright (c) 2017 by Teaching and Research Institute from Sírio-Libanês Hospital.
74              
75             This is free software, licensed under:
76              
77             The GNU General Public License, Version 3, June 2007
78              
79             =cut