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

View of /FigWebServices/split_functional_role.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (annotate)
Fri Mar 31 19:17:04 2006 UTC (13 years, 7 months ago) by overbeek
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, rast_rel_2008_06_18, myrast_rel40, rast_rel_2008_06_16, mgrast_dev_05262011, rast_rel_2008_12_18, mgrast_dev_04082011, rast_rel_2008_07_21, rast_rel_2010_0928, rast_2008_0924, mgrast_version_3_2, mgrast_dev_12152011, rast_rel_2008_04_23, mgrast_dev_06072011, rast_rel_2008_09_30, 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, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_rel_2008_0625, 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, rast_rel_2008_10_09, mgrast_dev_04012011, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0919, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, mgrast_dev_04052011, mgrast_dev_02222011, rast_rel_2009_03_26, mgrast_dev_10262011, rast_rel_2008_11_24, rast_rel_2008_08_07, HEAD
Changes since 1.1: +1 -0 lines
to make sure

# -*- perl -*-
#
# Copyright (c) 1003-1006 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 CGI;
my $cgi = new CGI;

if (0) {
    my $VAR1;
    eval(join("",`cat /tmp/split_functional_role_parms`));
    $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/split_functional_role_parms")) {
	    	print TMP &Dumper($cgi);
	    	close(TMP);
		}
    }
    exit;
}

use HTML;
my $html = [];

my $to_split = $cgi->param('to_split');
my @param = grep { $_ =~ /^set\d+$/ } $cgi->param;
my @set = ();
foreach $_ (@param)
{
    my $val = $cgi->param($_);
    if ($val =~ /\S/)
    {
	$val =~ s/^\s+//;
	$val =~ s/\s+$//;
	push(@set,$val);
    }
}

my(@subs);
if ($to_split)
{
    my %subs = map { $_->[0] => 1 } grep { ($_->[1] eq $to_split) } $fig->subsystems_for_role($to_split);
    @subs = sort keys(%subs);
}

if ($to_split && (@subs > 0) && (@set > 1))
{
    my $sub;
    foreach $sub (@subs)
    {
	my $subsystem = new Subsystem($sub,$fig,0);
        my @roles = $subsystem->get_roles;
	my $which = $subsystem->get_role_index($to_split);
	@roles = map { [$_,$subsystem->get_role_abbr($subsystem->get_role_index($_))] } @roles;

	if (my $abbrev = $subsystem->get_role_abbr($which))
	{
	    my $n = 1;
	    my @to_add = ();
	    for ($i=0; ($i < @set); $i++)
	    {
		push(@to_add,[$set[$i],"$abbrev-$n"]);
		$n++;
	    }
	    splice(@roles,$which,1,@to_add);
	    $subsystem->set_roles(\@roles);
	    $subsystem->set_subsetC("\*$abbrev",[map { $_->[0] } @to_add]);
	    $subsystem->write_subsystem;
	    system('index_subsystems',@subs);
	    push(@$html,$cgi->h2("split in $sub"));
	}
	else
	{
	    push(@$html,$cgi->h1("*** could not split in $sub"),"\n");
	}
    }
}
else
{
    push(@$html,$cgi->start_form(-action=>"split_functional_role.cgi"),
	        "Role to Split: ",$cgi->textfield( -name => "to_split", -size => 100 ),$cgi->br,$cgi->br,
	        "Set  1: ",$cgi->textfield( -name => "set1", -size => 100 ),$cgi->br,
	        "Set  2: ",$cgi->textfield( -name => "set2", -size => 100 ),$cgi->br,
	        "Set  3: ",$cgi->textfield( -name => "set3", -size => 100 ),$cgi->br,
	        "Set  4: ",$cgi->textfield( -name => "set4", -size => 100 ),$cgi->br,
	        "Set  5: ",$cgi->textfield( -name => "set5", -size => 100 ),$cgi->br,
	        "Set  6: ",$cgi->textfield( -name => "set6", -size => 100 ),$cgi->br,
	        "Set  7: ",$cgi->textfield( -name => "set7", -size => 100 ),$cgi->br,
	        "Set  8: ",$cgi->textfield( -name => "set8", -size => 100 ),$cgi->br,
	        "Set  9: ",$cgi->textfield( -name => "set9", -size => 100 ),$cgi->br,
	        "Set 10: ",$cgi->textfield( -name => "set10", -size => 100 ),$cgi->br,
	        "Set 11: ",$cgi->textfield( -name => "set11", -size => 100 ),$cgi->br,
	        "Set 12: ",$cgi->textfield( -name => "set12", -size => 100 ),$cgi->br,
	        "Set 13: ",$cgi->textfield( -name => "set13", -size => 100 ),$cgi->br,
	        "Set 14: ",$cgi->textfield( -name => "set14", -size => 100 ),$cgi->br,
	        "Set 15: ",$cgi->textfield( -name => "set15", -size => 100 ),$cgi->br,
	        "Set 16: ",$cgi->textfield( -name => "set16", -size => 100 ),$cgi->br,
	        "Set 17: ",$cgi->textfield( -name => "set17", -size => 100 ),$cgi->br,
	        "Set 18: ",$cgi->textfield( -name => "set18", -size => 100 ),$cgi->br,
	        "Set 19: ",$cgi->textfield( -name => "set19", -size => 100 ),$cgi->br,
	        "Set 20: ",$cgi->textfield( -name => "set20", -size => 100 ),$cgi->br,
	        $cgi->submit('Split'),
	        $cgi->end_form
	 );
}

&HTML::show_page($cgi,$html);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3