src/hg/utils/automation/Encode.pm 1.55
1.55 2009/12/23 05:00:53 kate
Add subroutines for dealing with pipeline statuses
Index: src/hg/utils/automation/Encode.pm
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/utils/automation/Encode.pm,v
retrieving revision 1.54
retrieving revision 1.55
diff -b -B -U 4 -r1.54 -r1.55
--- src/hg/utils/automation/Encode.pm 22 Dec 2009 06:07:07 -0000 1.54
+++ src/hg/utils/automation/Encode.pm 23 Dec 2009 05:00:53 -0000 1.55
@@ -524,5 +524,31 @@
}
return \%hash;
}
+my %pipelineStatuses = (
+ 'loaded' => 1,
+ 'displayed' => 2,
+ 'approved' => 3,
+ 'reviewing' => 4,
+ 'released' => 5
+);
+
+sub latestPipelineStatus {
+# Return status that is farther along in the pipeline
+# Any status not in the list is assigned 0
+ my ($status1, $status2) = @_;
+ my $first = defined($pipelineStatuses{$status1}) ?
+ $pipelineStatuses{$status1} : 0;
+ my $second = defined($pipelineStatuses{$status2}) ?
+ $pipelineStatuses{$status2} : 0;
+ return ($first > $second ? $status1 : $status2);
+}
+
+sub laterPipelineStatus {
+# Return true if first status is later than second status, else false
+ my ($status1, $status2) = @_;
+ my $latest = latestPipelineStatus($status1, $status2);
+ return ($latest eq $status1 ? 1 : 0);
+}
+
1;