[Bio] / FigKernelScripts / validate_subsystem.pl Repository:
ViewVC logotype

View of /FigKernelScripts/validate_subsystem.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Fri Apr 29 22:01:29 2005 UTC (15 years, 1 month ago) by olson
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, caBIG-dataload-0, merge-trunktag-bobdev_news-1, merge-bodev_news-3, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Basic subsystem package validator. Uses SubsystemFile from P2Pupdate module.

# Validate a subsystem package, printing a tab-delimited list of metadata if it is valid.
# Otherwise return a nonzero exit code and print errors to stdout.

use strict;
use FIG;
use P2Pupdate;

my $usage = "validate_subsystem subsystem-package";

@ARGV == 1 or die $usage;

my $package = shift;

my @output;

my $sub;

my $fig;

eval {
    $sub = new SubsystemFile($FIG_Config::temp, $package, $fig);

if ($@)
    print "Subsystem package file did not parse:\n$@\n";
    exit 1;

warn sprintf("Parsed subsystem file. Subsystem name %s, version %s, curator %s\n",
	     $sub->name, $sub->version, $sub->curator);

     [name => $sub->name],
     [version => $sub->version],
     [curator => $sub->curator]);

# Perform some initial validation.

my @errors;

$sub->name ne '' or push @errors, "Name not specified";
$sub->curator ne '' or push @errors, "Curator not specified";
$sub->version =~ /^\d+/ or push @errors, "Invalid version " . $sub->version;
(ref($sub->{roles}) and @{$sub->{roles}} > 0) or push @errors, "Subsystem has no roles";
(ref($sub->{genomes}) and @{$sub->{genomes}} > 0) or push @errors, "Subsystem has no genomes";

if (@errors)
    print join("\n", @errors), "\n";

for my $elt (@output)
    print join("\t", @$elt), "\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3