File Coverage

lib/Bio/MLST/Download/Database.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Bio::MLST::Download::Database;
2             # ABSTRACT: Represents a single genus-species database on a single species
3             $Bio::MLST::Download::Database::VERSION = '2.1.1630910';
4              
5              
6 5     5   295362 use Moose;
  5         1230169  
  5         34  
7              
8             with 'Bio::MLST::Download::Downloadable';
9              
10             has 'database_attributes' => ( is => 'ro', isa => 'HashRef', required => 1 );
11             has 'base_directory' => ( is => 'ro', isa => 'Str', required => 1 );
12             has 'species' => ( is => 'ro', isa => 'Str', required => 1 );
13              
14             has 'destination_directory' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build_destination_directory' );
15              
16              
17             sub update
18             {
19 1     1 1 2 my ($self) = @_;
20              
21 1         2 for my $allele_file (@{$self->database_attributes->{alleles}})
  1         36  
22             {
23 2         62 $self->_download_file($allele_file,join('/',($self->destination_directory,'alleles')));
24             }
25 1         33 $self->_download_file($self->database_attributes->{profiles},join('/',($self->destination_directory,'profiles')));
26              
27 1         7 1;
28             }
29              
30              
31 5     5   29973 no Moose;
  5         9  
  5         26  
32             __PACKAGE__->meta->make_immutable;
33             1;
34              
35             __END__
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             Bio::MLST::Download::Database - Represents a single genus-species database on a single species
44              
45             =head1 VERSION
46              
47             version 2.1.1630910
48              
49             =head1 SYNOPSIS
50              
51             Represents a single genus-species database on a single species.
52              
53             use Bio::MLST::Download::Database;
54             my $database = Bio::MLST::Download::Database->new(
55            
56             database_attributes => \%database_attributes,
57             base_directory => '/path/to/abc'
58             );
59             $database->update;
60              
61             =head1 METHODS
62              
63             =head2 update
64              
65             Download the database files.
66              
67             =head1 SEE ALSO
68              
69             =over 4
70              
71             =item *
72              
73             L<Bio::MLST::Download::Downloadable>
74              
75             =back
76              
77             =head1 AUTHOR
78              
79             Andrew J. Page <ap13@sanger.ac.uk>
80              
81             =head1 COPYRIGHT AND LICENSE
82              
83             This software is Copyright (c) 2012 by Wellcome Trust Sanger Institute.
84              
85             This is free software, licensed under:
86              
87             The GNU General Public License, Version 3, June 2007
88              
89             =cut