src/hg/utils/automation/Encode.pm 1.43
1.43 2009/06/22 17:22:47 tdreszer
I forgot to check this in earlier. Moved metadataLinesToArrays from encodeDownloadsPage.pl to lib so that it could be called by doEnocodeValidate.pl
Index: src/hg/utils/automation/Encode.pm
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/utils/automation/Encode.pm,v
retrieving revision 1.42
retrieving revision 1.43
diff -b -B -U 4 -r1.42 -r1.43
--- src/hg/utils/automation/Encode.pm 30 Apr 2009 03:32:34 -0000 1.42
+++ src/hg/utils/automation/Encode.pm 22 Jun 2009 17:22:47 -0000 1.43
@@ -35,9 +35,9 @@
our $restrictedMonths = 9;
# change this for each freeze
-our $dataVersion = "ENCODE May 2009 Freeze";
+our $dataVersion = "ENCODE July 2009 Freeze";
our $tempDir = "/data/tmp"; # place to put the big temporary files generated by sort etc.
our $sqlCreate = "/cluster/bin/sqlCreate";
@@ -443,5 +443,40 @@
) or die "Couldn't open file '$file'; error: $!\n";
return $fh;
}
+sub metadataLineToArrays {
+# Creates pair of arrays that contain the settings in a metadata setting line (retains order)
+ my ($line) = @_;
+
+ my @tags;
+ my @vals;
+ my $tix = 0;
+ while($line && length($line)>0) {
+ my $tag;
+ my $val;
+ ( $tag,$line ) = split(/=/, $line,2);
+ $tag =~ s/\s+//g;
+ my @chars = split(//,$line);
+ if($chars[0] ne "\"") {
+ ( $val,$line ) = split(/\s+/, $line,2);
+ } else {
+ my $ix=1;
+ while($ix < length($line) && ($chars[$ix] ne '"' || $chars[$ix - 1] eq '\\')) { # Find next " skipping escaped \"
+ $ix++;
+ }
+ if($ix < length($line)) {
+ $val = substr($line,1,$ix - 1);
+ $line = substr($line, $ix + 1);
+ $val =~ s/\\"/\"/g;
+ } else {
+ $val = $line;
+ $line = "";
+ }
+ }
+ $tags[$tix ] = $tag;
+ $vals[$tix++] = $val;
+ }
+ return ( \@tags, \@vals );
+}
+
1;