src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl 1.30

1.30 2010/03/24 00:59:42 tdreszer
Expanded to a near complet sort order list, added noMetaTbl option to compare old and new metadata methods, expanded fileMask to include bigWig, bigBed and BAM.
Index: src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl,v
retrieving revision 1.29
retrieving revision 1.30
diff -b -B -U 4 -r1.29 -r1.30
--- src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl	20 Mar 2010 00:15:36 -0000	1.29
+++ src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl	24 Mar 2010 00:59:42 -0000	1.30
@@ -30,8 +30,9 @@
     $opt_preamble
     $opt_db
     $opt_verbose
     $opt_checksum
+    $opt_noMetaTbl
     /;
 
 our $checksumFile = "md5sum.txt";
 our $textFile = "files.txt";    # plain text file list with metadata
@@ -44,8 +45,9 @@
 
 options:
     -help               Displays this usage info
     -checksum           Generate checksum file
+    -noMetaTbl	        Don't use metaTbl.  Instead, use the old trackDb/fileDb.ra methods
     -preamble=file      File containing introductory information (written in HTML) that will be included in this file (default preamble.html)
     -db=hg18            Use a database other than the default hg18 (For aquiring releaseDate and metadata from trackDb)
     -fileType=mask	    mask for file types included (default '*.gz')
     -verbose=num        Set verbose level to num (default 1).
@@ -281,12 +283,13 @@
                     "preamble=s",
                     "db=s",
                     "verbose=i",
                     "checksum",
+                    "noMetaTbl",
                     );
 usage() if (!$ok);
 $opt_verbose = 1 if (!defined $opt_verbose);
-my $fileMask = "*.gz";
+my $fileMask = "*.gz *.bb *.bw *.bam";
    $fileMask = $opt_fileType if(defined $opt_fileType);
 
 my $preamble = "preamble.html";
    $preamble = $opt_preamble if(defined $opt_preamble);
@@ -298,9 +301,10 @@
 my $downloadsDir = cwd();
 $downloadsDir = $ARGV[1] if (scalar(@ARGV) > 1);
 
 # Now find some files
-my @fileList = `ls -hogL  --time-style=long-iso $downloadsDir/$fileMask 2> /dev/null`;
+#my @fileList = `ls -hogL  --time-style=long-iso $downloadsDir/$fileMask 2> /dev/null`;
+my @fileList = `cd $downloadsDir;ls -hogL  --time-style=long-iso $fileMask 2> /dev/null`;
 # -rw-rw-r--  1 101M 2008-10-27 14:34 /usr/local/apache/htdocs/goldenPath/hg18/wgEncodeYaleChIPseq/wgEncodeYaleChIPseqSignalK562Pol2.wig.gz
 if(length(@fileList) == 0) {
     die ("ERROR; No files were found in \'$downloadsDir\' that match \'$fileMask\'.\n");
 }
@@ -359,9 +363,15 @@
     my $submitDate = "";
     my %metaData;
 
     ### TODO: Developer: set sort order here; sortables must have same number of strings and '~' is lowest val printable
-    my @sortFields = ("cell","dataType","rnaExtract","localization","fragSize","mapAlgorithm","ripAntibody","ripTgtProtein","treatment","antibody","protocol","input","lab","type","view","level","annotation","rank","replicate","subId");
+    #my @sortFields = ("cell","dataType","rnaExtract","localization","fragSize","mapAlgorithm","ripAntibody","ripTgtProtein","treatment","antibody","protocol","input","lab","type","view","level","annotation","rank","replicate","subId");
+    # Complete sort order, (I hope)
+    my @sortFields = ("species","assembly","dataType","cell","rnaExtract","localization","phase","treatment","antibody","protocol","ripAntibody",
+                      "ripTgtProtein","restrictionEnzyme","promoter","input","control","replicate","submitteDataVersion","subId","dataVersion",
+                      "dateSubmitted","dateResubmitted","dateReloaded","dateUnrestricted","project","grant","lab","labVersion","softwareVersion",
+                      "mapAlgorithm","fragSize","fragLength","medianFragmentLength","fragmentLengthRange","chromStart","view","type","composite",
+                      "tableName","parentTable","fileName","accession");
     my @sortables = map( "~", (1..scalar(@sortFields))); # just has to have a tilde for each field
     my $typePrefix = "";
 
     my $results = $db->quickQuery("select type from $database.trackDb where tableName = '$tableName'");
@@ -373,8 +383,9 @@
         $metaData{type} = $dataType;
     }
 
     # Use the metaTbl for metadata
+    if (!defined $opt_noMetaTbl) {
     my $queryResults = $db->execute("select var,val from $database.metaTbl where objName = '$tableName'");
     if($queryResults) {
         my @pairVars;
         push @pairVars, "metadata";
@@ -387,8 +398,11 @@
             #push @pairVars, $onePair;
         }
         $results = join(' ',@pairVars );
     }
+    } else {
+        $results = "";
+    }
 
     if(!$results) {
         $results = $db->quickQuery("select settings from $database.trackDb where tableName = '$tableName'");
     }