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

View of /FigWebServices/wc.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (download) (annotate)
Tue May 27 16:31:49 2014 UTC (5 years, 6 months ago) by overbeek
Branch: MAIN
Changes since 1.7: +5 -0 lines
help documentation

########################################################################
# -*- 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 gjoseqlib;
use HTML;
use strict;
use CGI;
my $cgi = new CGI;
use SeedEnv;
use tree_utilities;
use CloseStrains;

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

my $html     = [];

my $node     = $cgi->param('node');
my $family   = $cgi->param('family');
my $ali      = $cgi->param('alignment');
my $tree     = $cgi->param('tree');
my $request  = $cgi->param('request');
my $keywords = $cgi->param('keywords');
my $function = $cgi->param('function');
my $dataD    = $cgi->param('dataD');
my $csD      = "/homes/overbeek/Ross/MakeCS.Kbase/Data/CS";
my $dataDF   = "$csD/$dataD";

my $parms = {};

$parms->{genome_types} = &CloseStrains::genome_types($dataDF);
$parms->{dataDF}       = $dataDF;

if ($request eq "show_otus")
{
    &show_otus($cgi,$csD);
    exit;
}
elsif (($request eq "show_options_for_otu") && $dataD)
{
    $html = &CloseStrains::show_options_for_otu($cgi,$dataD);
}
elsif ($request eq "show_signatures")
{
    &CloseStrains::show_signatures($cgi,$parms,$html);
}
elsif ($request eq "compute_sigs")
{
    &CloseStrains::compute_signatures($cgi,$parms,$html);
}
elsif (($request eq "show_func") && $function)
{
    $function =~ s/^\s+//;
    $function =~ s/\s+$//;
    &CloseStrains::show_func($cgi,$parms,$html,$function);
}
elsif (($request eq "show_family_pegs") && $family)
{
    &CloseStrains::show_family_pegs($cgi,$parms,$html,$family);
}
elsif (($request eq "show_virulence_functions") && (-s "$dataDF/virulence.functions"))
{
    &CloseStrains::show_virulence_functions($cgi,$parms,$html);
}
elsif (($request eq 'show_indexed_funcs') && $keywords)
{
    &CloseStrains::show_indexed_funcs($cgi,$parms,$html,$keywords); 
}
elsif (($request eq "show_ali_or_occurs_tree") && $ali)
{
    &CloseStrains::show_ali($cgi,$parms);  # NOTE: the alignment invokes Gary's alignment viewer,
                                            # which prints the header, so we print everything in show_ali
    exit;
}
elsif (($request eq "show_ali_or_occurs_tree") && $tree)
{
    &CloseStrains::show_occurs_tree($cgi,$parms,$html);
}
elsif (($request eq "show_family_tree") && $family)
{
    &CloseStrains::show_family_tree($cgi,$parms,$html,$family);
}
elsif (($request eq "show_node") && $node)
{
    &CloseStrains::show_node($cgi,$parms,$html,$node);
}
elsif ($request eq "show_otu_tree")
{
    &CloseStrains::show_otu_tree($cgi,$parms,$html,'families');
}
elsif ($request eq "show_adjacency")
{
    &CloseStrains::show_otu_tree($cgi,$parms,$html,'adjacency');
}
elsif ($request eq "show_clusters")
{
    &CloseStrains::show_clusters($cgi,$parms,$html);
}
elsif ($request eq "show_help")
{
    my $type = $cgi->param('type');
    if ($type eq "signatures")
    {
	my $help_sig = &CloseStrains::help_sig();
	push(@$html,"<pre>$help_sig</pre>\n");
    }
    elsif ($type eq "compute_signatures")
    {
	my $help_sig_output = &CloseStrains::help_sig_output();
	push(@$html,"<pre>$help_sig_output</pre>\n");
    }
    elsif ($type eq "family")
    {
	my $help_family_output = &CloseStrains::help_family_output();
	push(@$html,"<pre>$help_family_output</pre>\n");
    }
    elsif ($type eq "function")
    {
	my $help_function_output = &CloseStrains::help_function_output();
	push(@$html,"<pre>$help_function_output</pre>\n");
    }
    elsif ($type eq "adjacency")
    {
	my $help_adjacency_output = &CloseStrains::help_adjacency_output();
	push(@$html,"<pre>$help_adjacency_output</pre>\n");
    }
}
else
{
    push(@$html,"<h1>Invalid request</h1>");
}
&HTML::show_page($cgi,$html);
exit;

sub show_otus {
    my($cgi,$datadir) = @_;

    print $cgi->header;
    if (opendir(GENERA,$csD))
    {
	my @genera = grep { $_ !~ /^\./ } readdir(GENERA);
	closedir(GENERA);
	print "<h1>What Changed?</h1>\n";
	print "<h2><a target=_blank href=\"http://bioseed.mcs.anl.gov/~overbeek/what_changed.html\">Getting Started: a short Tutorial</a></h2>\n";
	print "<h2>Genera Available</h2>\n";
	foreach my $g (sort @genera)
	{
	    print "<h3><a target=_blank href=http://bioseed.mcs.anl.gov/ross/FIG/wc.cgi?request=show_options_for_otu&dataD=$g>$g</a>\n";
	}
    }
    else
    {
	print "<h1>The dataD parameter is invalid\n";
    }
}

sub virulence_functions_link {
    my($cgi,$dataDF) = @_;

    if ((-s "$dataDF/virulence.functions") && ($dataDF =~ /([^\/]+)$/))
    {
	my $dataDQ = uri_escape($1);
	return "<a target=_blank href=http://bioseed.mcs.anl.gov/ross/FIG/wc.cgi?request=show_virulence_functions&dataD=$dataDQ>Some Posssible Functions Associated with Virulence</a>";
    }
    return '';
}



MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3