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

Diff of /FigWebServices/index.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27, Fri Apr 2 18:02:20 2004 UTC revision 1.28, Thu Apr 8 16:38:05 2004 UTC
# Line 6  Line 6 
6  use CGI;  use CGI;
7  my $cgi = new CGI;  my $cgi = new CGI;
8    
9  my($map,@orgs,$user,$map,$org,$made_by);  my($map,@orgs,$user,$map,$org,$made_by,$from_func,$to_func);
10    
11  if (0)  if (0)
12  {  {
# Line 45  Line 45 
45  my $user = $cgi->param('user');  my $user = $cgi->param('user');
46  if (! $user) { $user = "" }  if (! $user) { $user = "" }
47    
48  if ($cgi->param('Search for Genes Matching an Occurrence Profile'))  if ($cgi->param('Search for Genes Matching an Occurrence Profile or Common to a Set of Organisms'))
49  {  {
50      unshift @$html, "<TITLE>The SEED: Phylogenetic Signatures</TITLE>\n";      unshift @$html, "<TITLE>The SEED: Phylogenetic Signatures</TITLE>\n";
51      my $url = $cgi->url;      my $url = $cgi->url;
# Line 133  Line 133 
133  {  {
134      &export_assignments($fig,$cgi,$html,$made_by);      &export_assignments($fig,$cgi,$html,$made_by);
135  }  }
136    elsif ($cgi->param('Generate Assignments via Translation') &&
137           ($from_func = $cgi->param('from_func')) &&
138           ($to_func = $cgi->param('to_func')))
139    {
140        &translate_assignments($fig,$cgi,$html,$from_func,$to_func);
141    }
142    
143  #-----------------------------------------------------------------------  #-----------------------------------------------------------------------
144  #  Initial search page  #  Initial search page
# Line 225  Line 231 
231                  $cgi->checkbox(-label => 'Save Assignments: ', -name => 'save_assignments', -value => 1),                  $cgi->checkbox(-label => 'Save Assignments: ', -name => 'save_assignments', -value => 1),
232                  $cgi->br,                  $cgi->br,
233                  $cgi->submit('Extract Assignments'),                  $cgi->submit('Extract Assignments'),
234                    $cgi->br, $cgi->br,
235                    "Alternatively, you can generate a set of assignments as translations of existing assignments.",
236                    $cgi->br,
237                    "From: ",$cgi->textfield(-name => "from_func", -size => 60),
238                    $cgi->br,
239                    "To:&nbsp;&nbsp;&nbsp;&nbsp; ",$cgi->textfield(-name => "to_func", -size => 60),
240                    $cgi->br,
241                    $cgi->submit('Generate Assignments via Translation'),
242                  $cgi->hr,                  $cgi->hr,
   
243                  $cgi->h1('Searching for Interesting Genes'),                  $cgi->h1('Searching for Interesting Genes'),
244                  $cgi->submit('Search for Genes Matching an Occurrence Profile'),                  $cgi->submit('Search for Genes Matching an Occurrence Profile or Common to a Set of Organisms'),
245                  $cgi->end_form                  $cgi->end_form
246           );           );
247    
# Line 711  Line 724 
724      return $peg;      return $peg;
725  }  }
726    
727    sub translate_assignments {
728        my($fig,$cgi,$html,$from_func,$to_func) = @_;
729    
730        my $user = $cgi->param('save_user');
731        if ($user)
732        {
733            &FIG::verify_dir("$FIG_Config::data/Assignments/$user");
734            my $file = &FIG::epoch_to_readable(time) . ":$user:translation";
735            if (open(TMP,">$FIG_Config::data/Assignments/$user/$file"))
736            {
737                my($peg,$from_funcQ,$to_funcQ,$func,$to);
738                $from_funcQ = quotemeta $from_func;
739    
740                foreach $peg ($fig->seqs_with_role($from_func))
741                {
742                    if ($peg =~ /^fig\|/)
743                    {
744                        $func = $fig->function_of($peg);
745                        $to   = $func;
746                        if ($to   =~ s/$from_funcQ/$to_func/)
747                        {
748                            print TMP "$peg\t$to\n";
749                        }
750                    }
751                }
752                close(TMP);
753            }
754            push(@$html,$cgi->h1("Saved Assignment Set $file"));
755        }
756        else
757        {
758            push(@$html,$cgi->h1("You need to specify a user to save an assignment set"));
759        }
760    }

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3