line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Resistome::Input::FileOnePerLine; |
2
|
|
|
|
|
|
|
# ABSTRACT: File containing a list of input data, one per line. |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
180869
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Bio::Resistome::Input::Exceptions; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'filename' => ( is => 'ro', isa => 'Str', required => 1 ); |
9
|
|
|
|
|
|
|
has 'file_line_data' => ( is => 'ro', isa => 'ArrayRef[Str]', lazy => 1, builder => '_build_file_line_data' ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _build_file_line_data |
12
|
|
|
|
|
|
|
{ |
13
|
|
|
|
|
|
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
open(my $fh, $self->filename) or Bio::Resistome::Input::Exceptions::FileDoesntExist->throw(error => 'Couldnt open file '.$self->filename); |
16
|
|
|
|
|
|
|
my @file_line_data; |
17
|
|
|
|
|
|
|
while(<$fh>) |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
chomp; |
20
|
|
|
|
|
|
|
my $line = $_; |
21
|
|
|
|
|
|
|
next if( $line =~ /^\#/); |
22
|
|
|
|
|
|
|
next if( $line eq ""); |
23
|
|
|
|
|
|
|
push(@file_line_data, $line); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
return \@file_line_data; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
no Moose; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Bio::Resistome::Input::FileOnePerLine - File containing a list of input data, one per line. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 VERSION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
version 1.123560 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
File containing a list of input data, one per line. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use Bio::Resistome::Input::FileOnePerLine; |
51
|
|
|
|
|
|
|
my $obj = Bio::Resistome::Input::FileOnePerLine->new( |
52
|
|
|
|
|
|
|
filename => 'input_file.txt' |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
$obj->file_line_data; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 file_line_data |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Returns an array with the input data from the file. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by Wellcome Trust Sanger Institute. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is free software, licensed under: |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |