File Coverage

lib/App/SimulateReads/Read/SingleEnd.pm
Criterion Covered Total %
statement 12 12 100.0
branch 4 4 100.0
condition n/a
subroutine 2 2 100.0
pod 0 1 0.0
total 18 19 94.7


line stmt bran cond sub pod time code
1             package App::SimulateReads::Read::SingleEnd;
2             # ABSTRACT: App::SimulateReads::Read subclass for simulate single-end reads.
3              
4 6     6   52 use App::SimulateReads::Base 'class';
  6         16  
  6         57  
5              
6             extends 'App::SimulateReads::Read';
7              
8             our $VERSION = '0.05'; # VERSION
9              
10             #=== CLASS METHOD ============================================================
11             # CLASS: Read::SingleEnd
12             # METHOD: gen_read
13             # PARAMETERS: $seq_ref Ref Str, $seq_size Int > 0, $is_leader Bool
14             # RETURNS: $read_ref Ref Str, $read_pos Int >= 0
15             # DESCRIPTION: Generate single-end read
16             # THROWS: If $seq_size less then read_size, throws an error message
17             # COMMENTS: none
18             # SEE ALSO: n/a
19             #===============================================================================
20             sub gen_read {
21 1163     1163 0 26367 my ($self, $seq_ref, $seq_size, $is_leader) = @_;
22             # seq_size must be greater or equal to read_size
23 1163 100       32791 if ($seq_size < $self->read_size) {
24 1         29 croak "Single-end read fail: The constraints were not met:\n" .
25             "seq_size ($seq_size) >= read_size (" . $self->read_size . ")\n";
26             }
27              
28 1162         31337 my ($read_ref, $read_pos) = $self->subseq_rand($seq_ref, $seq_size, $self->read_size);
29              
30 1162 100       2726 unless ($is_leader) {
31 568         1520 $self->reverse_complement($read_ref);
32             }
33              
34 1162         32320 $self->update_count_base($self->read_size);
35 1162         3681 $self->insert_sequencing_error($read_ref);
36 1162         3852 return ($read_ref, $read_pos);
37             } ## --- end sub gen_read
38              
39             __END__
40              
41             =pod
42              
43             =encoding UTF-8
44              
45             =head1 NAME
46              
47             App::SimulateReads::Read::SingleEnd - App::SimulateReads::Read subclass for simulate single-end reads.
48              
49             =head1 VERSION
50              
51             version 0.05
52              
53             =head1 AUTHOR
54              
55             Thiago L. A. Miller <tmiller@mochsl.org.br>
56              
57             =head1 COPYRIGHT AND LICENSE
58              
59             This software is Copyright (c) 2017 by Teaching and Research Institute from Sírio-Libanês Hospital.
60              
61             This is free software, licensed under:
62              
63             The GNU General Public License, Version 3, June 2007
64              
65             =cut