[Bio] / FigWebServices / bad_roles.cgi Repository:
ViewVC logotype

View of /FigWebServices/bad_roles.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (annotate)
Tue Dec 16 23:41:46 2008 UTC (10 years, 11 months ago) by overbeek
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, myrast_rel40, mgrast_dev_05262011, rast_rel_2008_12_18, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2009_07_09, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, rast_rel_2009_03_26, mgrast_dev_10262011, HEAD
check for lack of similarity within each column of an ss

use CGI;


if (-f "$FIG_Config::data/Global/why_down")
{
    local $/;
    open my $fh, "<$FIG_Config::data/Global/why_down";
    my $down_msg = <$fh>;
    
    print CGI::header();
    print CGI::head(CGI::title("SEED Server down"));
    print CGI::start_body();
    print CGI::h1("SEED Server down");
    print CGI::p("The seed server is not currently running:");
    print CGI::pre($down_msg);
    print CGI::end_body();
    exit;
}

if ($FIG_Config::readonly)
{
    CGI::param("user", undef);
}
# -*- perl -*-
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#


use FIG;
my $fig = new FIG;

use HTML;
use strict;

use CGI;
my $cgi = new CGI;

my $user = $cgi->param('user'); 
if (0)
{
    my $VAR1;
    eval(join("",`cat /tmp/tmp.bad`));
    $cgi = $VAR1;
#   print STDERR &Dumper($cgi);
}

if (0)
{
    print $cgi->header;
    my @params = $cgi->param;
    print "<pre>\n";
    foreach $_ (@params)
    {
	print "$_\t:",join(",",$cgi->param($_)),":\n";
    }

    if (0)
    {
	if (open(TMP,">/tmp/tmp.bad"))
	{
	    print TMP &Dumper($cgi);
	    close(TMP);
	}
    }
    exit;
}

my $html = [];

my $file = "$FIG_Config::temp/to.check";
if (! -s $file) 
{
    push(@$html,$cgi->h1("tell Ross that the to.check file needs to be updated"));
    &HTML::show_page($cgi,$html);
    exit;
}

my $user = $cgi->param('user');
if (! $user)
{
    my @curators = map { $_ =~ /^(\S+)/; $1 } `grep "^[a-zA-Z]" $file | grep -v fig | cut -f1 | sort -u`;

    push(@$html,
	        $cgi->start_form(-action => "bad_roles.cgi", -method => 'post'),
	        $cgi->h1("pick curator"),
		$cgi->scrolling_list(-name => 'user', -values => [@curators], -size => 30, -multiple => 0),
	        $cgi->hr,
	        $cgi->submit('show problems'),
	        $cgi->end_form
	 );
}
else
{
    $/ = "\n//\n";
    open(IN,"<$file") || die "could not open $file";
    while (defined($_ = <IN>))
    {
	chomp;
	if ($_ =~ /^$user\t(\S[^\t]+\S)\t(\S[^\n]+\S)\n(.*)/s)
	{
	    my($sub,$role,$sets) = ($1,$2,$3);
	    my @sets = map { $_ =~ s/^\|/fig\|/; $_ } split(/\nfig/,$sets);
	    if (@sets < 2) { die "BAD SETS: $sets"; }
	    my @sets1 = ();
	    foreach my $set (@sets)
	    {
		my @pegs = grep { my $peg = $_; 
				  my $func = $fig->function_of($peg);
				  (index($func,$role) >= 0) ? $peg : () }
		           ($set =~ /fig\|\d+\.\d+\.peg\.\d+/g);
		if (@pegs > 0)
		{
		    push(@sets1,[@pegs]);
		}
	    }
		
	    @sets = sort { @$b <=> @$a } @sets1;
	    
	    if (@sets > 1)
	    {
		my $tab = [];
		my $col_hdrs = ['Subsystem','Role','Set'];
		my $first = shift @sets;
		push(@$tab,[$sub,$role,&format_set($first,$cgi)]);
		foreach my $set (@sets)
		{
		    push(@$tab,['&nbsp','&nbsp',&format_set($set,$cgi)]);
		}
		push(@$html,&HTML::make_table($col_hdrs,$tab,"Possible Problems"),$cgi->hr);
	    }
	}
    }
}	
&HTML::show_page($cgi,$html);
exit;

sub format_set {
    my($set,$cgi) = @_;
    my $ln = @$set;
    my @show = @$set;
    if ($ln > 5) { $#show = 4; }
    @show = map { &HTML::fid_link($cgi,$_) } @show;
    return "[$ln]&nbsp;&nbsp;" . join(",",@show);
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3