lib/App/Sandy/Seq/SingleEnd.pm

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 4 / 4 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« lib/App/Sandy/Seq/PairedEnd.pm ↑ Summary lib/App/Sandy/Simulator.pm »
1 package App::Sandy::Seq::SingleEnd;
2 # ABSTRACT: App::Sandy::Seq subclass for simulate single-end entries.
3  
4 1 ▶use App::Sandy::Base 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 use App::Sandy::Read::SingleEnd;
6  
7 extends 'App::Sandy::Seq';
8  
9 our $VERSION = '0.25'; # VERSION
10  
11 has '_read' => (
12 is => 'ro',
13 isa => 'App::Sandy::Read::SingleEnd',
14 builder => '_build_read',
15 lazy_build => 1,
16 handles => ['gen_read']
17 );
18  
19 sub BUILD {
20 my $self = shift;
21 ## Just to ensure that the lazy attributes are built before &new returns
22 $self->_read;
23 }
24  
25 sub _build_read {
26 my $self = shift;
27 App::Sandy::Read::SingleEnd->new(
28 sequencing_error => $self->sequencing_error
29 );
30 }
31  
32 sub sprint_seq {
33 my ($self, $id, $num, $seq_id, $seq_id_type, $ptable, $ptable_size, $is_leader, $rng, $blacklist) = @_;
34  
35 my $read_size = $self->_get_read_size($rng);
36  
37 # In order to work third gen sequencing
38 # simulator, it is necessary to truncate
39 # the read according to the ptable size
40 if ($read_size > $ptable_size) {
41 $read_size = $ptable_size;
42 }
43  
44 my ($read_ref, $attr) = $self->gen_read($ptable, $ptable_size, $read_size, $is_leader, $rng, $blacklist);
45  
46 my $error_a = $attr->{error};
47 my $error = @$error_a
48 ? join ',' => @$error_a
49 : 'none';
50  
51 my $annot_a = $attr->{annot};
52 my $var = @$annot_a
53 ? join ',' => @$annot_a
54 : 'none';
55  
56 $self->_set_info(
57 'id' => $id,
58 'num' => $num,
59 'seq_id' => $seq_id,
60 'read' => 1,
61 'error' => $error,
62 'var' => $var,
63 'seq_id_type' => $seq_id_type,
64 'read_size' => $read_size,
65 $is_leader
66 ? (
67 'start' => $attr->{start},
68 'end' => $attr->{end},
69 'start_ref' => $attr->{start_ref},
70 'end_ref' => $attr->{end_ref},
71 'strand' => 'P')
72 : (
73 'start' => $attr->{end},
74 'end' => $attr->{start},
75 'start_ref' => $attr->{end_ref},
76 'end_ref' => $attr->{start_ref},
77 'strand' => 'M')
78 );
79  
80 my $seqid = $self->_gen_id($self->_info);
81 my $quality_ref = $self->gen_quality($read_size, $rng);
82  
83 return $self->_gen_seq(\$seqid, $read_ref, $quality_ref, 0, $read_size);
84 }
85  
86 __END__
« lib/App/Sandy/Seq/PairedEnd.pm ↑ Summary lib/App/Sandy/Simulator.pm »