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

View of /FigWebServices/ar_coexp.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (download) (annotate)
Thu Oct 4 19:45:28 2012 UTC (7 years, 3 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
Changes since 1.7: +1 -1 lines
minor fix

########################################################################
# -*- 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 URI::Escape;  # uri_escape
use FIG;
my $fig = new FIG;

use HTML;
use strict;

use CGI;
my $cgi = new CGI;

if (0)
{
    my $VAR1;
    eval(join("",`cat /tmp/ar_coexp`));
    $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/ar_coexp"))
	{
	    print TMP &Dumper($cgi);
	    close(TMP);
	}
    }
    exit;
}
my $html = [];
my $genome    = $cgi->param('genome');
my $ar        = $cgi->param('ar');

if ($genome && $ar)
{
    push(@$html,"<h1>Coexpressed with PEGs in atomic regulon $ar in genome $genome</h1>");
    &show_coreg($fig,$cgi,$html,$genome,$ar);
}
else
{
    push(@$html,"<h3>Invalid parameters: set both 'genome' and 'ar'</h3>");
}
&show_coreg($fig,$cgi,$html,$genome,$ar);
&HTML::show_page($cgi,$html);
exit;

sub show_coreg {
    my($fig,$cgi,$html,$genome,$ar) = @_;

    my @tab = map { chop; [split(/\t/,$_)] } `svr_atomic_reg_coexp -g $genome -ar $ar`;
    my $hdrs = shift @tab;
    $hdrs->[1] = "Avg. Sc";
    push(@$hdrs,"Function");
    my $link;
    if ($cgi->param('by_peg'))
    {
	@tab = sort { &SeedUtils::by_fig_id($a->[0],$b->[0]) } @tab;
	$link = "ar_coexp.cgi?genome=$genome&ar=$ar";
    }
    else
    {
	$link = "ar_coexp.cgi?genome=$genome&ar=$ar&by_peg=1";
    }
    push(@$html,"<br>","<a href=$link>resort</a>");
    foreach my $row (@tab)
    {
	push(@$row,scalar $fig->function_of($row->[0]));
	$row->[0] = &HTML::fid_link($cgi,$row->[0]);
#	$row->[0] = &peg_link($row->[0]);
    }
    push(@$html,&HTML::make_table($hdrs,\@tab,"PEGs with Higher PCC Values"));
    return;
}

sub peg_link {
    my($peg) = @_;

    return "<a href=http://pubseed.theseed.org/seedviewer.cgi?page=Annotation&feature=$peg>$peg</a>";
}


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3