Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 58ec350a81
Fetching contributors…

Cannot retrieve contributors at this time

executable file 71 lines (48 sloc) 1.792 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
#!/usr/bin/env perl

=head1 NAME

download_mlst_databases

=head1 SYNOPSIS

This script downloads all the MLST databases locally

=head1 DESCRIPTION
Downloads all the MLST databases to disk. It requires access to the Internet.

# download everything with defaults
download_mlst_databases

# XML file containing details of the MLST databases (from pubmlst)
download_mlst_databases -c my_config_file.json

# destination base directory defaults to the environment variable \$MLST_DATABASES
download_mlst_databases -b /path/to/destination

=head1 CONTACT

path-help@sanger.ac.uk

=head1 METHODS

=cut
package Download::Main;

use lib "/software/pathogen/internal/prod/lib";
use Moose;
use Getopt::Long;
use Bio::MLST::DatabaseSettings;
use Bio::MLST::Download::Databases;

my ($config_file, $base_directory, $help);

GetOptions ('c|config=s' => \$config_file,
            'b|base_directory=s' => \$base_directory,
            'h|help' => \$help,
);

(! $help)or die <<USAGE;
Usage: $0 [options]
Downloads all the MLST databases to disk

# download everything with defaults
download_mlst_databases

# XML file containing details of the MLST databases (from pubmlst)
download_mlst_databases -c my_config_file.json

# destination base directory defaults to the environment variable \$MLST_DATABASES
download_mlst_databases -b /path/to/destination

USAGE
;

$base_directory ||= $ENV{MLST_DATABASES};
$base_directory ||= '/lustre/scratch108/pathogen/pathpipe/mlst';

$config_file ||= 'http://pubmlst.org/data/dbases.xml';

my $database_settings = Bio::MLST::DatabaseSettings->new(filename => $config_file)->settings;
my $databases = Bio::MLST::Download::Databases->new(
  databases_attributes => $database_settings,
  base_directory => $base_directory
);
$databases->update();
Something went wrong with that request. Please try again.