[med-svn] r2130 - trunk/community/infrastructure/getData

smoe-guest at alioth.debian.org smoe-guest at alioth.debian.org
Thu Jul 3 13:49:12 UTC 2008


Author: smoe-guest
Date: 2008-07-03 13:49:11 +0000 (Thu, 03 Jul 2008)
New Revision: 2130

Modified:
   trunk/community/infrastructure/getData/getData
Log:
Automated indexing should work for TrEMBL now.


Modified: trunk/community/infrastructure/getData/getData
===================================================================
--- trunk/community/infrastructure/getData/getData	2008-07-03 12:34:40 UTC (rev 2129)
+++ trunk/community/infrastructure/getData/getData	2008-07-03 13:49:11 UTC (rev 2130)
@@ -116,6 +116,10 @@
 
     Perform only the unpacking/indexing, but do not retrieve/update the databases. This option may be beneficial when the site administator is aware of current analyses that should not be disturbed by the indexing process but the downloading from the net can already be started.
 
+=item --config <system>
+
+    Preparation of the configuration file that would be reuired for a particular system that deals with the database. The configuration is printed to stdout and is expected to be copied manually to the proper file or folder. One could imagine this process to be automated, though this is not yet implemented. Currently implemented systems are: emboss and dre. "dre" stands for "dynamic runtime environment", which is a concept of the ARC grid middleware of which more can be learned on http://www.nordugrid.org.
+
 =back
 
 =head1 EXAMPLES
@@ -223,8 +227,8 @@
 		source => "wget --mirror ftp://ftp.ebi.ac.uk/pub/databases/swissprot/release_compressed/uniprot_trembl.dat.gz",
 		"post-download" => "d=uncompressed; if [ ! -d \$d ]; then mkdir \$d; fi; "
 				  ."rm -rf \$d/trembl.dat; "
-				  ."(find ftp.ebi.ac.uk -name '*.dat.gz' | xargs -r zcat ) > \$d/swissprot.dat; "
-				  ."[ -x /usr/bin/dbxflat ] && dbxflat -dbname swisslocal -fields acc,des"
+				  ."(find ftp.ebi.ac.uk -name '*.dat.gz' | xargs -r zcat ) > \$d/trembl.dat; "
+				  ."[ -x /usr/bin/dbxflat ] && cd \$d && dbxflat -dbresource embl -dbname trembllocal -fields acc,des -auto"
 	},
 
 	"swiss.dat" => {
@@ -233,7 +237,7 @@
 		"post-download" => "d=uncompressed; if [ ! -d \$d ]; then mkdir \$d; fi; "
 				  ."rm -rf \$d/swissprot.dat; "
 				  ."(tfind ftp.ebi.ac.uk -name '*.dat.gz` | xargs -r zcat ) > \$d/swissprot.dat; "
-				  ."[ -x /usr/bin/dbiflat ] && dbiflat -dbname swisslocal -fields acc,des"
+				  ."[ -x /usr/bin/dbiflat ] && cd \$d && dbiflat -dbresource embl -dbname swisslocal -fields acc,des -auto"
 	#	source => "wget --mirror ftp://ftp.ebi.ac.uk/pub/databases/swissprot/release_compressed/uniprot_sprot.dat.gz"
 	},
 
@@ -258,17 +262,18 @@
 #	}
 );
 
-my ($post,$source,$list,$help,$man,$verbose)=(undef,undef,0,0,0,0);
+my ($post,$source,$config,$list,$help,$man,$verbose)=(undef,undef,undef,0,0,0,0);
 
 my %options=("mirrordir:s" => \$mirrordir,
 	     "list" => \$list,
              "help"=>\$help, "man"=>\$man,
 	     "verbose"=>\$verbose,
 	     "post"=>\$post,
+	     "config:s@"=>\$config,
 	     "source"=>\$source);
 
 
-my ($do_source,$do_post)=(1,1);
+my ($do_source,$do_post,$do_config)=(1,1,0);
 
 
 sub myhelp () {
@@ -293,12 +298,20 @@
 	print "disabling retrieval of database updates.\n";
 	$do_source=0;
 	$do_post=1;
+	$do_config=0;
 }
 if ($source) {
 	print "disabling unpacking and indexing.\n";
 	$do_post=0;
 	$do_source=1;
+	$do_config=0;
 }
+if ($config) {
+	print "disabling retrieval of updates and their unpacking/indexing.\n";
+	$do_post=0;
+	$do_source=0;
+	$do_config=1;
+}
 
 if ($verbose) {
 	foreach my $o (keys %options) {
@@ -316,18 +329,62 @@
 	exit 0;
 }
 
-die "Cannot write to root destination directory at '$mirrordir'.\n" unless ( -w "$mirrordir" );
+die "Cannot write to root destination directory at '$mirrordir'.\n" unless ( -w "$mirrordir" or $do_config);
 
 #print join(", ", at ARGV)."\n";
 
 my $d=getcwd();
 
 foreach my $db (@ARGV) {
+
 	unless(exists($toBeMirrored{$db})) {
 		print STDERR "Unknown database: '$db'\n";
 		next;
 	}
 
+	if ($do_config) {
+		foreach my $system (@$config) {
+			if ("emboss" eq "$system") {
+				if ($db =~ /(swiss|trembl).dat/ ) {
+					print "\n";
+					print "########### " . $db . " ##############\n";
+					print "\n";
+					print "DB ";
+					my $n=$db;
+					$n =~ s/\.dat$//;
+					print $n;
+					print "local [\n";
+					print "  type: P\n";
+					print "  format: swiss\n";
+					if ($db eq "swiss.dat") {
+						print "  method: emblcd\n";
+					}
+					elsif ($db eq "trembl.dat") {
+						print "  method: emboss\n";
+					}
+					else {
+						print "  # method: unknown\n";
+					}
+					print "  directory: $mirrordir/$db/uncompressed/$db\n";
+					print "]\n";
+					print "\n";
+					print "####################################\n";
+				}
+			}
+			elsif ("dre" eq "$system") {
+				if ( -d "$mirrordir/$db" ) {
+					print "MIRRORDIR=\"$mirrordir\"\n";
+				}
+				else {
+					print STDERR "$db: not installed, configuration not printed.
+				}
+			}
+			else {
+				print "Unknown system $system\n";
+			}
+		}
+	}
+
 	print STDERR "\"$db\" -> \"$mirrordir\"\n";
 	print "Mirroring ".$toBeMirrored{$db}{"name"}." ($db)\n";
 




More information about the debian-med-commit mailing list