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

View of /FigKernelScripts/FFB3_get_recent_annotations.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Tue Jul 9 16:49:46 2013 UTC (6 years, 4 months ago) by olson
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
Changes since 1.1: +1 -1 lines
FFB3_build_updated_FF: Add --temp to force use of given temp directory
Change hardcoded database host to seed-db-read for the annotator seed.

use strict;
use DBI;
use DateTime;
use DateTime::Format::MySQL;
use FIG;
					 
#
# Retrieve recent annotations from pubseed then from annotator seed.
#

my $now = DateTime->now();
$now->subtract(months => 1);
my $when = DateTime::Format::MySQL->format_datetime($now);

my $fig = new FIG;

(@ARGV == 0) ||
    die "Usage: FFB3_get_recent_annotations\n";

my $anno_dbh;
my $pubseed_dbh;
if ($ENV{FFB3_TEST_MODE})
{
    $anno_dbh = DBI->connect('dbi:mysql:host=seed-db-read.mcs.anl.gov;database=fig_test1', 'seed');
    $pubseed_dbh = DBI->connect('dbi:mysql:host=seed-db-read.mcs.anl.gov;database=fig_test2', 'seed');
}
else
{
    $anno_dbh = DBI->connect('dbi:mysql:host=seed-db-read.mcs.anl.gov;database=fig_anno_v5', 'seed');
    $pubseed_dbh = $fig->db_handle->{_dbh};
}
$pubseed_dbh or die;
$anno_dbh or die;

my %by_id;

do_query($pubseed_dbh, 'pubseed');
do_query($anno_dbh, 'aseed');

for my $fid (sort { FIG::by_fig_id($a, $b) } keys %by_id)
{
    print join("\t", @{$by_id{$fid}}), "\n";
}


sub do_query
{
    my($dbh, $tag) = @_;

    my %seen;
    my $res = $dbh->selectall_arrayref(qq(SELECT prot, UNIX_TIMESTAMP(mod_time), made_by, assigned_function
					  FROM function_trail
					  WHERE mod_time > ? AND
					  made_by NOT LIKE '%release%' AND made_by NOT LIKE '%rapid%' AND made_by NOT LIKE '%auto%' AND
					  made_by NOT LIKE '%repair%' AND made_by NOT LIKE '%cleanup%' AND made_by NOT LIKE '%but not%' AND
					  made_by != 'md5_consistency' AND made_by NOT LIKE 'md5_reconcile%' AND made_by != 'Initial_Import'
					  ORDER BY mod_time DESC), undef, $when);
    
    for my $ent (@$res)
    {
	my($id, $when, $who, $func) = @$ent;
	next if $seen{$id};
	$seen{$id} = 1;
	$by_id{$id} = [$id, $func, $who, $when, $tag];
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3