[Bio] / FigKernelScripts / ev_code_cron.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/ev_code_cron.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (view) (download) (as text)

1 : overbeek 1.1 #__perl__
2 :     #
3 :    
4 :     =pod
5 :    
6 :     =head1 ev_code_cron.pl
7 :    
8 :     A wrapper to recalculate and reload the evidence codes. This should allow you to redo all the evidence codes daily, weekly or whatever.
9 :     Really just a series of wrappers around other jobs. Should most certainly be niced while running.
10 :    
11 :    
12 :     =head2 author
13 :    
14 :     RobE RobE@theFIG.info
15 :    
16 :     =cut
17 :    
18 :    
19 :     use strict;
20 :     use FIG;
21 :     my $fig=new FIG;
22 :     use constant DEBUG=>1;
23 :    
24 :     # recalculate the evidence codes
25 :    
26 :     my $dest=$FIG_Config::temp."/evidence_codes.".time; # a temporary directory for the calculations to be stored.
27 :     mkdir ($dest, 0755);
28 :    
29 :     ##### FIND SUBSYSTEMS
30 :     # at the moment we are building evidence codes for all subsystems that are not experimental
31 :     # using the fig->trusted_subsystems code
32 :    
33 :     print STDERR "Finding the subsystems\n" if (DEBUG);
34 :     open(OUT, ">$dest/all_subsys") || die "Can't write to $dest/all_subsys";
35 :     foreach my $ss ($fig->all_subsystems)
36 :     {
37 :     next unless ($fig->usable_subsystem($ss));
38 :     print OUT "$ss\n";
39 :     }
40 :     close OUT;
41 :    
42 :     ##### REBUILD EVIDENCE CODES
43 :     # just use the existing code to do this
44 :     my $command=$FIG_Config::bin."/get_ev_codes $dest/all_subsys > $dest/ev.codes";
45 :     print STDERR "Running the evidence code command $command\n" if (DEBUG);
46 :     system($command);
47 :    
48 :     ##### RELOAD ATTRIBUTES DATABASE
49 :     # delete the old attributes and then add the new ones
50 :     print STDERR "Deleting the attributes\n" if (DEBUG);
51 : redwards 1.3 $fig->erase_attribute_entirely("evidence_code"); # this removes the evidence code and all notion of it, including all the files. This will scrub out things that get deleted
52 : overbeek 1.1
53 :     # now add all the attributes. This is really slow, and we should probably do a low level sql call to speed this up,
54 :     # but this handles breaking out the peg id into the separate parts and everything. It should be good.
55 :     print STDERR "Reloading attributes from $dest/ev.codes\n" if (DEBUG);
56 :     open(IN, "$dest/ev.codes") || die "CAn't open $dest/ev.codes";
57 :     while (<IN>)
58 :     {
59 :     chomp;
60 :     my @a=split /\t/;
61 : redwards 1.5 #print STDERR join("\t", "ADD->", @a), "\n";
62 : parrello 1.7 $fig->add_attribute(@a); # don't write to the transaction_log - we don't want to keep saving these changes
63 : overbeek 1.1 }
64 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3