src/hg/utils/automation/Encode.pm 1.48

1.48 2009/10/23 01:19:57 kate
Add functions used by reporting script
Index: src/hg/utils/automation/Encode.pm
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/utils/automation/Encode.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -b -B -U 4 -r1.47 -r1.48
--- src/hg/utils/automation/Encode.pm	2 Oct 2009 23:45:38 -0000	1.47
+++ src/hg/utils/automation/Encode.pm	23 Oct 2009 01:19:57 -0000	1.48
@@ -30,8 +30,9 @@
 
 our $fieldConfigFile = "fields.ra";
 our $vocabConfigFile = "cv.ra";
 our $labsConfigFile = "labs.ra";
+our $piConfigFile = "pi.ra";    # for reporting purposes
 our $autoCreatedPrefix = "auto";
 
 our $restrictedMonths = 9;
 
@@ -42,9 +43,9 @@
 
 our $sqlCreate = "/cluster/bin/sqlCreate";
 # Add type names to this list for types that can be loaded via .sql files (e.g. bed5FloatScore.sql)
 # You also have to make sure the .sql file is copied into the $sqlCreate directory.
-our @extendedTypes = ("narrowPeak", "broadPeak", "gappedPeak", "pairedTagAlign", "bed5FloatScore", "wgEncodeWengTfbsValid");
+our @extendedTypes = ("narrowPeak", "broadPeak", "gappedPeak", "pairedTagAlign", "bed5FloatScore");
 # Add type names to this list for types that can be loaded as bigBed via .as files (e.g. tagAlign.as)
 # You also have to make sure the .as file is copied into the $sqlCreate directory.
 our @bigBedTypes = ("tagAlign");
 
@@ -179,8 +180,20 @@
     }
     return \%grants;
 }
 
+sub getPIs
+{
+# file with pi/project/lab/grant -- used for reporting purposes
+# Captures conventions in reporting spreadsheet and pipeline metadata
+    my ($configPath) = @_;
+    my %piHash = ();
+    if(-e "$configPath/$piConfigFile") {
+        %piHash = RAFile::readRaFile("$configPath/$piConfigFile", "pi");
+    }
+    return \%piHash;
+}
+
 sub getControlledVocab
 {
 # Returns hash indexed by the type's in the cv.ra file (e.g. "Cell Line", "Antibody")
     my ($configPath) = @_;
@@ -479,5 +492,18 @@
     }
     return ( \@tags, \@vals );
 }
 
+sub metadataLineToHash {
+# Create a hash of settings from metadata line
+    my ($line) = @_;
+    my ($tags, $vals) = Encode::metadataLineToArrays($line);
+    my %hash = ();
+    my $i = 0;
+    while($tags->[$i]) {
+        $hash{$tags->[$i]} = $vals->[$i];
+        $i++
+    }
+    return \%hash;
+}
+
 1;