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.1706216';
4              
5              
6 4     4   207939 use Moose;
  4         958262  
  4         25  
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         1 for my $allele_file (@{$self->database_attributes->{alleles}})
  1         31  
22             {
23 2         47 $self->_download_file($allele_file,join('/',($self->destination_directory,'alleles')));
24             }
25 1         27 $self->_download_file($self->database_attributes->{profiles},join('/',($self->destination_directory,'profiles')));
26              
27 1         4 1;
28             }
29              
30              
31 4     4   20544 no Moose;
  4         8  
  4         22  
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.1706216
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