line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::MLST::Databases; |
2
|
|
|
|
|
|
|
# ABSTRACT: List available MLST databases |
3
|
|
|
|
|
|
|
$Bio::MLST::Databases::VERSION = '2.1.1630910'; |
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
204383
|
use Moose; |
|
7
|
|
|
|
|
519942
|
|
|
7
|
|
|
|
|
58
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'base_directory' => ( is => 'ro', isa => 'Str', required => 1 ); |
8
|
|
|
|
|
|
|
has 'database_names' => ( is => 'ro', isa => 'ArrayRef', lazy => 1, builder => '_builder_database_names' ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _builder_database_names |
11
|
|
|
|
|
|
|
{ |
12
|
2
|
|
|
2
|
|
5
|
my($self) = @_; |
13
|
2
|
|
|
|
|
3
|
my @only_directories; |
14
|
2
|
|
|
|
|
65
|
opendir(my $dh,$self->base_directory); |
15
|
2
|
|
|
|
|
61
|
my @database_names = grep { /^[^\.]/ } readdir($dh); |
|
12
|
|
|
|
|
33
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
13
|
for my $file_or_dir_name (sort(@database_names)) |
18
|
|
|
|
|
|
|
{ |
19
|
8
|
50
|
|
|
|
228
|
next unless(-d ($self->base_directory.'/'.$file_or_dir_name)); |
20
|
8
|
|
|
|
|
20
|
push(@only_directories, $file_or_dir_name); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
90
|
return \@only_directories; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub print_db_list |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
29
|
0
|
|
|
|
|
|
for my $database_name (@{$self->database_names}) |
|
0
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
|
|
|
$database_name =~ s!_! !g; |
32
|
0
|
|
|
|
|
|
print $database_name."\n"; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
7
|
|
|
7
|
|
46957
|
no Moose; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
44
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=pod |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=encoding UTF-8 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 NAME |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Bio::MLST::Databases - List available MLST databases |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 VERSION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
version 2.1.1630910 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SYNOPSIS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
List available MLST databases |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
use Bio::MLST::Databases; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $mlst_dbs = Bio::MLST::Databases->new( |
62
|
|
|
|
|
|
|
base_directory => '/path/to/databases', |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
$mlst_dbs->print_db_list; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 print_db_list |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
List available MLST databases |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by Wellcome Trust Sanger Institute. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This is free software, licensed under: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |