line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::Role::IO; |
2
|
|
|
|
|
|
|
# ABSTRACT: Input and output custom wrappers. |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
4945
|
use App::Sandy::Base 'role'; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
63
|
|
5
|
6
|
|
|
6
|
|
3012
|
use App::Sandy::BGZF; |
|
6
|
|
|
|
|
40141
|
|
|
6
|
|
|
|
|
247
|
|
6
|
6
|
|
|
6
|
|
61
|
use IO::Compress::Gzip '$GzipError'; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
549
|
|
7
|
6
|
|
|
6
|
|
3256
|
use PerlIO::gzip; |
|
6
|
|
|
|
|
4714
|
|
|
6
|
|
|
|
|
2706
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.24'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub with_open_r { |
12
|
20
|
|
|
20
|
0
|
45
|
my ($self, $file) = @_; |
13
|
|
|
|
|
|
|
|
14
|
20
|
|
|
|
|
35
|
my $fh; |
15
|
20
|
50
|
|
|
|
60
|
my $mode = $file =~ /\.gz$/ ? "<:gzip" : "<"; |
16
|
|
|
|
|
|
|
|
17
|
20
|
50
|
|
|
|
915
|
open $fh, $mode => $file |
18
|
|
|
|
|
|
|
or die "Not possible to read $file: $!\n"; |
19
|
|
|
|
|
|
|
|
20
|
20
|
|
|
|
|
135
|
return $fh; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub with_open_w { |
24
|
10
|
|
|
10
|
0
|
143
|
my ($self, $file, $level) = @_; |
25
|
|
|
|
|
|
|
|
26
|
10
|
|
|
|
|
51
|
my $fh; |
27
|
|
|
|
|
|
|
|
28
|
10
|
50
|
|
|
|
68
|
if ($level) { |
29
|
0
|
0
|
|
|
|
0
|
$fh = IO::Compress::Gzip->new($file, -Level => $level) |
30
|
|
|
|
|
|
|
or die "Not possible to create $file: $GzipError\n"; |
31
|
|
|
|
|
|
|
} else { |
32
|
10
|
50
|
|
|
|
1910
|
open $fh, '>' => $file |
33
|
|
|
|
|
|
|
or die "Not possible to create $file: $!\n"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
10
|
|
|
|
|
87
|
return $fh; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub with_open_a { |
40
|
5
|
|
|
5
|
0
|
68
|
my ($self, $file) = @_; |
41
|
|
|
|
|
|
|
|
42
|
5
|
50
|
|
|
|
283
|
open my $fh, '>>' => $file |
43
|
|
|
|
|
|
|
or die "Not possible to append to $file: $!\n"; |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
62
|
return $fh; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub with_open_bam_w { |
49
|
0
|
|
|
0
|
0
|
|
my ($self, $file, $level) = @_; |
50
|
0
|
|
|
|
|
|
my $fh = App::Sandy::BGZF->new_filehandle($file, $level); |
51
|
0
|
|
|
|
|
|
return $fh; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=encoding UTF-8 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
App::Sandy::Role::IO - Input and output custom wrappers. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
version 0.24 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHORS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Rafael Mercuri <rmercuri@mochsl.org.br> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by Teaching and Research Institute from Sírio-Libanês Hospital. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This is free software, licensed under: |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |