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

View of /FigKernelScripts/ev_code_cron.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Wed Aug 23 20:53:50 2006 UTC (13 years, 7 months ago) by redwards
Branch: MAIN
Changes since 1.2: +1 -1 lines
restoring the ev_code_cron to almost right

#__perl__
#

=pod

=head1 ev_code_cron.pl

A wrapper to recalculate and reload the evidence codes. This should allow you to redo all the evidence codes daily, weekly or whatever.
Really just a series of wrappers around other jobs. Should most certainly be niced while running.


=head2 author

RobE RobE@theFIG.info

=cut


use strict;
use FIG;
my $fig=new FIG;
use constant DEBUG=>1;

# recalculate the evidence codes

my $dest=$FIG_Config::temp."/evidence_codes.".time; # a temporary directory for the calculations to be stored.
mkdir ($dest, 0755);

##### FIND SUBSYSTEMS
# at the moment we are building evidence codes for all subsystems that are not experimental
# using the fig->trusted_subsystems code

print STDERR "Finding the subsystems\n" if (DEBUG);
open(OUT, ">$dest/all_subsys") || die "Can't write to $dest/all_subsys";
foreach my $ss ($fig->all_subsystems)
{
    next unless ($fig->usable_subsystem($ss));
    print OUT "$ss\n";
}
close OUT;

##### REBUILD EVIDENCE CODES
# just use the existing code to do this
my $command=$FIG_Config::bin."/get_ev_codes $dest/all_subsys > $dest/ev.codes";
print STDERR "Running the evidence code command $command\n" if (DEBUG);
system($command);

##### RELOAD ATTRIBUTES DATABASE
# delete the old attributes and then add the new ones
print STDERR "Deleting the attributes\n" if (DEBUG);
$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

# now add all the attributes. This is really slow, and we should probably do a low level sql call to speed this up,
# but this handles breaking out the peg id into the separate parts and everything. It should be good.
print STDERR "Reloading attributes from $dest/ev.codes\n" if (DEBUG);
open(IN, "$dest/ev.codes") || die "CAn't open $dest/ev.codes";
while (<IN>)
{
    chomp;
    my @a=split /\t/;
    $fig->add_attribute(@a);
}


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3