line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::Seq::PairedEnd; |
2
|
|
|
|
|
|
|
# ABSTRACT: App::Sandy::Seq subclass for simulate paired-end entries. |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
7265
|
use App::Sandy::Base 'class'; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
67
|
|
5
|
6
|
|
|
6
|
|
2603
|
use App::Sandy::Read::PairedEnd; |
|
6
|
|
|
|
|
2012
|
|
|
6
|
|
|
|
|
5324
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'App::Sandy::Seq'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.25'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'fragment_mean' => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'My:IntGt0', |
14
|
|
|
|
|
|
|
required => 1 |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'fragment_stdd' => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => 'My:IntGe0', |
20
|
|
|
|
|
|
|
required => 1 |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has '_read' => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
isa => 'App::Sandy::Read::PairedEnd', |
26
|
|
|
|
|
|
|
builder => '_build_read', |
27
|
|
|
|
|
|
|
lazy_build => 1, |
28
|
|
|
|
|
|
|
handles => ['gen_read'] |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub BUILD { |
32
|
13
|
|
|
13
|
0
|
48
|
my $self = shift; |
33
|
|
|
|
|
|
|
## Just to ensure that the lazy attributes are built before &new returns |
34
|
13
|
|
|
|
|
379
|
$self->_read; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _build_read { |
38
|
13
|
|
|
13
|
|
49
|
my $self = shift; |
39
|
13
|
|
|
|
|
350
|
App::Sandy::Read::PairedEnd->new( |
40
|
|
|
|
|
|
|
sequencing_error => $self->sequencing_error, |
41
|
|
|
|
|
|
|
fragment_mean => $self->fragment_mean, |
42
|
|
|
|
|
|
|
fragment_stdd => $self->fragment_stdd |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
override '_build_sym_table' => sub { |
47
|
|
|
|
|
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
my $sym_table = super(); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my %sym_table_paired_end = ( |
51
|
|
|
|
|
|
|
'%M' => '$info->{fragment_mean}', |
52
|
|
|
|
|
|
|
'%D' => '$info->{fragment_stdd}', |
53
|
|
|
|
|
|
|
'%f' => '$info->{fragment_size}', |
54
|
|
|
|
|
|
|
'%S' => '$info->{fragment_start}', |
55
|
|
|
|
|
|
|
'%E' => '$info->{fragment_end}', |
56
|
|
|
|
|
|
|
'%X' => '$info->{fragment_start_ref}', |
57
|
|
|
|
|
|
|
'%Z' => '$info->{fragment_end_ref}', |
58
|
|
|
|
|
|
|
'%F' => '$info->{fragment_strand}', |
59
|
|
|
|
|
|
|
'%A' => '$info->{mate_start_ref}', |
60
|
|
|
|
|
|
|
'%B' => '$info->{mate_end_ref}', |
61
|
|
|
|
|
|
|
'%T' => '$info->{mate_start}', |
62
|
|
|
|
|
|
|
'%N' => '$info->{mate_end}', |
63
|
|
|
|
|
|
|
'%L' => '$info->{tlen}', |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
@$sym_table{keys %sym_table_paired_end} = values %sym_table_paired_end; |
67
|
|
|
|
|
|
|
return $sym_table; |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
override '_build_info' => sub { |
71
|
|
|
|
|
|
|
my $self = shift; |
72
|
|
|
|
|
|
|
my $info = super(); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my %info_paired_end = ( |
75
|
|
|
|
|
|
|
fragment_mean => $self->fragment_mean, |
76
|
|
|
|
|
|
|
fragment_stdd => $self->fragment_stdd |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
@$info{keys %info_paired_end} = values %info_paired_end; |
80
|
|
|
|
|
|
|
return $info; |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub sprint_seq { |
84
|
2282
|
|
|
2282
|
0
|
26741
|
my ($self, $id, $num, $seq_id, $seq_id_type, $ptable, $ptable_size, $is_leader, $rng, $blacklist) = @_; |
85
|
|
|
|
|
|
|
|
86
|
2282
|
|
|
|
|
75879
|
my $read_size = $self->_get_read_size($rng); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# In order to work third gen sequencing |
89
|
|
|
|
|
|
|
# simulator, it is necessary to truncate |
90
|
|
|
|
|
|
|
# the read according to the ptable size |
91
|
2282
|
50
|
|
|
|
4999
|
if ($read_size > $ptable_size) { |
92
|
0
|
|
|
|
|
0
|
$read_size = $ptable_size; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
2282
|
|
|
|
|
7358
|
my ($read1_ref, $read2_ref, $attr) = $self->gen_read($ptable, $ptable_size, |
96
|
|
|
|
|
|
|
$read_size, $is_leader, $rng, $blacklist); |
97
|
|
|
|
|
|
|
|
98
|
2282
|
|
|
|
|
4680
|
my $annot_a = $attr->{annot}; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
$self->_set_info( |
101
|
|
|
|
|
|
|
'id' => $id, |
102
|
|
|
|
|
|
|
'num' => $num, |
103
|
|
|
|
|
|
|
'seq_id' => $seq_id, |
104
|
|
|
|
|
|
|
'seq_id_type' => $seq_id_type, |
105
|
|
|
|
|
|
|
'read_size' => $read_size, |
106
|
|
|
|
|
|
|
'fragment_start' => $attr->{start}, |
107
|
|
|
|
|
|
|
'fragment_end' => $attr->{end}, |
108
|
|
|
|
|
|
|
'fragment_start_ref' => $attr->{start_ref}, |
109
|
|
|
|
|
|
|
'fragment_end_ref' => $attr->{end_ref}, |
110
|
2282
|
100
|
|
|
|
80291
|
'fragment_size' => $attr->{end} - $attr->{start} + 1, |
|
|
50
|
|
|
|
|
|
111
|
|
|
|
|
|
|
'fragment_strand' => $is_leader ? 'P' : 'M', |
112
|
|
|
|
|
|
|
'var' => @$annot_a ? join ',' => @$annot_a : 'none' |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
2282
|
100
|
|
|
|
8015
|
return $is_leader |
116
|
|
|
|
|
|
|
? ($self->_sprint_seq($read1_ref, $read_size, 1, $attr, 1, $rng), $self->_sprint_seq($read2_ref, $read_size, 2, $attr, 0, $rng)) |
117
|
|
|
|
|
|
|
: ($self->_sprint_seq($read2_ref, $read_size, 1, $attr, 0, $rng), $self->_sprint_seq($read1_ref, $read_size, 2, $attr, 1, $rng)); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub _sprint_seq { |
121
|
4564
|
|
|
4564
|
|
9524
|
my ($self, $read_ref, $read_size, $read_num, $attr, $is_leader, $rng) = @_; |
122
|
|
|
|
|
|
|
|
123
|
4564
|
100
|
|
|
|
8289
|
if ($is_leader) { |
124
|
2282
|
|
|
|
|
3641
|
my $error_a = $attr->{error1}; |
125
|
2282
|
|
|
|
|
3874
|
my $tlen = $attr->{end2} - $attr->{end1}; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$self->_set_info( |
128
|
|
|
|
|
|
|
'start' => $attr->{start1}, |
129
|
|
|
|
|
|
|
'end' => $attr->{end1}, |
130
|
|
|
|
|
|
|
'start_ref' => $attr->{start_ref}, |
131
|
|
|
|
|
|
|
'end_ref' => $attr->{read_end_ref}, |
132
|
|
|
|
|
|
|
'mate_start' => $attr->{start2}, |
133
|
|
|
|
|
|
|
'mate_end' => $attr->{end2}, |
134
|
|
|
|
|
|
|
'mate_start_ref' => $attr->{end_ref}, |
135
|
|
|
|
|
|
|
'mate_end_ref' => $attr->{read_start_ref}, |
136
|
2282
|
50
|
|
|
|
80796
|
'read' => $read_num, |
|
|
50
|
|
|
|
|
|
137
|
|
|
|
|
|
|
'strand' => 'P', |
138
|
|
|
|
|
|
|
'tlen' => $tlen > 0 ? $tlen : 0, |
139
|
|
|
|
|
|
|
'error' => @$error_a ? join ',' => @$error_a : 'none' |
140
|
|
|
|
|
|
|
); |
141
|
|
|
|
|
|
|
} else { |
142
|
2282
|
|
|
|
|
3734
|
my $error_a = $attr->{error2}; |
143
|
2282
|
|
|
|
|
4045
|
my $tlen = $attr->{end1} - $attr->{end2}; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
$self->_set_info( |
146
|
|
|
|
|
|
|
'start' => $attr->{start2}, |
147
|
|
|
|
|
|
|
'end' => $attr->{end2}, |
148
|
|
|
|
|
|
|
'start_ref' => $attr->{end_ref}, |
149
|
|
|
|
|
|
|
'end_ref' => $attr->{read_start_ref}, |
150
|
|
|
|
|
|
|
'mate_start' => $attr->{start1}, |
151
|
|
|
|
|
|
|
'mate_end' => $attr->{end1}, |
152
|
|
|
|
|
|
|
'mate_start_ref' => $attr->{start_ref}, |
153
|
|
|
|
|
|
|
'mate_end_ref' => $attr->{read_end_ref}, |
154
|
2282
|
50
|
|
|
|
80487
|
'read' => $read_num, |
|
|
50
|
|
|
|
|
|
155
|
|
|
|
|
|
|
'strand' => 'M', |
156
|
|
|
|
|
|
|
'tlen' => $tlen < 0 ? $tlen : 0, |
157
|
|
|
|
|
|
|
'error' => @$error_a ? join ',' => @$error_a : 'none' |
158
|
|
|
|
|
|
|
); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
4564
|
|
|
|
|
119700
|
my $seqid = $self->_gen_id($self->_info); |
162
|
4564
|
|
|
|
|
16499
|
my $quality_ref = $self->gen_quality($read_size, $rng); |
163
|
|
|
|
|
|
|
|
164
|
4564
|
|
|
|
|
153144
|
return $self->_gen_seq(\$seqid, $read_ref, $quality_ref, $read_num, $read_size); |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
__END__ |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=pod |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=encoding UTF-8 |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 NAME |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
App::Sandy::Seq::PairedEnd - App::Sandy::Seq subclass for simulate paired-end entries. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 VERSION |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
version 0.25 |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 AUTHORS |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=over 4 |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item * |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item * |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item * |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item * |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item * |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item * |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item * |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item * |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Rafael Mercuri <rmercuri@mochsl.org.br> |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item * |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item * |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=back |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by Teaching and Research Institute from Sírio-Libanês Hospital. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
This is free software, licensed under: |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=cut |