src/hg/encode/encodeValidate/doEncodeValidate.pl 1.227

1.227 2010/05/26 18:25:20 tdreszer
At Venkat's urging, added useful comment to trackDb entry with subId
Index: src/hg/encode/encodeValidate/doEncodeValidate.pl
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/encodeValidate/doEncodeValidate.pl,v
retrieving revision 1.226
retrieving revision 1.227
diff -b -B -U 4 -r1.226 -r1.227
--- src/hg/encode/encodeValidate/doEncodeValidate.pl	25 May 2010 19:46:57 -0000	1.226
+++ src/hg/encode/encodeValidate/doEncodeValidate.pl	26 May 2010 18:25:20 -0000	1.227
@@ -1384,8 +1384,9 @@
 my $ddfFile = Encode::newestFile(@glob);
 die "ERROR: Can't find DDF file\n" unless -e $ddfFile;
 my $ddfFileTime = (stat($ddfFile))->ctime;
 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($ddfFileTime);
+my $dateSubmitted    = sprintf("%04d-%02d-%02d", 1900 + $year, $mon + 1, $mday);
 
 HgAutomate::verbose(2, "Using newest DDF file \'$ddfFile\'\n");
 my $lines = Encode::readFile($ddfFile);
 
@@ -1690,8 +1691,9 @@
 
 # use pi.ra file to map pi/lab/institution/grant/project for metadata line
 my $labRef = Encode::getLabs($configPath);
 my %labs = %{$labRef};
+my $subId = 0;
 
 foreach my $ddfLine (@ddfLines) {
     $ddfLineNumber++;
     my $diePrefix = "ERROR on DDF lineNumber $ddfLineNumber:";
@@ -1745,10 +1747,13 @@
     $metadata .= " softwareVersion=$ddfLine->{softwareVersion}" if $ddfLine->{softwareVersion};
     $metadata .= " origAssembly=$ddfLine->{origAssembly}" if $ddfLine->{origAssembly};
     $metadata .= ' dataVersion="' . $Encode::dataVersion .'"';
     if($submitDir =~ /(\d+)$/) {
-        $metadata .= " subId=$1";
+        $subId = $1;
+    } elsif($submitDir =~ /(\d+)/) {
+        $subId = $1;
     }
+    $metadata .= " subId=$subId";
     if (defined($daf->{dataVersion}) && $daf->{dataVersion} > 1) {
         die "Need dataVersionComment in DAF when dataVersion is supplied\n" if (!defined($daf->{dataVersionComment}));
         $metadata .= ' submittedDataVersion="' . "V$daf->{dataVersion}" . " - $daf->{dataVersionComment}" . '"';
     }
@@ -1886,9 +1891,8 @@
     # safe, we strip non-alphanumerics.
     $tableName =~ s/[^A-Za-z0-9]//g;
 
     my (undef, undef, undef, $rMDay, $rMon, $rYear) = Encode::restrictionDate($ddfFileTime); # Use DDF time
-    my $dateSubmitted    = sprintf("%04d-%02d-%02d", 1900 + $year, $mon + 1, $mday);
     my $dateUnrestricted = sprintf("%04d-%02d-%02d", 1900 + $rYear, $rMon + 1, $rMDay);
 
 
     # dataVersion means the tableName must be different (append Vn), and the old metaddata should be used for dateSubmitted and dateUnrestricted
@@ -2047,12 +2051,8 @@
             print TRACK_RA "    type bed 6\n";
         } else {
             print TRACK_RA "    type $type\n";
         }
-        # Obsolete: now in metadata
-        # print TRACK_RA sprintf("    dateSubmitted %04d-%02d-%02d\n", 1900 + $year, $mon + 1, $mday);
-        # print TRACK_RA sprintf("    dateUnrestricted %04d-%02d-%02d\n", 1900 + $rYear, $rMon + 1, $rMDay);
-        # print TRACK_RA sprintf("    dataVersion %s\n", $Encode::dataVersion);
         if(defined($ddfLine->{accession}) && length($ddfLine->{accession}) > 0) {
             print TRACK_RA sprintf("    accession %s\n",$ddfLine->{accession});
         }
         if(defined($ddfLine->{origAssembly}) && length($ddfLine->{origAssembly}) > 0) {
@@ -2067,8 +2067,9 @@
         }
         # metadata proj=wgEncode lab=Yale cell=GM12878 antiBody=Pol2 labVersion="PeakSeq 1.2 ..." dataVersion="ENCODE Feb 2009 Freeze"
         # The metadata line is no longer put into fileDb.ra and trackDb.ra but is in mdb.txt.  This line could be rewritten as RA but isn't yet.
         print MDB_TXT sprintf("metadata %s\n", $metadata);
+        print TRACK_RA sprintf("    # subId=%s dateSubmitted=%s\n", $subId,$dateSubmitted);
         print TRACK_RA "\n";
     }
 }
 close(LOADER_RA);