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

View of /FortyEightMeta/mg_figfam.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Tue Jul 10 19:32:22 2007 UTC (12 years, 7 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, mgrast_dev_05262011, mgrast_dev_04082011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, mgrast_rel_2008_0806, mgrast_dev_10262011, mgrast_dev_02212011, mgrast_rel_2008_0923, mgrast_release_3_0, mgrast_dev_03252011, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, mgrast_rel_2008_0625, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, mgrast_rel_2008_0919, mgrast_rel_2008_1110, myrast_33, mgrast_rel_2008_0917, mgrast_dev_04052011, mgrast_dev_02222011, HEAD
Changes since 1.1: +15 -2 lines
Some minor mg assignment fixes

#
# use figfams for function assignment
#

use DB_File;
use Data::Dumper;

use Job48;
use strict;
use FIG;
use FIGO;
use FigFams;
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.figfam", "in_progress");

my $figO = new FIGO;
my $fig = $figO->{_fig};
my $figfams = new FigFams($figO);

my $fasta = $job->orgdir() . "/Features/peg/fasta";
if (!open(FA, "<$fasta"))
{
    &fatal("cannot open fasta $fasta: $!\n");
}

my $outfile = $job->orgdir() . "/figfam_assignments";
open(FFOUT, ">$outfile") or &fatal("Cannot open $outfile for writing: $!");

my $evfile = $job->orgdir() . "/figfam_evidence";
open(FFEV, ">$evfile") or &fatal("Cannot open $evfile for writing: $!");

my($id, $seqP, $comment);
while (($id, $seqP, $comment) = $fig->read_fasta_record(\*FA))
{
    my($fam, $sims) = $figfams->place_in_family($$seqP, 0, 1);
    if ($fam)
    {
	my $fid = $fam->family_id;
	print FFOUT join("\t", $id, $fid, $fam->family_function), "\n";
	map { print FFEV join("\t", $id, $fid, @$_), "\n" } @$sims;
    }
}
close(FFEV);
close(FFOUT);
close(FA);

$meta->set_metadata("status.figfam", "complete");
$meta->set_metadata("figfamrunning", "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