[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.3 - (download) (as text) (annotate)
Wed Nov 29 15:19:19 2006 UTC (13 years ago) by olson
Branch: MAIN
Changes since 1.2: +1 -22 lines
Rollup commit of 48hr changes.

Added add_virtual_genome to Subsystem.pm to support UnvSubsys doing
the right thing when handed a FIGV.

Added propagation of 48hr_job thru the various link generation scripts in order for protein.cgi/display_subsys.cgi
to properly show virtual genomes.

#
# Perform auto-assignment on unassigned pegs.
#

use strict;
use FIG;
use FIG_Config;
use File::Basename;
use GenomeMeta;

@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");
}
else
{
    while (<PROP>)
    {
	chomp;
	my($peg, $assign) = split;
	$done{$peg} = $assign;
    }
    close(PROP);
}

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

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

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

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

$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