Skip to content

Instantly share code, notes, and snippets.

@pcantalupo
Created November 5, 2014 19:39
Show Gist options
  • Select an option

  • Save pcantalupo/00384ffef49c77b62d80 to your computer and use it in GitHub Desktop.

Select an option

Save pcantalupo/00384ffef49c77b62d80 to your computer and use it in GitHub Desktop.
Download and extract NCBI taxonomy files
#!/usr/bin/env perl
my $base = "ftp://ftp.ncbi.nlm.nih.gov/pub/taxonomy/";
my @files = qw/gi_taxid_nucl.dmp.gz
gi_taxid_prot.dmp.gz
taxdump.tar.gz
taxcat.tar.gz/;
foreach my $file (@files) {
my $ftpfile = $base . $file;
print "Getting $file ($ftpfile)\n";
system ("wget", $ftpfile);
print "Extracting $file\n";
if ($file =~ /tar.gz$/) {
system("tar","xvzf", $file);
}
else {
system ("gunzip", "-f", $file);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment