[med-svn] r1289 - trunk/community/infrastructure
smoe-guest at alioth.debian.org
smoe-guest at alioth.debian.org
Tue Feb 5 16:15:41 UTC 2008
Author: smoe-guest
Date: 2008-02-05 16:15:41 +0000 (Tue, 05 Feb 2008)
New Revision: 1289
Modified:
trunk/community/infrastructure/getData.pl
Log:
Works! Added KEGG and IntACT. Reads /etc/default/getData.
Modified: trunk/community/infrastructure/getData.pl
===================================================================
--- trunk/community/infrastructure/getData.pl 2008-02-04 13:04:05 UTC (rev 1288)
+++ trunk/community/infrastructure/getData.pl 2008-02-05 16:15:41 UTC (rev 1289)
@@ -28,11 +28,28 @@
# Or else go to GNU Web pages http://www.gnu.org and follow the white rabbit.
#
-my $rootdir = "/var/lib/mirrored";
+my $mirrordir;
+my $configfile="/etc/default/getData";
+if ( -r $configfile ) {
+ open(FH,"<$configfile") or die "Could not open config data at '$configfile'.\n";
+ while(<FH>) {
+ next if /^\s*#/;
+ next unless /\s*(\S.*\S)\s*=\s*"([^"]*)"\s*/;
+ #print STDERR "Read: $1\n";
+ if ($1 eq "mirrordir") {
+ $mirrordir=$2;
+ print STDERR "Set mirrordir to '$mirrordir'.\n";
+ }
+ }
+ close FH;
+}
+
+$mirrordir = "/var/lib/mirrored" unless defined($mirrordir);
+
=head1 SYNOPSIS
-getData.pl [ --rootdir <path> ] <list of db names>
+getData.pl [ --mirrordir <path> ] <list of db names>
getData.pl --list
=head1 DESCRIPTION
@@ -67,9 +84,9 @@
Present a more detailed description in form of a man page.
-=item --rootdir <path>
+=item --mirrordir <path>
- Specifies destination directory. The data will be mirrored to $rootdir/$dbname/
+ Specifies destination directory. The data will be mirrored to $mirrordir/$dbname/
=item --list
@@ -111,6 +128,8 @@
my %toBeMirrored = (
+# A S T R O N O M Y
+
# "tycho2" => {
# name => "Tycho2 Star Coordinates",
# source => "wget --mirror ftp://cdsarc.u-strasbg.fr/pub/cats/I/259/tyc2.dat*",
@@ -127,7 +146,31 @@
# . "-a ftp.lowell.edu/pub/elgb/astorb.dat.gz -nt astorb.dat ] "
# . "|| zcat ftp.lowell.edu/pub/elgb/astorb.dat.gz > astorb.dat"
# },
-#
+
+# B I O I N F O R M A T I C S
+
+ "intact.psimitab" => {
+ name => "IntACT Protein Interaction Database",
+ source => "wget --mirror ftp://ftp.ebi.ac.uk/pub/databases/intact/current/psimitab/intact.zip",
+ "post-download" => "unzip `find . -name '*.zip'`"
+ },
+
+ "kegg.brite" => {
+ name => "Kegg Brite Database",
+ source => "wget --mirror ftp://ftp.genome.jp/pub/kegg/release/current/brite.tar.gz"
+ },
+
+ "kegg.pathway" => {
+ name => "Kegg Pathway Database",
+ source => "wget --mirror ftp://ftp.genome.jp/pub/kegg/release/current/pathway.tar.gz"
+ },
+
+ "kegg.pathway.hsa" => {
+ name => "Kegg Pathway Database (HSA)",
+ source => "wget --mirror ftp://ftp.genome.jp/pub/kegg/pathway/organisms/hsa"
+ },
+
+
# "DE405" => {
# name => "DE405",
# source => "wget --mirror ftp://ssd.jpl.nasa.gov/pub/eph/export/unix/unxp2[01]*.405",
@@ -163,51 +206,8 @@
my ($list,$help,$man)=(0,0,0);
-my %options = (
- "rootdir:s" => \$rootdir,
- "list" => \$list,
- "help"=>\$help,
- "man"=>\$man);
+my %options=("mirrordir:s" => \$mirrordir, "list" => \$list, "help"=>\$help, "man"=>\$man);
-sub help () {
- require "Pod/Usage.pm";
- import Pod::Usage;
- pod2usage() unless defined($man);
- pod2usage( -verbose => 2 );
-}
-
-
-help() if !GetOptions(%options) or $help or $man;
-
-
-if ($list) {
- foreach my $db (sort keys %toBeMirrored) {
- printf "%-10s",$db;
- # more information like the expected size should be printed here.
- print "\t".$toBeMirrored{$db}{"name"};
- print "\n";
- }
- exit 0;
-}
-
-die "Cannot write to root destination directory at '$rootdir'.\n"
- unless -w "$rootdir" ;
-
-#print join(", ", at ARGV)."\n";
-
-my $d=getcwd();
-
-foreach my $db (@ARGV) {
- unless(exists($toBeMirrored{$db})) {
- print STDERR "Unknown database: '$db'\n";
- next;
- }
-};
-
-my ($list,$help,$man)=(0,0,0);
-
-my %options=("rootdir:s" => \$rootdir, "list" => \$list, "help"=>\$help, "man"=>\$man);
-
sub myhelp () {
require "Pod/Usage.pm";
import Pod::Usage;
@@ -229,7 +229,7 @@
exit 0;
}
-die "Cannot write to root destination directory at '$rootdir'.\n" unless ( -w "$rootdir" );
+die "Cannot write to root destination directory at '$mirrordir'.\n" unless ( -w "$mirrordir" );
#print join(", ", at ARGV)."\n";
@@ -241,21 +241,25 @@
next;
}
- print STDERR "\"$db\" -> \"$rootdir\"\n";
+ print STDERR "\"$db\" -> \"$mirrordir\"\n";
print "Mirroring ".$toBeMirrored{$db}{"name"}." ($db)\n";
- unless ( -d "$rootdir/$db" ) {
- print " creating directory $rootdir/$db\n";
- mkdir("$rootdir/$db") or die "Could not create directory \"$rootdir/$db\"\n";
+ unless ( -d "$mirrordir/$db" ) {
+ print " creating directory $mirrordir/$db\n";
+ mkdir("$mirrordir/$db") or die "Could not create directory \"$mirrordir/$db\"\n";
}
- chdir("$rootdir/$db") or die "Could not change directory to \"$rootdir/$db\"\n";
+ chdir("$mirrordir/$db") or die "Could not change directory to \"$mirrordir/$db\"\n";
- my $cmd = $toBeMirrored{$db}{"source"}."\n";
+ my $cmd = $toBeMirrored{$db}{"source"};
+ if (!defined ($cmd) or "" eq $cmd) {
+ print STDERR "$db: download instructions not specified - skipping.\n";
+ next;
+ }
print STDERR "$cmd\n";
system($cmd) and die "Experienced problem.";
- $cmd = $toBeMirrored{$db}{"post-download"}."\n";
- if ( defined($cmd) and "" != $cmd) {
+ $cmd = $toBeMirrored{$db}{"post-download"};
+ if ( defined($cmd) and "" ne $cmd) {
print STDERR "$cmd\n";
system($cmd) and die "Experienced problem.";
}
More information about the debian-med-commit
mailing list