[Bio] / FortyEight / rp_auto_assign.pl Repository:
ViewVC logotype

View of /FortyEight/rp_auto_assign.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.6 - (download) (as text) (annotate)
Thu Jul 17 20:43:53 2008 UTC (11 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: rast_rel_2008_12_18, rast_rel_2008_07_21, rast_2008_0924, rast_rel_2008_09_30, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, mgrast_rel_2008_0625, rast_rel_2008_10_09, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0919, mgrast_rel_2008_1110, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, rast_rel_2009_03_26, rast_rel_2008_11_24, rast_rel_2008_08_07
Changes since 1.5: +1 -1 lines
Use -orgdir option to auto_assign in order to use indexed sims.

# Perform auto-assignment on unassigned pegs.

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

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

my $jobdir = shift;

-d $jobdir or die "$0: job dir $jobdir does not exist\n";

my $genome = &FIG::file_head("$jobdir/GENOME_ID");
chomp $genome;
$genome =~ /^\d+\.\d+/ or die "$0: Cannnot find genome ID for jobdir $jobdir\n";

my $meta = new GenomeMeta($genome, "$jobdir/meta.xml");

my $tbl = "$jobdir/rp/$genome/Features/peg/tbl";
-f $tbl or die "$0: Cannot find tbl file $tbl\n";

my $proposed = "$jobdir/rp/$genome/proposed_functions";

my %done;

if (!open(PROP, "<$proposed"))
    warn "could not  open proposed functions $proposed: $!";
    $meta->add_log_entry($0, "could not open proposed fucntions $proposed");
    while (<PROP>)
	my($peg, $assign) = split;
	$done{$peg} = $assign;

my $simfile = "$jobdir/rp/$genome/expanded_similarities";

open(TBL, "<$tbl") or &fatal("Cannot open tbl file $tbl: $!");

my $cmd = "$FIG_Config::bin/auto_assign -orgdir $jobdir/rp/$genome > $jobdir/rp/$genome/proposed_non_ff_functions";
print "running $cmd\n";
open(AA, "| $cmd")
	or &fatal("aa failed: $!");

my $peg_count = 0;
while (<TBL>)
    my($peg, @rest) = split(/\t/);
    if (!$done{$peg})
	print AA "$peg\n";

$meta->add_log_entry($0, "computing auto_assign on $peg_count pegs");

if (!close(AA))
    &fatal("error on close \$?=$? \$!=$!");

$meta->add_log_entry($0, "auto_assign completed\n");
$meta->set_metadata("status.auto_assign", "complete");

sub fatal
    my($msg) = @_;

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

    croak "$0: $msg";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3