line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::SimulateReads::Fastq::PairedEnd; |
2
|
|
|
|
|
|
|
# ABSTRACT: App::SimulateReads::Fastq subclass for simulate paired-end fastq entries. |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
4261
|
use App::SimulateReads::Base 'class'; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
49
|
|
5
|
6
|
|
|
6
|
|
2601
|
use App::SimulateReads::Read::PairedEnd; |
|
6
|
|
|
|
|
2450
|
|
|
6
|
|
|
|
|
2189
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'App::SimulateReads::Fastq'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.05'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
12
|
|
|
|
|
|
|
# Moose attributes |
13
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
has 'fragment_mean' => (is => 'rw', isa => 'My:IntGt0', required => 1); |
15
|
|
|
|
|
|
|
has 'fragment_stdd' => (is => 'rw', isa => 'My:IntGe0', required => 1); |
16
|
|
|
|
|
|
|
has 'sequencing_error' => (is => 'ro', isa => 'My:NumHS', required => 1); |
17
|
|
|
|
|
|
|
has '_read' => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => 'App::SimulateReads::Read::PairedEnd', |
20
|
|
|
|
|
|
|
builder => '_build_read', |
21
|
|
|
|
|
|
|
lazy_build => 1, |
22
|
|
|
|
|
|
|
handles => [qw{ gen_read }] |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#=== CLASS METHOD ============================================================ |
26
|
|
|
|
|
|
|
# CLASS: Fastq::PairedEnd |
27
|
|
|
|
|
|
|
# METHOD: _build_read (BUILDER) |
28
|
|
|
|
|
|
|
# PARAMETERS: Void |
29
|
|
|
|
|
|
|
# RETURNS: Read::PairedEnd obj |
30
|
|
|
|
|
|
|
# DESCRIPTION: Build a Read::PairedEnd object |
31
|
|
|
|
|
|
|
# THROWS: no exceptions |
32
|
|
|
|
|
|
|
# COMMENTS: none |
33
|
|
|
|
|
|
|
# SEE ALSO: n/a |
34
|
|
|
|
|
|
|
#=============================================================================== |
35
|
|
|
|
|
|
|
sub _build_read { |
36
|
3
|
|
|
3
|
|
18
|
my $self = shift; |
37
|
3
|
|
|
|
|
128
|
App::SimulateReads::Read::PairedEnd->new( |
38
|
|
|
|
|
|
|
sequencing_error => $self->sequencing_error, |
39
|
|
|
|
|
|
|
read_size => $self->read_size, |
40
|
|
|
|
|
|
|
fragment_mean => $self->fragment_mean, |
41
|
|
|
|
|
|
|
fragment_stdd => $self->fragment_stdd |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} ## --- end sub _build_read |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#=== CLASS METHOD ============================================================ |
46
|
|
|
|
|
|
|
# CLASS: Fastq::PairedEnd |
47
|
|
|
|
|
|
|
# METHOD: fastq |
48
|
|
|
|
|
|
|
# PARAMETERS: $id Str, $seq_name Str, $seq_ref Ref Str, $seq_size Int > 0, |
49
|
|
|
|
|
|
|
# $is_leader Bool |
50
|
|
|
|
|
|
|
# RETURNS: $fastq Ref Str |
51
|
|
|
|
|
|
|
# DESCRIPTION: Consumes sprint_fastq parent template, twice, to generate a |
52
|
|
|
|
|
|
|
# paired-end fastq entry |
53
|
|
|
|
|
|
|
# THROWS: no exceptions |
54
|
|
|
|
|
|
|
# COMMENTS: none |
55
|
|
|
|
|
|
|
# SEE ALSO: n/a |
56
|
|
|
|
|
|
|
#=============================================================================== |
57
|
|
|
|
|
|
|
sub sprint_fastq { |
58
|
572
|
|
|
572
|
0
|
8399
|
my ($self, $id, $seq_name, $seq_ref, $seq_size, $is_leader) = @_; |
59
|
|
|
|
|
|
|
|
60
|
572
|
|
|
|
|
1968
|
my ($read1_ref, $read2_ref, $fragment_pos, $fragment_size) = $self->gen_read($seq_ref, $seq_size, $is_leader); |
61
|
|
|
|
|
|
|
|
62
|
572
|
|
|
|
|
21123
|
my ($seq_pos1, $seq_pos2) = ( |
63
|
|
|
|
|
|
|
"$seq_name:" . ($fragment_pos + 1) . "-" . ($fragment_pos + $self->read_size), |
64
|
|
|
|
|
|
|
"$seq_name:" . ($fragment_pos + $fragment_size) . "-" . ($fragment_pos + $fragment_size - $self->read_size + 1) |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
572
|
100
|
|
|
|
1478
|
unless ($is_leader) { |
68
|
277
|
|
|
|
|
850
|
($seq_pos1, $seq_pos2) = ($seq_pos2, $seq_pos1); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
572
|
|
|
|
|
18699
|
my $header1 = "$id simulation_read length=" . $self->read_size . " position=$seq_pos1"; |
72
|
572
|
|
|
|
|
18496
|
my $header2 = "$id simulation_read length=" . $self->read_size . " position=$seq_pos2"; |
73
|
|
|
|
|
|
|
|
74
|
572
|
|
|
|
|
2301
|
my $fastq1_ref = $self->fastq_template(\$header1, $read1_ref); |
75
|
572
|
|
|
|
|
1783
|
my $fastq2_ref = $self->fastq_template(\$header2, $read2_ref); |
76
|
|
|
|
|
|
|
|
77
|
572
|
|
|
|
|
3452
|
return ($fastq1_ref, $fastq2_ref); |
78
|
|
|
|
|
|
|
} ## --- end sub sprint_fastq |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=pod |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=encoding UTF-8 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
App::SimulateReads::Fastq::PairedEnd - App::SimulateReads::Fastq subclass for simulate paired-end fastq entries. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 VERSION |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
version 0.05 |
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 |