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

Diff of /FortyEight/rp_auto_assign.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Wed Sep 5 21:43:18 2007 UTC revision 1.14, Tue Nov 23 20:12:16 2010 UTC
# Line 1  Line 1 
1    # -*- perl -*-
2    #########################################################################
3    # Copyright (c) 2003-2008 University of Chicago and Fellowship
4    # for Interpretations of Genomes. All Rights Reserved.
5    #
6    # This file is part of the SEED Toolkit.
7    #
8    # The SEED Toolkit is free software. You can redistribute
9    # it and/or modify it under the terms of the SEED Toolkit
10    # Public License.
11    #
12    # You should have received a copy of the SEED Toolkit Public License
13    # along with this program; if not write to the University of Chicago
14    # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15    # Genomes at veronika@thefig.info or download a copy from
16    # http://www.theseed.org/LICENSE.TXT.
17    #########################################################################
18    
19  #  #
20  # Perform auto-assignment on unassigned pegs.  # Perform auto-assignment on unassigned pegs.
# Line 9  Line 26 
26  use File::Basename;  use File::Basename;
27  use GenomeMeta;  use GenomeMeta;
28  use Carp 'croak';  use Carp 'croak';
29    use Job48;
30    
31  @ARGV == 1 or die "Usage: $0 job-dir\n";  @ARGV == 1 or die "Usage: $0 job-dir\n";
32    
# Line 49  Line 67 
67    
68  open(TBL, "<$tbl") or &fatal("Cannot open tbl file $tbl: $!");  open(TBL, "<$tbl") or &fatal("Cannot open tbl file $tbl: $!");
69    
70  my $cmd = "$FIG_Config::bin/auto_assign sims=$simfile > $jobdir/rp/$genome/proposed_non_ff_functions";  &FIG::verify_dir("$jobdir/rp/$genome/Subsystems");
71    system("touch", "$jobdir/rp/$genome/Subsystems/subsystems", "$jobdir/rp/$genome/Subsystems/bindings");
72    my $cmd = "$FIG_Config::bin/auto_assign -orgdir $jobdir/rp/$genome > $jobdir/rp/$genome/proposed_non_ff_functions";
73  print "running $cmd\n";  print "running $cmd\n";
74  open(AA, "| $cmd")  open(AA, "| $cmd")
75          or &fatal("aa failed: $!");          or &fatal("aa failed: $!");
# Line 74  Line 94 
94      &fatal("error on close \$?=$? \$!=$!");      &fatal("error on close \$?=$? \$!=$!");
95  }  }
96    
97    #
98    # When auto assign is complete, we are able to submit the model computation.
99    #
100    
101    if ($meta->get_metadata("model_build.enabled"))
102    {
103        my $userid;
104        my $link;
105        eval {
106            my $job = Job48->new($jobdir);
107            my $uo = $job->getUserObject;
108            if ($uo)
109            {
110                $userid = $uo->_id;
111            }
112        };
113    
114        if (defined($userid))
115        {
116            $link = "http://rast.nmpdr.org/seedviewer.cgi?model=Seed${genome}.${userid}&page=ModelView";
117        }
118        else
119        {
120            $meta->add_log_entry($0, "Could not get user id");
121        }
122    
123    
124        my $user = &FIG::file_head("$jobdir/USER", 1);
125        chomp $user;
126        my $cmd = ("/vol/model-prod/FIGdisk/bin/ModelDriver.sh 'createmodelfile?$genome?1?$user' > $jobdir/rp.errors/create_model.stderr 2>&1");
127        my $rc = system($cmd);
128        if ($rc != 0)
129        {
130            $meta->add_log_entry($0, ['error creating model', $rc]);
131        }
132        else
133        {
134            $meta->add_log_entry($0, ['model submitted']);
135    
136            if (defined($link))
137            {
138                $meta->set_metadata("model_build.viewing_link", $link) ;
139            }
140        }
141    }
142    
143    
144  $meta->add_log_entry($0, "auto_assign completed\n");  $meta->add_log_entry($0, "auto_assign completed\n");
145  $meta->set_metadata("status.auto_assign", "complete");  $meta->set_metadata("status.auto_assign", "complete");
146    $meta->set_metadata("auto_assign.running", "no");
147    
148  sub fatal  sub fatal
149  {  {
# Line 84  Line 152 
152      $meta->add_log_entry($0, ['fatal error', $msg]);      $meta->add_log_entry($0, ['fatal error', $msg]);
153      $meta->set_metadata("status.auto_assign", "error");      $meta->set_metadata("status.auto_assign", "error");
154    
155      croak "$0: $msg";      confess "$0: $msg";
156  }  }
157    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.14

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3