[Bio] / FortyEightMeta / mg_export.pl Repository:
ViewVC logotype

View of /FortyEightMeta/mg_export.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Sep 20 20:05:09 2007 UTC (12 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0924, mgrast_rel_2008_0625, mgrast_rel_2008_0919, mgrast_rel_2008_0917
new file

#
# Create export files.
#

use DB_File;
use Data::Dumper;

use Job48;
use strict;
use FIG;
use FIGV;
use FIG_Config;
use File::Basename;
use File::Copy;
use GenomeMeta;
use Carp 'croak';

@ARGV == 1 or die "Usage: $0 job-dir\n";

my $jobdir = shift;

my $job_id = basename($jobdir);
my $job = new Job48($job_id);

$job or die "could not create job for $job\n";

my $meta = $job->meta;
my $genome = $job->genome_id();

print "Running job! $jobdir\n";

$meta->set_metadata("status.export", "in_progress");
$meta->set_metadata("export.running", "yes");

#
# Create genbank and gff exports
#

my $orgdir = $job->orgdir();
chdir($jobdir) or &fatal("cannot chdir $jobdir: $!");
my @cmd = ("$FIG_Config::bin/seed2genbank",
	   "-d", $orgdir,
	   "-g", $genome,
	   "-o", "$genome.gbk.gz",
	   "-t", "all");
	   
my $rc = system(@cmd);

if ($rc != 0)
{
    warn "cmd failed with rc=$rc \$?=$? \$!=$!: @cmd\n";
}

$meta->set_metadata("status.export", "complete");
$meta->set_metadata("export.running", "no");

exit(0);

sub fatal
{
    my($msg) = @_;

    $meta->add_log_entry($0, ['fatal error', $msg]);
    $meta->set_metadata("status.sims_postprocess", "error");

    croak "$0: $msg";
}
    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3