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

1.226 2010/05/25 19:46:57 tdreszer
Added origAssembly metadata term. Moved metadata lines from trackDb.ra and fileDb.ra to mdb.txt
Index: src/hg/encode/encodeValidate/doEncodeValidate.pl
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/encodeValidate/doEncodeValidate.pl,v
retrieving revision 1.225
retrieving revision 1.226
diff -b -B -U 4 -r1.225 -r1.226
--- src/hg/encode/encodeValidate/doEncodeValidate.pl	21 May 2010 17:38:00 -0000	1.225
+++ src/hg/encode/encodeValidate/doEncodeValidate.pl	25 May 2010 19:46:57 -0000	1.226
@@ -159,8 +159,9 @@
 our %validators = (
     files => \&validateFiles,
     view => \&validateDatasetName,
     labVersion => \&validateNoValidation,
+    origAssembly => \&validateNoValidation,
     inputType => \&validateNoValidation,
     softwareVersion => \&validateNoValidation,
     accession => \&validateNoValidation,
     replicate => \&validateNoValidation,
@@ -1669,8 +1670,13 @@
     open(FILE_RA, ">$outPath/$Encode::fileDbFile") || die "SYS ERROR: Can't write '$outPath/$Encode::fileDbFile' file; error: $!\n";
 } else {
     open(FILE_RA, ">>/dev/null");
 }
+if($opt_metaDataOnly || !$opt_skipOutput) {
+    open(MDB_TXT, ">$outPath/$Encode::mdbFile") || die "SYS ERROR: Can't write \'$outPath/$Encode::mdbFile\' file; error: $!\n";
+} else {
+    open(MDB_TXT, ">>/dev/null");
+}
 
 # Create a composite track entry if the trackDb.ra entry was not found
 if(!$opt_skipOutput && !$compositeExists) {
     printCompositeTdbSettings(*TRACK_RA,$daf,%ddfSets);
@@ -1708,10 +1714,12 @@
         && $key ne 'cell'
         && $key ne 'antibody'
         && $key ne 'view'
         && $key ne 'replicate'
+        && $key ne 'origAssembly'
         && $key ne 'labVersion'
-        && $key ne 'softwareVersion') {
+        && $key ne 'softwareVersion'
+        && $key ne 'origAssembly') {
             $metadata .= " $key=$value"; # and the rest
         }
     }
     if($daf->{dataType} =~/ChIPseq/i) {
@@ -1734,8 +1742,9 @@
     $metadata .= " view=$view";
     $metadata .= " replicate=$ddfLine->{replicate}" if $ddfLine->{replicate} && $daf->{TRACKS}{$view}{hasReplicates};
     $metadata .= " labVersion=$ddfLine->{labVersion}" if $ddfLine->{labVersion};
     $metadata .= " softwareVersion=$ddfLine->{softwareVersion}" if $ddfLine->{softwareVersion};
+    $metadata .= " origAssembly=$ddfLine->{origAssembly}" if $ddfLine->{origAssembly};
     $metadata .= ' dataVersion="' . $Encode::dataVersion .'"';
     if($submitDir =~ /(\d+)$/) {
         $metadata .= " subId=$1";
     }
@@ -1981,10 +1990,14 @@
     print LOADER_RA "files @{$ddfLine->{files}}\n";
     print LOADER_RA "downloadOnly $downloadOnly\n";
     print LOADER_RA "pushQDescription $pushQDescription\n";
     print LOADER_RA "\n";
+    print FILE_RA "\n";
 
-    print FILE_RA sprintf("    metadata %s\n\n", $metadata);
+    # 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.
+    if($downloadOnly) {
+        print MDB_TXT sprintf("metadata %s\n", $metadata);
+    }
 
     if($downloadOnly || ($type eq "wig" && !grep(/$Encode::autoCreatedPrefix/, @{$ddfLine->{files}}))) {
         # adds entries to README.txt for download only files AND wig data (excepting wig data generated by us)
         print README "file: $tableName.$type.gz\n";
@@ -2041,23 +2054,28 @@
         # 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) {
+            print TRACK_RA sprintf("    origAssembly %s\n",$ddfLine->{origAssembly});
+        }
         # color track by color setting for cell type in cv.ra
         if(defined($ddfLine->{cell})) {
             if(defined($terms{'Cell Line'}->{$ddfLine->{cell}}->{'color'})) {
                 print TRACK_RA sprintf("    color %s\n",
                         $terms{'Cell Line'}->{$ddfLine->{cell}}->{'color'});
             }
         }
         # metadata proj=wgEncode lab=Yale cell=GM12878 antiBody=Pol2 labVersion="PeakSeq 1.2 ..." dataVersion="ENCODE Feb 2009 Freeze"
-        print TRACK_RA sprintf("    metadata %s\n", $metadata);
+        # 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 "\n";
     }
 }
 close(LOADER_RA);
 close(TRACK_RA);
 close(FILE_RA);
+close(MDB_TXT);
 close(README);
 doTime("done out files") if $opt_timing;
 
 if($submitPath =~ /(\d+)$/) {