line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::Read::PairedEnd; |
2
|
|
|
|
|
|
|
# ABSTRACT: App::Sandy::Read subclass for simulate paired-end reads. |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
47
|
use App::Sandy::Base 'class'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
47
|
use constant NUM_TRIES => 1000; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
3452
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'App::Sandy::Read'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'App::Sandy::Role::RNorm'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.22'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'fragment_mean' => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'My:IntGt0', |
17
|
|
|
|
|
|
|
required => 1 |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'fragment_stdd' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => 'My:IntGe0', |
23
|
|
|
|
|
|
|
required => 1 |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub gen_read { |
27
|
690
|
|
|
690
|
0
|
6550
|
my ($self, $ptable, $ptable_size, $read_size, $is_leader) = @_; |
28
|
|
|
|
|
|
|
|
29
|
690
|
50
|
33
|
|
|
19718
|
unless ($read_size <= $self->fragment_mean && $self->fragment_mean <= $ptable_size) { |
30
|
0
|
|
|
|
|
0
|
croak sprintf |
31
|
|
|
|
|
|
|
"read_size (%d) must be leseer or equal to fragment_mean (%d) and\n" . |
32
|
|
|
|
|
|
|
"fragment_mean (%d) must be lesser or equal to ptable_size (%d)" |
33
|
|
|
|
|
|
|
=> $read_size, $self->fragment_mean, $self->fragment_mean, $ptable_size; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
690
|
|
|
|
|
1344
|
my $fragment_size = 0; |
37
|
690
|
|
|
|
|
1086
|
my $random_tries = 0; |
38
|
|
|
|
|
|
|
|
39
|
690
|
|
66
|
|
|
3104
|
until (($fragment_size <= $ptable_size) && ($fragment_size >= $read_size)) { |
40
|
|
|
|
|
|
|
# ptable_size must be greater or equal to fragment_size and |
41
|
|
|
|
|
|
|
# fragment_size must be greater or equal to read_size |
42
|
|
|
|
|
|
|
# As fragment_size is randomly calculated, try out NUM_TRIES times |
43
|
690
|
50
|
|
|
|
1620
|
if (++$random_tries > NUM_TRIES) { |
44
|
0
|
|
|
|
|
0
|
croak sprintf |
45
|
|
|
|
|
|
|
"So many tries to calculate a fragment. the constraints were not met:\n" . |
46
|
|
|
|
|
|
|
"fragment_size <= ptable_size (%d) and fragment_size >= read_size (%d)" |
47
|
|
|
|
|
|
|
=> $ptable_size, $read_size; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
690
|
|
|
|
|
19091
|
$fragment_size = $self->with_random_half_normal($self->fragment_mean, |
51
|
|
|
|
|
|
|
$self->fragment_stdd); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Build the fragment string |
55
|
690
|
|
|
|
|
14421
|
my ($fragment_ref, $attr) = $self->subseq_rand_ptable($ptable, |
56
|
|
|
|
|
|
|
$ptable_size, $fragment_size, $read_size); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Catch R1 substring |
59
|
690
|
|
|
|
|
2607
|
my $read1_ref = $self->subseq($fragment_ref, $fragment_size, $read_size, 0); |
60
|
690
|
|
|
|
|
3067
|
@$attr{qw/start1 end1/} = ($attr->{start}, $attr->{start} + $read_size - 1); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Insert sequencing error |
63
|
690
|
|
|
|
|
2374
|
$attr->{error1} = $self->insert_sequencing_error($read1_ref, $read_size); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Catch R2 substring |
66
|
690
|
|
|
|
|
2289
|
my $read2_ref = $self->subseq($fragment_ref, $fragment_size, $read_size, |
67
|
|
|
|
|
|
|
$fragment_size - $read_size); |
68
|
690
|
|
|
|
|
2275
|
@$attr{qw/start2 end2/} = ($attr->{end}, $attr->{end} - $read_size + 1); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Reverse completement |
71
|
690
|
|
|
|
|
2267
|
$self->reverse_complement($read2_ref); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Insert sequencing error |
74
|
690
|
|
|
|
|
1627
|
$attr->{error2} = $self->insert_sequencing_error($read2_ref, $read_size); |
75
|
|
|
|
|
|
|
|
76
|
690
|
|
|
|
|
3230
|
return ($read1_ref, $read2_ref, $attr); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=encoding UTF-8 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
App::Sandy::Read::PairedEnd - App::Sandy::Read subclass for simulate paired-end reads. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 VERSION |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
version 0.22 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHORS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 4 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This software is Copyright (c) 2018 by Teaching and Research Institute from SÃrio-Libanês Hospital. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This is free software, licensed under: |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |