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
|
|
3309
|
use App::SimulateReads::Base 'class'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
51
|
|
5
|
6
|
|
|
6
|
|
2324
|
use App::SimulateReads::Quality; |
|
6
|
|
|
|
|
2761
|
|
|
6
|
|
|
|
|
1599
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.05'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
10
|
|
|
|
|
|
|
# Moose attributes |
11
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
12
|
|
|
|
|
|
|
has 'quality_profile' => (is => 'ro', isa => 'My:QualityP', required => 1, coerce => 1); |
13
|
|
|
|
|
|
|
has 'read_size' => (is => 'ro', isa => 'My:IntGt0', required => 1); |
14
|
|
|
|
|
|
|
has '_quality' => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'App::SimulateReads::Quality', |
17
|
|
|
|
|
|
|
builder => '_build_quality', |
18
|
|
|
|
|
|
|
lazy_build => 1, |
19
|
|
|
|
|
|
|
handles => [qw{ gen_quality }] |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub BUILD { |
23
|
28
|
|
|
28
|
0
|
56
|
my $self = shift; |
24
|
|
|
|
|
|
|
## Just to ensure that the lazy attributes are built before &new returns |
25
|
28
|
|
|
|
|
936
|
$self->_quality; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#=== CLASS METHOD ============================================================ |
29
|
|
|
|
|
|
|
# CLASS: Fast |
30
|
|
|
|
|
|
|
# METHOD: _build_quality (BUILDER) |
31
|
|
|
|
|
|
|
# PARAMETERS: Void |
32
|
|
|
|
|
|
|
# RETURNS: Quality obj |
33
|
|
|
|
|
|
|
# DESCRIPTION: Build Quality object |
34
|
|
|
|
|
|
|
# THROWS: no exceptions |
35
|
|
|
|
|
|
|
# COMMENTS: none |
36
|
|
|
|
|
|
|
# SEE ALSO: n/a |
37
|
|
|
|
|
|
|
#=============================================================================== |
38
|
|
|
|
|
|
|
sub _build_quality { |
39
|
28
|
|
|
28
|
|
59
|
my $self = shift; |
40
|
28
|
|
|
|
|
833
|
App::SimulateReads::Quality->new( |
41
|
|
|
|
|
|
|
quality_profile => $self->quality_profile, |
42
|
|
|
|
|
|
|
read_size => $self->read_size |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} ## --- end sub _build_quality |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#=== CLASS METHOD ============================================================ |
47
|
|
|
|
|
|
|
# CLASS: Fast |
48
|
|
|
|
|
|
|
# METHOD: sprintf_fastq |
49
|
|
|
|
|
|
|
# PARAMETERS: $header_ref Ref Str, $seq_ref Ref Str |
50
|
|
|
|
|
|
|
# RETURNS: $fastq Ref Str |
51
|
|
|
|
|
|
|
# DESCRIPTION: Fastq entry template |
52
|
|
|
|
|
|
|
# THROWS: no exceptions |
53
|
|
|
|
|
|
|
# COMMENTS: none |
54
|
|
|
|
|
|
|
# SEE ALSO: n/a |
55
|
|
|
|
|
|
|
#=============================================================================== |
56
|
|
|
|
|
|
|
sub fastq_template { |
57
|
2289
|
|
|
2289
|
0
|
7259
|
my ($self, $header_ref, $seq_ref) = @_; |
58
|
2289
|
|
|
|
|
6421
|
my $quality_ref = $self->gen_quality; |
59
|
|
|
|
|
|
|
|
60
|
2289
|
|
|
|
|
6686
|
my $fastq = "\@$$header_ref\n"; |
61
|
2289
|
|
|
|
|
6154
|
$fastq .= "$$seq_ref\n"; |
62
|
2289
|
|
|
|
|
3645
|
$fastq .= "+\n"; |
63
|
2289
|
|
|
|
|
3523
|
$fastq .= "$$quality_ref"; |
64
|
|
|
|
|
|
|
|
65
|
2289
|
|
|
|
|
9597
|
return \$fastq; |
66
|
|
|
|
|
|
|
} ## --- end sub fastq_template |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=pod |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=encoding UTF-8 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
App::SimulateReads::Fastq - Base class to simulate fastq entries |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
version 0.05 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Teaching and Research Institute from SÃrio-Libanês Hospital. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is free software, licensed under: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |