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

Annotation of /FigWebServices/index.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.90 - (view) (download)

1 : overbeek 1.49 ### start
2 :    
3 : efrank 1.1 use FIG;
4 : olson 1.89 use FIG_CGI;
5 : efrank 1.1
6 : golsen 1.65 use strict;
7 : parrello 1.78 use Tracer;
8 : golsen 1.65 use FIGjs qw( toolTipScript );
9 :     use GenoGraphics qw( render );
10 :     use IPC::Open2 qw( open2 );
11 :    
12 : olson 1.36 use POSIX;
13 : efrank 1.1 use HTML;
14 : golsen 1.65
15 : olson 1.89 my($fig, $cgi, $user);
16 : olson 1.90 my $this_script = "index.cgi";
17 : efrank 1.1
18 : olson 1.54 eval {
19 : olson 1.89 ($fig, $cgi, $user) = FIG_CGI::init(debug_save => 0,
20 :     debug_load => 0,
21 :     print_params => 0);
22 : olson 1.54 };
23 :    
24 :     if ($@ ne "")
25 :     {
26 :     my $err = $@;
27 :    
28 :     my(@html);
29 :    
30 :     push(@html, $cgi->p("Error connecting to SEED database."));
31 :     if ($err =~ /Could not connect to DBI:.*could not connect to server/)
32 :     {
33 : parrello 1.75 push(@html, $cgi->p("Could not connect to relational database of type $FIG_Config::dbms named $FIG_Config::db on port $FIG_Config::dbport."));
34 : olson 1.54 }
35 :     else
36 :     {
37 : parrello 1.75 push(@html, $cgi->pre($err));
38 : olson 1.54 }
39 :     &HTML::show_page($cgi, \@html, 1);
40 :     exit;
41 :     }
42 : olson 1.89
43 : parrello 1.78 Trace("Connected to FIG.") if T(2);
44 : overbeek 1.28 my($map,@orgs,$user,$map,$org,$made_by,$from_func,$to_func);
45 : efrank 1.1
46 : overbeek 1.85 #for my $k (sort keys %ENV)
47 :     #{
48 :     # warn "$k=$ENV{$k}\n";
49 :     #}
50 : overbeek 1.81
51 : efrank 1.1 $ENV{"PATH"} = "$FIG_Config::bin:$FIG_Config::ext_bin:" . $ENV{"PATH"};
52 :    
53 :     my $html = [];
54 : golsen 1.23
55 : overbeek 1.51 my($pattern,$seq_pat,$tool,$ids,$subsearch);
56 : redwards 1.80
57 : overbeek 1.87 my $user = $cgi->param('user');
58 :    
59 : overbeek 1.28 if ($cgi->param('Search for Genes Matching an Occurrence Profile or Common to a Set of Organisms'))
60 : efrank 1.1 {
61 : parrello 1.78 Trace("Gene search chosen.") if T(2);
62 : golsen 1.23 unshift @$html, "<TITLE>The SEED: Phylogenetic Signatures</TITLE>\n";
63 : efrank 1.1 $ENV{"REQUEST_METHOD"} = "GET";
64 :     $ENV{"QUERY_STRING"} = "user=$user";
65 :     my @out = `./sigs.cgi`;
66 : overbeek 1.49 print @out;
67 :     exit;
68 :     }
69 :     #-----------------------------------------------------------------------
70 :     # Statistics for a single organism
71 :     #-----------------------------------------------------------------------
72 :     elsif ($cgi->param('statistics'))
73 :     {
74 : parrello 1.78 Trace("Statistics chosen.") if T(2);
75 : overbeek 1.49 @orgs = $cgi->param('korgs');
76 :     @orgs = map { $_ =~ /\((\d+\.\d+)\)/; $1 } @orgs;
77 :     if (@orgs != 1)
78 :     {
79 : golsen 1.72 unshift @$html, "<TITLE>The SEED Statistics Page</TITLE>\n";
80 : overbeek 1.49 push(@$html,$cgi->h1('Please select a single organism to get statistcs'));
81 :     }
82 :     else
83 :     {
84 : parrello 1.75 $ENV{"REQUEST_METHOD"} = "GET";
85 :     $ENV{"QUERY_STRING"} = "user=$user&genome=$orgs[0]";
86 :     my @out = `./genome_statistics.cgi`;
87 :     print @out;
88 :     exit;
89 : overbeek 1.49 }
90 : efrank 1.1 }
91 : overbeek 1.17 #-----------------------------------------------------------------------
92 : overbeek 1.51 # Locate PEGs in Subsystems
93 :     #-----------------------------------------------------------------------
94 :     elsif ($cgi->param('Find PEGs') && ($subsearch = $cgi->param('subsearch')))
95 :     {
96 : parrello 1.78 Trace("PEG find chosen.") if T(2);
97 : overbeek 1.51 my $genome = $cgi->param('genome');
98 :     my (@pegs,$peg);
99 : overbeek 1.52
100 :     my @poss = $fig->by_alias($subsearch);
101 :     if (@poss > 0) { $subsearch = $poss[0] }
102 :    
103 : overbeek 1.51 if ($subsearch =~ /(fig\|\d+\.\d+\.peg\.\d+)/)
104 :     {
105 : parrello 1.75 # handle searching for homologs that occur in subsystems
106 :     $peg = $1;
107 :     @pegs = ($peg);
108 :     push(@pegs,map { $_->id2 } $fig->sims( $peg, 500, 1.0e-10, "fig"));
109 :     if ($genome)
110 :     {
111 :     my $genomeQ = quotemeta $genome;
112 :     @pegs = grep { $_ =~ /^fig\|$genomeQ/ } @pegs;
113 :     }
114 : overbeek 1.51 }
115 :     else
116 :     {
117 : parrello 1.75 # handle searching for PEGs with functional role in subsystems
118 :     @pegs = $fig->seqs_with_role($subsearch,"master",$genome);
119 : overbeek 1.51 }
120 :    
121 :     print $cgi->header;
122 :     if (@pegs == 0)
123 :     {
124 : parrello 1.75 print $cgi->h1("Sorry, could not even find PEGs to check");
125 : overbeek 1.51 }
126 :     else
127 :     {
128 : parrello 1.75 my(@pairs,$pair,@sub);
129 :     @pairs = map { $peg = $_;
130 :     @sub = $fig->peg_to_subsystems($peg);
131 :     map { [$peg,$_] } @sub } @pegs;
132 :     if (@pairs == 0)
133 :     {
134 :     print $cgi->h1("Sorry, could not map any PEGs to subsystems");
135 :     }
136 :     else
137 :     {
138 :     my($uni,$uni_func);
139 :     my $col_hdrs = ["PEG","Genome","Function","UniProt","UniProt Function","Subsystem"];
140 :     my $tab = [ map { $pair = $_; $uni = $fig->to_alias($pair->[0],"uni");
141 :     ($uni,$uni_func) = $uni ? (&HTML::uni_link($cgi,$uni),scalar $fig->function_of($uni)) : ("","");
142 :     [&HTML::fid_link($cgi,$pair->[0]),
143 :     $fig->org_of($pair->[0]),
144 :     scalar $fig->function_of($pair->[0]),
145 :     $uni,$uni_func,
146 :     &HTML::sub_link($cgi,$pair->[1])] } @pairs];
147 :     print &HTML::make_table($col_hdrs,$tab,"PEGs that Occur in Subsystems");
148 :     }
149 : overbeek 1.51 }
150 :     exit;
151 :     }
152 :     #-----------------------------------------------------------------------
153 : overbeek 1.31 # Align Sequences
154 :     #-----------------------------------------------------------------------
155 :     elsif ($cgi->param('Align Sequences'))
156 :     {
157 : parrello 1.78 Trace("Sequence alignment chosen.");
158 : overbeek 1.31 my $seqs = $cgi->param('seqids');
159 :     $seqs =~ s/^\s+//;
160 :     $seqs =~ s/\s+$//;
161 :     my @seq_ids = split(/[ \t,;]+/,$seqs);
162 :     if (@seq_ids < 2)
163 :     {
164 : parrello 1.75 print $cgi->header;
165 :     print $cgi->h1("Sorry, you need to specify at least two sequence IDs");
166 : overbeek 1.31 }
167 :     else
168 :     {
169 : parrello 1.75 $ENV{"REQUEST_METHOD"} = "GET";
170 :     $_ = join('&checked=',@seq_ids);
171 :     $ENV{"QUERY_STRING"} = "user=$user&align=1&checked=" . $_;
172 :     my @out = `./fid_checked.cgi`;
173 :     print join("",@out);
174 : overbeek 1.31 }
175 :     exit;
176 :     }
177 :     #-----------------------------------------------------------------------
178 : overbeek 1.17 # Search (text) || Find Genes in Org that Might Play the Role
179 :     #-----------------------------------------------------------------------
180 : golsen 1.59 elsif ( ( $pattern = $cgi->param('pattern') )
181 :     && ( $cgi->param('Search')
182 :     || $cgi->param('Search genome selected below')
183 : redwards 1.63 || $cgi->param('Search Selected Organisms')
184 : golsen 1.59 || $cgi->param('Find Genes in Org that Might Play the Role')
185 :     )
186 :     )
187 : efrank 1.1 {
188 : parrello 1.78 Trace("Pattern search chosen.") if T(2);
189 : overbeek 1.17 # Remove leading and trailing spaces from pattern -- GJO:
190 :     $pattern =~ s/^\s+//;
191 :     $pattern =~ s/\s+$//;
192 : efrank 1.1 if ($cgi->param('Find Genes in Org that Might Play the Role') &&
193 : parrello 1.75 (@orgs = $cgi->param('korgs')) && (@orgs == 1))
194 : efrank 1.1 {
195 : parrello 1.75 unshift @$html, "<TITLE>The SEED: Genes in that Might Play Specific Role</TITLE>\n";
196 :     @orgs = map { $_ =~ /\((\d+\.\d+)\)/; $1 } @orgs;
197 :     $ENV{"REQUEST_METHOD"} = "GET";
198 :     $ENV{"QUERY_STRING"} = "user=$user&request=find_in_org&role=$pattern&org=$orgs[0]";
199 :     my @out = `./pom.cgi`;
200 :     print join("",@out);
201 :     exit;
202 : efrank 1.1 }
203 :     else
204 :     {
205 : parrello 1.75 unshift @$html, "<TITLE>The SEED: Search Results</TITLE>\n";
206 :     &show_indexed_objects($fig, $cgi, $html, $pattern);
207 : efrank 1.1 }
208 :     }
209 : overbeek 1.17 #-----------------------------------------------------------------------
210 :     # Metabolic Overview
211 :     #-----------------------------------------------------------------------
212 : efrank 1.1 elsif (($map = $cgi->param('kmap')) && $cgi->param('Metabolic Overview'))
213 :     {
214 : parrello 1.78 Trace("Metabolic overview chosen.") if T(2);
215 : olson 1.38 if ($map =~ /\(([^)]*)\)$/)
216 :     {
217 : parrello 1.75 $map = $1;
218 : olson 1.38 }
219 :     else
220 :     {
221 : parrello 1.75 # ??? Gary ???
222 : olson 1.38 }
223 :    
224 :     #$map =~ s/^.*\((MAP\d+)\).*$/$1/;
225 : efrank 1.1 @orgs = $cgi->param('korgs');
226 :     @orgs = map { $_ =~ /\((\d+\.\d+)\)/; $1 } @orgs;
227 :     $ENV{"REQUEST_METHOD"} = "GET";
228 :     if (@orgs > 0)
229 :     {
230 : parrello 1.75 $ENV{"QUERY_STRING"} = "user=$user&map=$map&org=$orgs[0]";
231 : efrank 1.1 }
232 :     else
233 :     {
234 : parrello 1.75 $ENV{"QUERY_STRING"} = "user=$user&map=$map";
235 : efrank 1.1 }
236 :    
237 : golsen 1.23 unshift @$html, "<TITLE>The SEED: Metabolic Overview</TITLE>\n";
238 : olson 1.38 my @out = `./show_map.cgi`;
239 : efrank 1.1 &HTML::trim_output(\@out);
240 : golsen 1.23 push( @$html, "<br>\n", @out );
241 : efrank 1.1 }
242 : overbeek 1.17
243 :     #-----------------------------------------------------------------------
244 :     # Search for Matches (sequence or pattern)
245 :     #-----------------------------------------------------------------------
246 : efrank 1.1 elsif (($seq_pat = $cgi->param('seq_pat')) &&
247 :     ($tool = $cgi->param('Tool')) &&
248 :     $cgi->param('Search for Matches'))
249 :     {
250 : parrello 1.78 Trace("Match search chosen.") if T(2);
251 : overbeek 1.30 @orgs = $cgi->param('korgs');
252 :     if (@orgs > 0)
253 :     {
254 : parrello 1.75 @orgs = map { $_ =~ /\((\d+\.\d+)\)/; $1 } @orgs;
255 : overbeek 1.30 }
256 :     else
257 :     {
258 : parrello 1.75 @orgs = ("");
259 : overbeek 1.30 }
260 :    
261 : efrank 1.1 if ($tool =~ /blast/)
262 :     {
263 : parrello 1.75 unshift @$html, "<TITLE>The SEED: BLAST Search Results</TITLE>\n";
264 :     &run_blast($fig,$cgi,$html,$orgs[0],$tool,$seq_pat);
265 : efrank 1.1 }
266 :     elsif ($tool =~ /Protein scan_for_matches/)
267 :     {
268 : parrello 1.75 unshift @$html, "<TITLE>The SEED: Protein Pattern Match Results</TITLE>\n";
269 :     &run_prot_scan_for_matches($fig,$cgi,$html,$orgs[0],$seq_pat);
270 : efrank 1.1 }
271 :     elsif ($tool =~ /DNA scan_for_matches/)
272 :     {
273 : parrello 1.75 unshift @$html, "<TITLE>The SEED: Nucleotide Pattern Match Results</TITLE>\n";
274 :     &run_dna_scan_for_matches($fig,$cgi,$html,$orgs[0],$seq_pat);
275 : efrank 1.1 }
276 :     }
277 : overbeek 1.7 elsif (($made_by = $cgi->param('made_by')) && $cgi->param('Extract Assignments'))
278 :     {
279 : parrello 1.78 Trace("Assignment export chosen.") if T(2);
280 : overbeek 1.7 &export_assignments($fig,$cgi,$html,$made_by);
281 :     }
282 : overbeek 1.28 elsif ($cgi->param('Generate Assignments via Translation') &&
283 :     ($from_func = $cgi->param('from_func')) &&
284 :     ($to_func = $cgi->param('to_func')))
285 :     {
286 : parrello 1.78 Trace("Assignment translate chosen.") if T(2);
287 : overbeek 1.28 &translate_assignments($fig,$cgi,$html,$from_func,$to_func);
288 :     }
289 : overbeek 1.30 elsif ($cgi->param('Extract Matched Sequences') && ($ids = $cgi->param('ids')))
290 :     {
291 : parrello 1.78 Trace("Matched sequence extract chosen.") if T(2);
292 : overbeek 1.30 my @ids = split(/,/,$ids);
293 :     my($list_to,$i);
294 :     if ($list_to = $cgi->param('list_to'))
295 :     {
296 : parrello 1.75 for ($i=0; ($i < @ids) && ($ids[$i] ne $list_to); $i++) {}
297 :     if ($i < @ids)
298 :     {
299 :     $#ids = $i;
300 :     }
301 : overbeek 1.30 }
302 :    
303 :     my($id,$seq,$i,$func);
304 :     push(@$html,$cgi->pre);
305 :    
306 :     foreach $id (@ids)
307 :     {
308 : parrello 1.75 if ($seq = $fig->get_translation($id))
309 :     {
310 :     $func = $fig->function_of($id);
311 :     push(@$html,">$id $func\n");
312 :     for ($i=0; ($i < length($seq)); $i += 60)
313 :     {
314 :     if ($i > (length($seq) - 60))
315 :     {
316 :     push(@$html,substr($seq,$i) . "\n");
317 :     }
318 :     else
319 :     {
320 :     push(@$html,substr($seq,$i,60) . "\n");
321 :     }
322 :     }
323 :     }
324 : overbeek 1.30 }
325 :     push(@$html,$cgi->end_pre);
326 :     }
327 : overbeek 1.17
328 :     #-----------------------------------------------------------------------
329 :     # Initial search page
330 :     #-----------------------------------------------------------------------
331 : efrank 1.1 else
332 :     {
333 : parrello 1.78 Trace("SEED Entry page chosen.") if T(2);
334 : golsen 1.23 unshift @$html, "<TITLE>The SEED: Entry Page</TITLE>\n";
335 : efrank 1.1 &show_initial($fig,$cgi,$html);
336 :     }
337 :     &HTML::show_page($cgi,$html,1);
338 : overbeek 1.49 exit;
339 : efrank 1.1
340 : overbeek 1.17
341 :     #==============================================================================
342 :     # Initial page (alias search)
343 :     #==============================================================================
344 :    
345 : efrank 1.1 sub show_initial {
346 :     my($fig,$cgi,$html) = @_;
347 :     my($map,$name,$olrg,$gs);
348 :    
349 : overbeek 1.83
350 :     #
351 :     # Display the message of the day, if present.
352 :     #
353 :    
354 :     show_motd($fig, $cgi, $html);
355 :    
356 : golsen 1.47 my( $a, $b, $e, $v, $env ) = $fig->genome_counts;
357 :     push(@$html,$cgi->h2("Contains $a archaeal, $b bacterial, $e eukaryal, $v viral and $env environmental genomes"));
358 :     my( $a, $b, $e ) = $fig->genome_counts("complete");
359 :     push(@$html,$cgi->h2("Of these, $a archaeal, $b bacterial and $e eukaryal genomes are more-or-less complete"),$cgi->hr);
360 : efrank 1.1
361 :     push(@$html,
362 : parrello 1.75 $cgi->h2('Work on Subsystems'),
363 : overbeek 1.46
364 : parrello 1.75 # $cgi->start_form(-action => "ssa2.cgi"),
365 :     # "Enter user: ",
366 :     # $cgi->textfield(-name => "user", -size => 20),
367 :     # $cgi->submit('Work on Subsystems'),
368 :     # $cgi->end_form,
369 :    
370 :     # $cgi->h2('Work on Subsystems Using New, Experimental Code'),
371 :     "This is the <i>new</i> subsystems code, and is now officially released.",
372 :     $cgi->start_form(-action => "subsys.cgi"),
373 :     "Enter user: ",
374 :     $cgi->textfield(-name => "user", -size => 20),
375 :     $cgi->submit('Work on Subsystems'),
376 :     $cgi->end_form,
377 :     $cgi->hr,
378 :     );
379 : olson 1.42
380 :     push(@$html,
381 : olson 1.89 $cgi->start_form(-action => $this_script),
382 : parrello 1.75 $cgi->h2('Searching for Genes or Functional Roles Using Text'),
383 :     "<table><tr>",
384 : overbeek 1.17 "<td>Search Pattern: </td><td>",
385 : parrello 1.75 $cgi->textfield(-name => "pattern", -size => 65),
386 :     "</td></tr><tr>",
387 :     "<td>User ID:</td><td>",
388 :     $cgi->textfield(-name => "user", -size => 20),
389 :     " [optional] ",
390 : overbeek 1.17 "&nbsp; &nbsp; Max Genes: ",
391 : parrello 1.75 $cgi->textfield(-name => "maxpeg", -size => 6, -value => 100),
392 : overbeek 1.17 "&nbsp; &nbsp; Max Roles: ",
393 : parrello 1.75 $cgi->textfield(-name => "maxrole", -size => 6, -value => 100),
394 :     $cgi->checkbox(-name => "substring_match", -label => 'Allow substring match'),
395 :     "</td></td></table>",
396 :     $cgi->submit('Search'),
397 :     $cgi->submit('Search genome selected below'),
398 :     $cgi->reset('Clear'),
399 :     $cgi->hr);
400 : olson 1.41
401 : golsen 1.47 my @display = ( 'All', 'Archaea', 'Bacteria', 'Eucarya', 'Viruses', 'Environmental samples' );
402 :    
403 :     #
404 :     # Canonical names must match the keywords used in the DBMS. They are
405 :     # defined in compute_genome_counts.pl
406 :     #
407 :     my %canonical = (
408 :     'All' => undef,
409 :     'Archaea' => 'Archaea',
410 :     'Bacteria' => 'Bacteria',
411 :     'Eucarya' => 'Eukaryota',
412 :     'Viruses' => 'Virus',
413 :     'Environmental samples' => 'Environmental Sample'
414 :     );
415 :    
416 :     my $req_dom = $cgi->param( 'domain' ) || 'All';
417 :     my @domains = $cgi->radio_group( -name => 'domain',
418 :     -default => $req_dom,
419 :     -override => 1,
420 :     -values => [ @display ]
421 :     );
422 :    
423 :     my $n_domain = 0;
424 :     my %dom_num = map { ( $_, $n_domain++ ) } @display;
425 :     my $req_dom_num = $dom_num{ $req_dom } || 0;
426 :    
427 :     #
428 :     # Viruses and Environmental samples must have completeness = All (that is
429 :     # how they are in the database). Otherwise, default is Only "complete".
430 :     #
431 :     my $req_comp = ( $req_dom_num > $dom_num{ 'Eucarya' } ) ? 'All'
432 :     : $cgi->param( 'complete' ) || 'Only "complete"';
433 :     my @complete = $cgi->radio_group( -name => 'complete',
434 :     -default => $req_comp,
435 :     -override => 1,
436 :     -values => [ 'All', 'Only "complete"' ]
437 :     );
438 :     #
439 :     # Use $fig->genomes( complete, restricted, domain ) to get org list:
440 :     #
441 :     my $complete = ( $req_comp =~ /^all$/i ) ? undef : "complete";
442 : redwards 1.48
443 :     my @orgs = sort map { $org = $_; my $gs = $fig->genus_species($org); my $gc=scalar $fig->all_contigs($org); "$gs ($org) [$gc contigs]" }
444 : golsen 1.47 $fig->genomes( $complete, undef, $canonical{ $req_dom } );
445 :    
446 :     my $n_genomes = @orgs;
447 :    
448 : golsen 1.59 push( @$html, $cgi->h2('If You Need to Pick a Genome for Options Below'),
449 : golsen 1.47 "<TABLE>\n",
450 :     " <TR>\n",
451 :     " <TD>",
452 : parrello 1.75 $cgi->scrolling_list( -name => 'korgs',
453 : golsen 1.47 -values => [ @orgs ],
454 : redwards 1.63 -size => 10,
455 : golsen 1.60 ), $cgi->br,
456 : golsen 1.47 "$n_genomes genomes shown ",
457 : golsen 1.60 $cgi->submit( 'Update List' ), $cgi->reset, $cgi->br,
458 : parrello 1.75 "Show some ", $cgi->submit('statistics')," of the selected genome",
459 : overbeek 1.77 " </TD>");
460 :    
461 :     push(@$html,
462 : golsen 1.47 " <TD>",
463 :     join( "<br>", "<b>Domain(s) to show:</b>", @domains), "<br>\n",
464 :     join( "<br>", "<b>Completeness?</b>", @complete), "\n",
465 :     "</TD>",
466 :     " </TR>\n",
467 :     "</TABLE>\n",
468 : golsen 1.60 $cgi->hr
469 :     );
470 : overbeek 1.49
471 : golsen 1.47 push( @$html, $cgi->h2('Finding Candidates for a Functional Role'),
472 : parrello 1.75 "Make sure that you type the functional role you want to search for in the Search Pattern above",
473 :     $cgi->br,
474 :     $cgi->submit('Find Genes in Org that Might Play the Role'),
475 :     $cgi->hr);
476 : overbeek 1.17
477 : golsen 1.60 my @maps = sort map { $map = $_; $name = $fig->map_name($map); "$name ($map)" } $fig->all_maps;
478 :    
479 : golsen 1.47 push( @$html, $cgi->h2('Metabolic Overviews and Subsystem Maps (via KEGG & SEED) - Choose Map'),
480 : parrello 1.75 $cgi->submit('Metabolic Overview'),
481 :     $cgi->br,
482 :     $cgi->br,
483 :     $cgi->scrolling_list(-name => 'kmap',
484 : efrank 1.1 -values => [@maps],
485 : parrello 1.75 -size => 10
486 : efrank 1.1 ),
487 : parrello 1.75 $cgi->hr);
488 : overbeek 1.17
489 : golsen 1.47 push( @$html, $cgi->h2('Searching DNA or Protein Sequences (in a selected organism)'),
490 : parrello 1.75 "<TABLE>\n",
491 :     " <TR>\n",
492 :     " <TD>Sequence/Pattern: </TD>",
493 :     " <TD Colspan=3>", $cgi->textarea(-name => 'seq_pat', -rows => 10, -cols => 70), "</TD>\n",
494 :     " </TR>\n",
495 :     " <TR>\n",
496 :     " <TD>Search Program: </TD>",
497 :     " <TD>", $cgi->popup_menu(-name => 'Tool', -values => ['blastp', 'blastx', 'blastn', 'tblastn', 'blastp against complete genomes', 'Protein scan_for_matches', 'DNA scan_for_matches'], -default => 'blastp'), " </TD>",
498 :     " <TD> Program Options:</TD>",
499 :     " <TD>", $cgi->textfield( -name => "blast_options", -size => 27 ), "</TD>",
500 :     " </TR>\n",
501 :     "</TABLE>\n",
502 :     $cgi->submit('Search for Matches'),
503 :     $cgi->hr);
504 : overbeek 1.17
505 : olson 1.41 #
506 :     # Make assignment export tbl.
507 :     #
508 :    
509 :     my @atbl;
510 : golsen 1.64 push(@atbl, [ "Extract assignments made by ",
511 : parrello 1.75 $cgi->textfield(-name => "made_by", -size => 25) . " (do not prefix with <b>master:</b>)" ]);
512 : golsen 1.64 push(@atbl, [ "Save as user: ",
513 : parrello 1.75 $cgi->textfield(-name => "save_user", -size => 25) . " (do not prefix with <b>master:</b>)" ] );
514 : golsen 1.64 push(@atbl, [ "After date (MM/DD/YYYY) ",
515 : parrello 1.75 $cgi->textfield(-name => "after_date", -size => 15)]);
516 : olson 1.41
517 :     push(@$html,
518 : overbeek 1.84 $cgi->h2($cgi->a({name => "exporting_assignments"}, 'Exporting Assignments')),
519 : parrello 1.75 &HTML::make_table(undef, \@atbl, '', border => 0),
520 :     $cgi->checkbox(-label => 'Tab-delimited Spreadsheet', -name => 'tabs', -value => 1),
521 :     $cgi->br,
522 :     $cgi->checkbox(-label => 'Save Assignments', -name => 'save_assignments', -value => 1),
523 :     $cgi->br,
524 :     $cgi->submit('Extract Assignments'),
525 :     $cgi->br, $cgi->br, $cgi->br,
526 :     "Alternatively, you can generate a set of assignments as translations of existing assignments. ",
527 :     "To do so, you need to make sure that you fill in the <b>Save as user</b> field just above. You ",
528 :     "should use something like <b>RossO</b> (leave out the <b>master:</b>). When you look at the assignments (and decide which ",
529 :     "to actually install), they will be made available under that name (but, when you access them, ",
530 :     "you will normally be using something like <b>master:RossO</b>)",
531 :     $cgi->br,$cgi->br,
532 :     "From: ",
533 :     $cgi->textarea(-name => 'from_func', -rows => 4, -cols => 100),
534 :     $cgi->br,$cgi->br,
535 :     "To:&nbsp;&nbsp;&nbsp;&nbsp; ",$cgi->textfield(-name => "to_func", -size => 100),
536 :     $cgi->br,
537 : overbeek 1.76 $cgi->a({class=>"help", target=>"help", href=>"Html/seedtips.html#replace_names"}, "Help with generate assignments via translation"),
538 : parrello 1.75 $cgi->submit('Generate Assignments via Translation'),
539 :     $cgi->hr,
540 :     $cgi->h2('Searching for Interesting Genes'),
541 :     $cgi->submit('Search for Genes Matching an Occurrence Profile or Common to a Set of Organisms'),
542 : overbeek 1.17 $cgi->end_form
543 : parrello 1.75 );
544 : overbeek 1.14
545 :     push(@$html,
546 : parrello 1.75 $cgi->hr,
547 :     $cgi->h2('Process Saved Assignments Sets'),
548 :     $cgi->start_form(-action => "assignments.cgi"),
549 :     "Here you should include the <b>master:</b>. Thus use something like <b>master:RossO</b>",$cgi->br,
550 :     $cgi->br,
551 :     "Enter user: ",
552 :     $cgi->textfield(-name => "user", -size => 20),
553 :     $cgi->submit('Process Assignment Sets'),
554 : overbeek 1.17 $cgi->end_form
555 : parrello 1.75 );
556 : efrank 1.1
557 : overbeek 1.19 push(@$html,
558 : parrello 1.75 $cgi->hr,
559 :     $cgi->h2('Align Sequences'),
560 : olson 1.89 $cgi->start_form(-action => $this_script),
561 : parrello 1.75 "Enter user: ",
562 :     $cgi->textfield(-name => "user", -size => 20), $cgi->br,
563 :     $cgi->submit('Align Sequences'),": ",
564 :     $cgi->textfield(-name => "seqids", -size => 100),
565 : overbeek 1.31 $cgi->end_form
566 : parrello 1.75 );
567 : overbeek 1.51
568 :     push(@$html,
569 : parrello 1.75 $cgi->hr,
570 :     $cgi->h2('Locate PEGs in Subsystems'),
571 :     "If you wish to locate PEGs in subsystems, you have two approaches supported. You can
572 : overbeek 1.56 give a FIG id, and you will get a list of all homologs in the designated genome that occur in subsystems.
573 :     Alternatively, you can specify a functional role, and all PEGs in the genome that match that role will be shown.",
574 : olson 1.89 $cgi->start_form(-action => $this_script),
575 : parrello 1.75 "Enter user: ",
576 :     $cgi->textfield(-name => "user", -size => 20), $cgi->br,
577 :     $cgi->br,"Genome: ",$cgi->textfield(-name => "genome", -size => 15),$cgi->br,
578 :     "Search: ",$cgi->textfield(-name => "subsearch", -size => 100),$cgi->br,
579 :     $cgi->submit('Find PEGs'),": ",
580 : overbeek 1.51 $cgi->end_form
581 : parrello 1.75 );
582 : efrank 1.1 }
583 :    
584 : overbeek 1.83 #
585 :     # Show a message of the day if it's present.
586 :     #
587 :     sub show_motd
588 :     {
589 :     my($fig, $cgi, $html) = @_;
590 :    
591 :     my $motd_file = "$FIG_Config::fig_disk/config/motd";
592 :    
593 :     if (open(F, "<$motd_file"))
594 :     {
595 :     push(@$html, "<p>\n");
596 :     while (<F>)
597 :     {
598 :     push(@$html, $_);
599 :     }
600 :     close(F);
601 :     push(@$html, "<hr>\n");
602 :     }
603 :     }
604 : overbeek 1.17
605 :     #==============================================================================
606 :     # Indexed objects (text search)
607 :     #==============================================================================
608 :    
609 : efrank 1.1 sub show_indexed_objects {
610 : golsen 1.22 my($fig, $cgi, $html, $pattern) = @_;
611 :     my($msg, $i);
612 : efrank 1.1
613 :     if ($pattern =~ /^\s*(fig\|\d+\.\d+\.peg\.\d+)\s*$/)
614 :     {
615 : parrello 1.75 my $peg = $1;
616 :     my $user = $cgi->param('user');
617 :     $user = $user ? $user : "";
618 :     $ENV{'REQUEST_METHOD'} = "GET";
619 :     $ENV{"QUERY_STRING"} = "prot=$peg\&user=$user";
620 : olson 1.89 $ENV{"REQUEST_URI"} =~ s/$this_script/protein.cgi/;
621 : parrello 1.78 # TICK is like the back-tick ` operator, but works in Windows.
622 :     my @prot_out = TICK("./protein.cgi");
623 : parrello 1.75 print @prot_out;
624 :     exit;
625 : efrank 1.1 }
626 : overbeek 1.71 $pattern =~ s/([a-zA-Z0-9])\|([a-zA-Z0-9])/$1\\\|$2/ig;
627 : overbeek 1.17 push( @$html, $cgi->br );
628 : olson 1.70 my( $peg_index_data, $role_index_data ) = $fig->search_index($pattern, $cgi->param("substring_match") eq "on");
629 : overbeek 1.17 my $maxpeg = defined( $cgi->param("maxpeg") ) ? $cgi->param("maxpeg") : 100;
630 :     my $maxrole = defined( $cgi->param("maxrole") ) ? $cgi->param("maxrole") : 100;
631 :    
632 : redwards 1.53 # RAE added lines to allow searching within a single organism
633 : golsen 1.59 # if ($cgi->param('korgs'))
634 :     # {
635 :     # $cgi->param('korgs') =~ /\((\d+\.*\d*)\)/;
636 :     # $org=$1; # this should be undef if korgs is not defined
637 :    
638 :     # push (@$html, $cgi->br, "Matches found in ",$cgi->param('korgs'), $cgi->p);
639 :     # my @clean_data; my @clean_index;
640 :     # while (@$peg_index_data)
641 :     # {
642 :     # my ($data, $index)=(shift @$peg_index_data, shift @$role_index_data);
643 :     # next unless (${$data}[0] =~ /^fig\|$org\.peg/);
644 :     # push @clean_data, $data;
645 :     # push @clean_index, $index;
646 :     # }
647 :    
648 :     # @$peg_index_data=@clean_data;
649 :     # @$role_index_data=@clean_index;
650 :     # }
651 :     ## End of added lines
652 : redwards 1.53
653 : redwards 1.63 # RAE version with separate submit buttons and more than one org in korg
654 :     # this is used by organisms.cgi for group specific searches
655 :     if ( $cgi->param('korgs') && $cgi->param('Search Selected Organisms')
656 :     )
657 :     {
658 :     my @temp;
659 :     foreach my $org ($cgi->param('korgs'))
660 :     {
661 :     push @temp, grep { $_->[0] =~ /^fig\|$org/ } @$peg_index_data;
662 :     }
663 :     @$peg_index_data = @temp;
664 :     }
665 :    
666 : golsen 1.59 # GJO version with separate submit buttons
667 : redwards 1.53
668 : golsen 1.59 if ( $cgi->param('korgs') && $cgi->param('korgs') =~ /\((\d+\.*\d*)\)/
669 :     && $cgi->param('Search genome selected below')
670 :     )
671 :     {
672 : parrello 1.75 my $org = $1;
673 :     push @$html, $cgi->br, "Matches found in ",$cgi->param('korgs'), $cgi->p;
674 : mkubal 1.79 @$peg_index_data = grep { $_->[0] =~ /^fig\|$org\.*/ } @$peg_index_data;
675 : redwards 1.53 }
676 :    
677 : golsen 1.59 if ( ( $maxpeg > 0 ) && @$peg_index_data )
678 : overbeek 1.17 {
679 : parrello 1.75 # RAE: Added javascript buttons see below. Only two things are needed.
680 :     # The form must have a name parameter, and the one line of code for the
681 :     # buttons. Everything else is automatic
682 :    
683 :     push( @$html, $cgi->start_form( -method => 'post',
684 :     -target => "window$$",
685 :     -action => 'fid_checked.cgi',
686 :     -name => 'found_pegs'
687 :     ),
688 :     $cgi->hidden(-name => 'user', -value => $user),
689 :     "For Selected (checked) sequences: ",
690 :     $cgi->submit('get sequences'),
691 :     $cgi->submit('view annotations'),
692 :     $cgi->submit('assign/annotate'),
693 :     $cgi->param('SPROUT') ? () : $cgi->submit('view similarities'),
694 :     $cgi->br, $cgi->br
695 :     );
696 : efrank 1.1
697 : redwards 1.63 # RAE Add the check all/uncheck all boxes.
698 :     push (@$html, $cgi->br, &HTML::java_buttons("found_pegs", "checked"), $cgi->br);
699 : parrello 1.75
700 :     my $n = @$peg_index_data;
701 :     if ($n > $maxpeg)
702 :     {
703 :     $msg = "Showing first $maxpeg out of $n protein genes";
704 :     $#{$peg_index_data} = $maxpeg-1;
705 :     }
706 :     else
707 :     {
708 : mkubal 1.79 $msg = "Showing $n FEATURES";
709 : parrello 1.75 }
710 :    
711 : mkubal 1.79 my $col_hdrs = ["Sel","FEATURE","Organism","Aliases","Function","Who"];
712 : parrello 1.75 my $tab = [ map { format_peg_entry( $fig, $cgi, $_ ) } @$peg_index_data ];
713 :     push( @$html, &HTML::make_table($col_hdrs,$tab,$msg),
714 :     $cgi->br,
715 :     "For SELECTed (checked) sequences: ",
716 :     $cgi->submit('get sequences'),
717 :     $cgi->submit('view annotations'),
718 :     $cgi->submit('assign/annotate'),
719 :     $cgi->param('SPROUT') ? () : $cgi->submit('view similarities'),
720 :     $cgi->br,
721 :     $cgi->end_form
722 :     );
723 : efrank 1.1 }
724 : golsen 1.59 elsif ( $maxpeg > 0 )
725 :     {
726 : parrello 1.75 push @$html, $cgi->h3('No matching protein genes');
727 : golsen 1.59 }
728 : overbeek 1.17
729 : golsen 1.59 if ( ( $maxrole > 0 ) && @$role_index_data )
730 : efrank 1.1 {
731 : parrello 1.75 my $n = @$role_index_data;
732 :     if ($n > $maxrole)
733 :     {
734 :     $msg = "Showing first $maxrole out of $n Roles";
735 :     $#{$role_index_data} = $maxrole - 1;
736 :     }
737 :     else
738 :     {
739 :     $msg = "Showing $n Roles";
740 :     }
741 :    
742 :     if ( $maxpeg > 0 ) { push( @$html, $cgi->hr ) }
743 :     my $col_hdrs = ["Role"];
744 :     my $tab = [ map { &format_role_entry($fig,$cgi,$_) } @$role_index_data ];
745 :     push( @$html, &HTML::make_table($col_hdrs,$tab,$msg) );
746 : efrank 1.1 }
747 : golsen 1.59 elsif ( $maxrole > 0 )
748 :     {
749 : parrello 1.75 push @$html, $cgi->h3('No matching roles');
750 : golsen 1.59 }
751 : efrank 1.1 }
752 :    
753 : golsen 1.59
754 : efrank 1.1 sub format_peg_entry {
755 : golsen 1.67 my( $fig, $cgi, $entry ) = @_;
756 : efrank 1.1 my($i,$function,$who);
757 :    
758 :     my($peg,$gs,$aliases,@funcs) = @$entry;
759 : overbeek 1.17
760 : golsen 1.21 $gs =~ s/\s+\d+$//; # Org name comes with taxon_id appended (why?) -- GJO
761 : efrank 1.1
762 :     @funcs = map { $_ =~ s/^function:\s*//; $_ } @funcs;
763 :    
764 :     if ($aliases)
765 :     {
766 : parrello 1.75 $aliases =~ s/^aliases://;
767 : efrank 1.1 }
768 :     else
769 :     {
770 : parrello 1.75 $aliases = "";
771 : efrank 1.1 }
772 :    
773 : golsen 1.21 my $user = $cgi->param('user');
774 :     $user = $user ? $user : "";
775 :    
776 : efrank 1.1 if ($user)
777 :     {
778 : parrello 1.75 for ($i=0; ($i < @funcs) && ($funcs[$i] !~ /\#$user/); $i++) {}
779 :     if ($i < @funcs)
780 :     {
781 :     ($function,$who) = split(/\#/,$funcs[$i]);
782 :     }
783 : efrank 1.1 }
784 : golsen 1.21
785 : efrank 1.1 if (! $function)
786 :     {
787 : parrello 1.75 for ($i=0; ($i < @funcs) && ($funcs[$i] !~ /\#master/); $i++) {}
788 :     if ($i < @funcs)
789 :     {
790 :     ($function,$who) = split(/\#/,$funcs[$i]);
791 :     }
792 : efrank 1.1 }
793 :    
794 :     if ((! $function) && (@funcs > 0))
795 :     {
796 : parrello 1.75 ($function,$who) = split(/\#/,$funcs[0]);
797 : efrank 1.1 }
798 : golsen 1.67 my $box = "<input type=checkbox name=checked value=\"$peg\">";
799 : overbeek 1.17 return [ $box, &HTML::fid_link($cgi,$peg), $gs, $aliases, $function, $who ];
800 : efrank 1.1 }
801 :    
802 :     sub format_role_entry {
803 :     my($fig,$cgi,$entry) = @_;
804 :    
805 :     return [&HTML::role_link($cgi,$entry)];
806 :     }
807 :    
808 :     sub run_prot_scan_for_matches {
809 :     my($fig,$cgi,$html,$org,$pat) = @_;
810 :     my($string,$peg,$beg,$end,$user,$col_hdrs,$tab,$i);
811 :    
812 :     my $tmp_pat = "$FIG_Config::temp/tmp$$.pat";
813 :     open(PAT,">$tmp_pat")
814 : parrello 1.75 || die "could not open $tmp_pat";
815 : efrank 1.1 $pat =~ s/[\s\012\015]+/ /g;
816 :     print PAT "$pat\n";
817 :     close(PAT);
818 :     my @out = `$FIG_Config::ext_bin/scan_for_matches -p $tmp_pat < $FIG_Config::organisms/$org/Features/peg/fasta`;
819 :     if (@out < 1)
820 :     {
821 : parrello 1.75 push(@$html,$cgi->h1("Sorry, no hits"));
822 : efrank 1.1 }
823 :     else
824 :     {
825 : parrello 1.75 if (@out > 2000)
826 :     {
827 :     push(@$html,$cgi->h1("truncating to the first 1000 hits"));
828 :     $#out = 1999;
829 :     }
830 :    
831 :     push(@$html,$cgi->pre);
832 :     $user = $cgi->param('user');
833 :     $col_hdrs = ["peg","begin","end","string","function of peg"];
834 :     for ($i=0; ($i < @out); $i += 2)
835 :     {
836 :     if ($out[$i] =~ /^>([^:]+):\[(\d+),(\d+)\]/)
837 :     {
838 :     $peg = $1;
839 :     $beg = $2;
840 :     $end = $3;
841 :     $string = $out[$i+1];
842 :     chomp $string;
843 :     push( @$tab, [ &HTML::fid_link($cgi,$peg,1),
844 :     $beg,
845 :     $end,
846 :     $string,
847 :     scalar $fig->function_of( $peg, $user )
848 :     ]
849 :     );
850 :     }
851 :     }
852 :     push(@$html,&HTML::make_table($col_hdrs,$tab,"Matches"));
853 :     push(@$html,$cgi->end_pre);
854 : efrank 1.1 }
855 :     unlink($tmp_pat);
856 :     }
857 :    
858 : overbeek 1.17 #==============================================================================
859 :     # Scan for matches
860 :     #==============================================================================
861 :    
862 : efrank 1.1 sub run_dna_scan_for_matches {
863 :     my($fig,$cgi,$html,$org,$pat) = @_;
864 :     my($string,$contig,$beg,$end,$col_hdrs,$tab,$i);
865 :    
866 :     my $tmp_pat = "$FIG_Config::temp/tmp$$.pat";
867 :     open(PAT,">$tmp_pat")
868 : parrello 1.75 || die "could not open $tmp_pat";
869 : efrank 1.1 $pat =~ s/[\s\012\015]+/ /g;
870 :     print PAT "$pat\n";
871 :     close(PAT);
872 :     my @out = `cat $FIG_Config::organisms/$org/contigs | $FIG_Config::ext_bin/scan_for_matches -c $tmp_pat`;
873 :     if (@out < 1)
874 :     {
875 : parrello 1.75 push(@$html,$cgi->h1("Sorry, no hits"));
876 : efrank 1.1 }
877 :     else
878 :     {
879 : parrello 1.75 if (@out > 2000)
880 :     {
881 :     push(@$html,$cgi->h1("truncating to the first 1000 hits"));
882 :     $#out = 1999;
883 :     }
884 :    
885 :     push(@$html,$cgi->pre);
886 :     $col_hdrs = ["contig","begin","end","string"];
887 :     for ($i=0; ($i < @out); $i += 2)
888 :     {
889 :     if ($out[$i] =~ /^>([^:]+):\[(\d+),(\d+)\]/)
890 :     {
891 :     $contig = $1;
892 :     $beg = $2;
893 :     $end = $3;
894 :     $string = $out[$i+1];
895 :     chomp $string;
896 :     push(@$tab,[$contig,$beg,$end,$string]);
897 :     }
898 :     }
899 :     push(@$html,&HTML::make_table($col_hdrs,$tab,"Matches"));
900 :     push(@$html,$cgi->end_pre);
901 : efrank 1.1 }
902 :     unlink($tmp_pat);
903 :     }
904 :    
905 : overbeek 1.17 #==============================================================================
906 :     # BLAST search
907 :     #==============================================================================
908 :    
909 : efrank 1.1 sub run_blast {
910 : golsen 1.45 my( $fig, $cgi, $html, $org, $tool, $seq ) = @_;
911 :     my( $query, @out );
912 : efrank 1.1
913 : golsen 1.45 my $tmp_seq = "$FIG_Config::temp/run_blast_tmp$$.seq";
914 : efrank 1.1
915 : overbeek 1.17 #--------------------------------------------------------------------------
916 :     # Is the request for an id? Get the sequence
917 :     #--------------------------------------------------------------------------
918 : efrank 1.1 if ($seq =~ /^\s*([a-zA-Z]{2,4}\|\S+)/)
919 :     {
920 : parrello 1.75 # Replaced $id with $query so that output inherits label -- GJO
921 :     $query = $1;
922 :     $seq = "";
923 :     if (($tool eq "blastp") || ($tool eq "tblastn"))
924 :     {
925 :     $seq = $fig->get_translation($query);
926 :     }
927 :     elsif ($query =~ /^fig/)
928 :     {
929 :     my @locs;
930 :     if ((@locs = $fig->feature_location($query)) && (@locs > 0))
931 :     {
932 :     $seq = $fig->dna_seq($fig->genome_of($query),@locs);
933 :     }
934 :     }
935 :     if (! $seq)
936 :     {
937 :     push(@$html,$cgi->h1("Sorry, could not get sequence for $query"));
938 :     return;
939 :     }
940 : efrank 1.1 }
941 : golsen 1.45
942 : overbeek 1.17 #--------------------------------------------------------------------------
943 :     # Is it a fasta format? Get the query name
944 :     #--------------------------------------------------------------------------
945 : golsen 1.45
946 :     elsif ( $seq =~ s/^>\s*(\S+[^\n\012\015]*)// ) # more flexible match -- GJO
947 : efrank 1.1 {
948 : parrello 1.75 $query = $1;
949 : efrank 1.1 }
950 : golsen 1.45
951 : overbeek 1.17 #--------------------------------------------------------------------------
952 :     # Take it as plain text
953 :     #--------------------------------------------------------------------------
954 : golsen 1.45
955 : efrank 1.1 else
956 :     {
957 : parrello 1.75 $query = "query";
958 : efrank 1.1 }
959 : golsen 1.45
960 :     #
961 :     # The rest is taken as the sequence
962 :     #
963 :    
964 : golsen 1.23 $seq =~ s/\s+//g;
965 : golsen 1.45 open( SEQ, ">$tmp_seq" ) || die "run_blast could not open $tmp_seq";
966 : efrank 1.1 print SEQ ">$query\n$seq\n";
967 : golsen 1.45 close( SEQ );
968 : efrank 1.1
969 :     if (! $ENV{"BLASTMAT"}) { $ENV{"BLASTMAT"} = "$FIG_Config::blastmat" }
970 : golsen 1.88 my $blast_opt = $cgi->param( 'blast_options' ) || '';
971 : efrank 1.1
972 : golsen 1.45 if ( $tool eq "blastp" )
973 : efrank 1.1 {
974 : parrello 1.75 my $db = "$FIG_Config::organisms/$org/Features/peg/fasta";
975 :     &verify_db( $db, "p" );
976 : golsen 1.88 @out = map { &HTML::set_prot_links($cgi,$_) } execute_blastall( 'blastp', $tmp_seq, $db, $blast_opt );
977 : efrank 1.1 }
978 : golsen 1.45
979 :     elsif ( $tool eq "blastx" )
980 : efrank 1.1 {
981 : parrello 1.75 my $db = "$FIG_Config::organisms/$org/Features/peg/fasta";
982 :     &verify_db( $db, "p" );
983 : golsen 1.88 @out = map { &HTML::set_prot_links($cgi,$_) } execute_blastall( 'blastx', $tmp_seq, $db, $blast_opt );
984 : efrank 1.1 }
985 : golsen 1.45
986 :     elsif ( $tool eq "blastn" )
987 : efrank 1.1 {
988 : parrello 1.75 my $db = "$FIG_Config::organisms/$org/contigs";
989 :     &verify_db( $db, "n" ); ### fix to get all contigs
990 : golsen 1.88 @out = execute_blastall( 'blastn', $tmp_seq, $db, "-r 1 -q -1 " . $blast_opt );
991 : parrello 1.75 push @$html, blast_graphics( $fig, $cgi, $org, \@out, $tool );
992 : efrank 1.1 }
993 : golsen 1.45
994 :     elsif ( $tool eq "tblastn" )
995 : efrank 1.1 {
996 : parrello 1.75 my $db = "$FIG_Config::organisms/$org/contigs";
997 :     &verify_db( $db, "n" ); ### fix to get all contigs
998 : golsen 1.88 @out = execute_blastall( 'tblastn', $tmp_seq, $db, $blast_opt );
999 : parrello 1.75 push @$html, blast_graphics( $fig, $cgi, $org, \@out, $tool );
1000 : efrank 1.1 }
1001 : golsen 1.45
1002 :     elsif ( $tool eq 'blastp against complete genomes' ) ### this tool gets nonstandard treatment: RAO
1003 : overbeek 1.30 {
1004 : golsen 1.88 my $blastall = "$FIG_Config::ext_bin/blastall";
1005 :     &blast_complete( $fig, $cgi, $html, $tmp_seq, $blastall);
1006 : parrello 1.75 unlink($tmp_seq);
1007 :     return;
1008 : overbeek 1.30 }
1009 : golsen 1.45
1010 : overbeek 1.17 if (@out < 1) # This is really a bigger problem than no hits (GJO)
1011 : efrank 1.1 {
1012 : golsen 1.88 push @$html, $cgi->h1( "Sorry, no blast output" );
1013 : efrank 1.1 }
1014 :     else
1015 :     {
1016 : golsen 1.88 push @$html, $cgi->pre, @out, $cgi->end_pre;
1017 : efrank 1.1 }
1018 : golsen 1.45 unlink( $tmp_seq );
1019 : efrank 1.1 }
1020 :    
1021 : golsen 1.45
1022 : golsen 1.88 # `$blastall -p $prog -i $tmp_seq -d $db $blast_opt`
1023 :     # execute_blastall( $prog, $input_file, $db, $options )
1024 :    
1025 :     sub execute_blastall
1026 :     {
1027 :     my( $prog, $input, $db, $options ) = @_;
1028 :    
1029 :     my $blastall = "$FIG_Config::ext_bin/blastall";
1030 :     my @args = ( '-p', $prog, '-i', $input, '-d', $db, split(/\s+/, $options) );
1031 :    
1032 :     my $bfh;
1033 :     my $pid = open( $bfh, "-|" );
1034 :     if ( $pid == 0 )
1035 :     {
1036 :     exec( $blastall, @args );
1037 :     die join( " ", $blastall, @args, "failed: $!" );
1038 :     }
1039 :    
1040 :     my @out = <$bfh>;
1041 :     @out;
1042 :     }
1043 :    
1044 :    
1045 : overbeek 1.30 sub blast_complete {
1046 : golsen 1.88 my( $fig, $cgi, $html, $seq_file, $blastall ) = @_;
1047 :     my( $genome, @sims );
1048 :    
1049 : overbeek 1.30 @sims = ();
1050 :     foreach $genome ($fig->genomes("complete"))
1051 :     {
1052 : parrello 1.75 my $db = "$FIG_Config::organisms/$genome/Features/peg/fasta";
1053 :     next if (! -s $db);
1054 : overbeek 1.30
1055 : parrello 1.75 &verify_db($db,"p");
1056 :     my $sim;
1057 :     push(@sims,map { chop;
1058 :     $sim = [split(/\t/,$_)];
1059 :     $sim->[10] = ($sim->[10] =~ /^e-/) ? "1.0" . $sim->[10] : $sim->[10];
1060 :     $sim }
1061 :     `$blastall -i $seq_file -d $db -m 8 -FF -e 1.0e-5 -p blastp`);
1062 : overbeek 1.30 }
1063 :     @sims = sort { $a->[10] <=> $b->[10] } @sims;
1064 : golsen 1.88 &format_sims( $fig, $cgi, $html, \@sims );
1065 : overbeek 1.30 }
1066 :    
1067 : golsen 1.65
1068 :     #------------------------------------------------------------------------------
1069 :     # Graphically display searches against contigs
1070 :     #
1071 :     # use FIGjs qw( toolTipScript );
1072 :     # use GenoGraphics qw( render );
1073 :     # use IPC::Open2 qw( open2 );
1074 :     #------------------------------------------------------------------------------
1075 :     # Fields produced by rationalize_blast:
1076 :     #
1077 :     # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1078 :     # HSP score exp p_n p_val n_match n_ident n_sim n_gap dir q1 q2 q_sq s1 s2 s_sq
1079 :     #------------------------------------------------------------------------------
1080 :    
1081 :     sub blast_graphics {
1082 :     my ( $fig_or_sprout, $cgi, $genome, $out, $tool ) = @_;
1083 :    
1084 :     my $e_min = 0.1;
1085 :     my $gg = [];
1086 :     my @html = ();;
1087 :    
1088 :     # Run rationalize_blast:
1089 :    
1090 :     my( $pid, $rd, $wr );
1091 :     if ( $pid = open2( $rd, $wr, "rationalize_blast" ) )
1092 :     {
1093 : parrello 1.75 my $outlen = 0;
1094 :     foreach ( @$out ) { $outlen += length( $_ ) }
1095 : golsen 1.65
1096 : parrello 1.75 $wr->write( join( "", @$out ), $outlen );
1097 :     close( $wr );
1098 : golsen 1.65
1099 :     my ( $qid, $qdef, $qlen, $contig, $sdef, $slen );
1100 :     my @rational = <$rd>;
1101 :     foreach ( map { chomp; $_ } @rational )
1102 :     {
1103 :     if ( /^Query=/ ) { ( undef, $qid, undef, $qlen ) = split /\t/ }
1104 :     elsif ( /^>/ ) { ( undef, $contig, undef, $slen ) = split /\t/ }
1105 :     elsif ( /^HSP/ && $qid && $qlen && $contig && $slen )
1106 :     {
1107 :     my @hsp = split /\t/;
1108 :     next if $hsp[2] > $e_min;
1109 :     my ( $e_val, $q1, $q2, $s1, $s2 ) = @hsp[ 2, 10, 11, 13, 14 ];
1110 :     my ( $genes, $min, $max ) = hsp_context( $fig_or_sprout, $cgi, $genome,
1111 :     $e_val, 100 * $hsp[6] / $hsp[5],
1112 :     $qid, $q1, $q2, $qlen,
1113 :     $contig, $s1, $s2, $slen
1114 :     );
1115 : overbeek 1.74 if ($min && $max)
1116 :     {
1117 :     push @$gg, [ substr( $contig, 0, 18 ), $min, $max, $genes ];
1118 :     }
1119 : golsen 1.65 }
1120 :     }
1121 :     close( $rd );
1122 :    
1123 :     # $gene = [ $beg, $end, $shape, $color, $text, $url, $pop-up, $alt_action, $pop-up_title ];
1124 :     # $genes = [ $gene, $gene, ... ];
1125 :     # $map = [ $label, $min_coord, $max_coord, $genes ];
1126 :     # $gg = [ $map, $map, ... ];
1127 :     # render( $gg, $width, $obj_half_heigth, $save, $img_index_number )
1128 :    
1129 : overbeek 1.86 if ( @$gg )
1130 :     {
1131 :     # print STDERR Dumper( $gg );
1132 :     my $gs = $fig_or_sprout->genus_species( $genome );
1133 :     my $space = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
1134 :     my $legend = "<TABLE>\n"
1135 :     . " <TR>\n"
1136 :     . " <TD>Q = Query sequence$space</TD>\n"
1137 :     . " <TD Bgcolor='#FF0000'>$space</TD><TD>Frame 1 translation$space</TD>\n"
1138 :     . " <TD Bgcolor='#00FF00'>$space</TD><TD>Frame 2 translation$space</TD>\n"
1139 :     . " <TD Bgcolor='#0000FF'>$space</TD><TD>Frame 3 translation$space</TD>\n"
1140 :     . " <TD Bgcolor='#808080'>$space</TD><TD>Untranslated sequence</TD>\n"
1141 :     . " </TR>\n"
1142 :     . "</TABLE><P />";
1143 :    
1144 :     push @html, "\n", FIGjs::toolTipScript(), "\n",
1145 :     $cgi->h2( "Results of $tool search of contigs from $gs\n"),
1146 :     $legend,
1147 :     @{ GenoGraphics::render( $gg, 600, 4, 0, 1 ) },
1148 :     $cgi->hr, "\n";
1149 :     }
1150 :    
1151 : parrello 1.75 waitpid $pid, 0;
1152 : golsen 1.65 }
1153 :    
1154 :     return @html;
1155 :     }
1156 :    
1157 :    
1158 :     sub hsp_context {
1159 :     my( $fig_or_sprout, $cgi, $genome, $e_val, $pct_id,
1160 :     $qid, $q1, $q2, $qlen,
1161 : parrello 1.75 $contig, $s1, $s2, $slen ) = @_;
1162 : golsen 1.65 my $half_sz = 5000;
1163 :    
1164 :     my( $from, $to, $features, $fid, $beg, $end );
1165 :     my( $link, $lbl, $isprot, $function, $uniprot, $info, $prot_query );
1166 :    
1167 :     my $user = $cgi->param( 'user' ) || "";
1168 :     my $sprout = $cgi->param( 'SPROUT' ) ? '&SPROUT=1' : '';
1169 :    
1170 :     my @genes = ();
1171 :    
1172 :     # Based on the match position of the query, select the context region:
1173 :    
1174 :     ( $from, $to ) = ( $s1 <= $s2 ) ? ( $s1 - $half_sz, $s2 + $half_sz )
1175 :     : ( $s2 - $half_sz, $s1 + $half_sz );
1176 :     $from = 1 if ( $from < 1 );
1177 :     $to = $slen if ( $to > $slen );
1178 :    
1179 :     # Get the genes in the region, and adjust the ends to include whole genes:
1180 :    
1181 :     ( $features, $from, $to ) = genes_in_region( $fig_or_sprout, $cgi, $genome, $contig, $from, $to );
1182 :    
1183 :    
1184 :     # Add the other features:
1185 :    
1186 :     foreach $fid ( @$features )
1187 :     {
1188 : parrello 1.75 my $contig1;
1189 :     ( $contig1, $beg, $end ) = boundaries_of( $fig_or_sprout, feature_locationS( $fig_or_sprout, $fid ) );
1190 :     next if $contig1 ne $contig;
1191 :    
1192 :     $link = "";
1193 :     if ( ( $lbl ) = $fid =~ /peg\.(\d+)$/ ) {
1194 : overbeek 1.82 ( $link = $cgi->url(-relative => 1) ) =~ s/index\.cgi/protein.cgi/;
1195 : parrello 1.75 $link .= "?prot=$fid&user=$user$sprout";
1196 :     $isprot = 1;
1197 :     } elsif ( ( $lbl ) = $fid =~ /\.([a-z]+)\.\d+$/ ) {
1198 :     $lbl = uc $lbl;
1199 :     $isprot = 0;
1200 :     } else {
1201 :     $lbl = "";
1202 :     $isprot = 0;
1203 :     }
1204 :    
1205 :     $function = function_ofS( $fig_or_sprout, $fid );
1206 :    
1207 :     $uniprot = join ", ", grep { /^uni\|/ } feature_aliasesL( $fig_or_sprout, $fid);
1208 :    
1209 :     $info = join( '<br />', "<b>Feature:</b> $fid",
1210 :     "<b>Contig:</b> $contig",
1211 :     "<b>Begin:</b> $beg",
1212 :     "<b>End:</b> $end",
1213 :     $function ? "<b>Function:</b> $function" : '',
1214 :     $uniprot ? "<b>Uniprot ID:</b> $uniprot" : ''
1215 :     );
1216 :    
1217 :     push @genes, [ feature_graphic( $beg, $end, $isprot ),
1218 :     $lbl, $link, $info,
1219 :     $isprot ? () : ( undef, "Feature information" )
1220 :     ];
1221 : golsen 1.65 }
1222 :    
1223 :     # Draw the query. The subject coordinates are always DNA. If the query
1224 :     # is protein, it is about 3 times shorter than the matching contig DNA.
1225 :     # Splitting the difference, if 1.7 times the query length is still less
1226 :     # than the subject length, we will call it a protein query (and reading
1227 :     # frame in the contig coordinates has meaning). If it is nucleotides,
1228 :     # there is no defined frame.
1229 :    
1230 :     $info = join( '<br />', $qid ne 'query ' ? "<b>Query:</b> $qid" : (),
1231 :     "<b>Length:</b> $qlen",
1232 :     "<b>E-value:</b> $e_val",
1233 :     "<b>% identity:</b> " . sprintf( "%.1f", $pct_id ),
1234 :     "<b>Region of similarity:</b> $q1 &#150; $q2"
1235 :     );
1236 :     $prot_query = ( 1.7 * abs( $q2 - $q1 ) < abs( $s2 - $s1 ) ) ? 1 : 0;
1237 :    
1238 :     push @genes, [ feature_graphic( $s1, $s2, $prot_query ),
1239 :     'Q', undef, $info, undef, 'Query and match information'
1240 :     ];
1241 :    
1242 :     return \@genes, $from, $to;
1243 :     }
1244 :    
1245 :    
1246 :     sub feature_graphic {
1247 :     my ( $beg, $end, $isprot ) = @_;
1248 :     my ( $min, $max, $symb, $color );
1249 :    
1250 :     ( $min, $max, $symb ) = ( $beg <= $end ) ? ( $beg, $end, "rightArrow" )
1251 :     : ( $end, $beg, "leftArrow" );
1252 :    
1253 :     # Color proteins by translation frame
1254 :    
1255 :     $color = $isprot ? qw( blue red green )[ $beg % 3 ] : 'grey';
1256 :    
1257 :     ( $min, $max, $symb, $color );
1258 :     }
1259 :    
1260 :    
1261 :     sub genes_in_region {
1262 :     my( $fig_or_sprout, $cgi, $genome, $contig, $min, $max ) = @_;
1263 :    
1264 :     if ( $cgi->param( 'SPROUT' ) )
1265 :     {
1266 : parrello 1.75 my( $x, $feature_id );
1267 :     my( $feat, $min, $max ) = $fig_or_sprout->genes_in_region( $genome, $contig, $min, $max );
1268 :     my @tmp = sort { ($a->[1] cmp $b->[1]) or
1269 :     (($a->[2]+$a->[3]) <=> ($b->[2]+$b->[3]))
1270 :     }
1271 :     map { $feature_id = $_;
1272 :     $x = feature_locationS( $fig_or_sprout, $feature_id );
1273 :     $x ? [ $feature_id, boundaries_of( $fig_or_sprout, $x )] : ()
1274 :     }
1275 :     @$feat;
1276 :     return ( [map { $_->[0] } @tmp ], $min, $max );
1277 : golsen 1.65 }
1278 :     else
1279 :     {
1280 : parrello 1.75 return $fig_or_sprout->genes_in_region( $genome, $contig, $min, $max );
1281 : golsen 1.65 }
1282 :     }
1283 :    
1284 :    
1285 :     sub feature_locationS {
1286 :     my ( $fig_or_sprout, $peg ) = @_;
1287 :     scalar $fig_or_sprout->feature_location( $peg );
1288 :     }
1289 :    
1290 :    
1291 :     sub boundaries_of {
1292 :     my( $fig_or_sprout, $loc ) = @_;
1293 :     $fig_or_sprout->boundaries_of( $loc );
1294 :     }
1295 :    
1296 :    
1297 :     sub function_ofS {
1298 :     my( $fig_or_sprout, $peg, $user ) = @_;
1299 :     scalar $fig_or_sprout->function_of( $peg, $user );
1300 :     }
1301 :    
1302 :    
1303 :     sub feature_aliasesL {
1304 :     my( $fig_or_sprout, $fid ) = @_;
1305 :     my @tmp = $fig_or_sprout->feature_aliases( $fid );
1306 :     @tmp
1307 :     }
1308 :    
1309 :    
1310 : overbeek 1.30 sub format_sims {
1311 :     my($fig,$cgi,$html,$sims) = @_;
1312 :     my($col_hdrs,$table,@ids,$ids,$sim,%seen);
1313 :    
1314 :     $col_hdrs = [ "Select up to here",
1315 : parrello 1.75 "Similar sequence",
1316 :     "E-val",
1317 :     "Function",
1318 :     "Organism",
1319 :     "Aliases"
1320 :     ];
1321 : overbeek 1.30
1322 :     $table = [];
1323 :     @ids = ();
1324 :     if (@$sims > 1000) { $#{$sims} = 999 }
1325 :     foreach $sim (@$sims)
1326 :     {
1327 : parrello 1.75 if (! $seen{$sim->[1]})
1328 :     {
1329 :     push(@$table,[$cgi->checkbox(-name => 'list_to', -value => $sim->[1], -override => 1, -checked => 0, -label => ""),
1330 :     &HTML::fid_link($cgi,$sim->[1]),
1331 :     $sim->[10],
1332 :     scalar $fig->function_of($sim->[1]),
1333 : overbeek 1.30 $fig->genus_species(&FIG::genome_of($sim->[1])),
1334 : parrello 1.75 scalar $fig->feature_aliases($sim->[1])
1335 :     ]);
1336 :     push(@ids,$sim->[1]);
1337 :     }
1338 : overbeek 1.30 }
1339 :     $ids = join(",",@ids);
1340 :     my $target = "window$$";
1341 :     push(@$html, $cgi->start_form( -method => 'post',
1342 : parrello 1.75 -target => $target,
1343 : olson 1.89 -action => $this_script
1344 : parrello 1.75 ),
1345 :     $cgi->hidden(-name => 'ids', -value => $ids),
1346 :     &HTML::make_table($col_hdrs,$table,"Best Hits"),
1347 :     $cgi->submit('Extract Matched Sequences'),
1348 :     $cgi->end_form);
1349 : overbeek 1.30 }
1350 : overbeek 1.17
1351 : efrank 1.1 sub verify_db {
1352 :     my($db,$type) = @_;
1353 :    
1354 : overbeek 1.17 if ($type =~ /^p/i)
1355 : efrank 1.1 {
1356 : parrello 1.75 if ((! -s "$db.psq") || (-M "$db.psq" > -M $db))
1357 :     {
1358 :     system "$FIG_Config::ext_bin/formatdb -p T -i $db";
1359 :     }
1360 : efrank 1.1 }
1361 :     else
1362 :     {
1363 : parrello 1.75 if ((! -s "$db.nsq") || (-M "$db.nsq" > -M $db))
1364 :     {
1365 :     system "$FIG_Config::ext_bin/formatdb -p F -i $db";
1366 :     }
1367 : efrank 1.1 }
1368 : parrello 1.75 }
1369 : overbeek 1.7
1370 :     sub export_assignments {
1371 :     my($fig,$cgi,$html,$who) = @_;
1372 :     my($genome,$x);
1373 :    
1374 :     my @genomes = map { $_ =~ /\((\d+\.\d+)\)/; $1 } $cgi->param('korgs');
1375 :    
1376 :     if (@genomes == 0)
1377 :     {
1378 : parrello 1.75 @genomes = $fig->genomes;
1379 : overbeek 1.7 }
1380 :    
1381 : overbeek 1.10 my @assignments = $fig->assignments_made(\@genomes,$who,$cgi->param('after_date'));
1382 : overbeek 1.7 if (@assignments == 0)
1383 :     {
1384 : parrello 1.75 push(@$html,$cgi->h1("Sorry, no assignments where made by $who"));
1385 : overbeek 1.7 }
1386 :     else
1387 :     {
1388 : parrello 1.75 my $col_hdrs = ["FIG id", "External ID", "Genus/Species","Assignment"];
1389 :     my $tab = [];
1390 :     my($x,$peg,$func);
1391 :     foreach $x (@assignments)
1392 :     {
1393 :     ( $peg, $func ) = @$x;
1394 :     push( @$tab,[ HTML::set_prot_links( $cgi, $peg ),
1395 :     HTML::set_prot_links( $cgi, ext_id( $fig, $peg ) ),
1396 :     $fig->genus_species($fig->genome_of($peg)),
1397 :     $func
1398 :     ] );
1399 :     }
1400 :    
1401 :     if ($cgi->param('save_assignments'))
1402 :     {
1403 :     my $user = $cgi->param('save_user');
1404 :     if ($user)
1405 :     {
1406 :     &FIG::verify_dir("$FIG_Config::data/Assignments/$user");
1407 :     my $file = &FIG::epoch_to_readable(time) . ":$who:exported_from_local_SEED";
1408 :     if (open(TMP,">$FIG_Config::data/Assignments/$user/$file"))
1409 :     {
1410 :     print TMP join("",map { join("\t",@$_) . "\n" } map { [$_->[0],$_->[3]] } @$tab);
1411 :     close(TMP);
1412 :     }
1413 :     push(@$html,$cgi->h1("Saved Assignment Set $file"));
1414 :     }
1415 :     else
1416 :     {
1417 :     push(@$html,$cgi->h1("You need to specify a user to save an assignment set"));
1418 :     }
1419 :     }
1420 :    
1421 :     if ($cgi->param('tabs'))
1422 :     {
1423 :     print $cgi->header;
1424 :     print "<pre>\n";
1425 :     print join("",map { join("\t",@$_) . "\n" } @$tab);
1426 :     print "</pre>\n";
1427 :     exit;
1428 :     }
1429 :     else
1430 :     {
1431 :     push(@$html,&HTML::make_table($col_hdrs,$tab,"Assignments Made by $who"));
1432 :     }
1433 : overbeek 1.7 }
1434 :     }
1435 :    
1436 :     sub ext_id {
1437 :     my($fig,$peg) = @_;
1438 :    
1439 :     my @mapped = grep { $_ !~ /^fig/ } map { $_->[0] } $fig->mapped_prot_ids($peg);
1440 :     if (@mapped == 0)
1441 :     {
1442 : parrello 1.75 return $peg;
1443 : overbeek 1.7 }
1444 :    
1445 :     my @tmp = ();
1446 :     if ((@tmp = grep { $_ =~ /^sp/ } @mapped) && (@tmp > 0)) { return $tmp[0] }
1447 :     if ((@tmp = grep { $_ =~ /^pir/ } @mapped) && (@tmp > 0)) { return $tmp[0] }
1448 :     if ((@tmp = grep { $_ =~ /^gi/ } @mapped) && (@tmp > 0)) { return $tmp[0] }
1449 :     if ((@tmp = grep { $_ =~ /^tr/ } @mapped) && (@tmp > 0)) { return $tmp[0] }
1450 :     if ((@tmp = grep { $_ =~ /^tn/ } @mapped) && (@tmp > 0)) { return $tmp[0] }
1451 :     if ((@tmp = grep { $_ =~ /^kegg/ } @mapped) && (@tmp > 0)) { return $tmp[0] }
1452 :    
1453 :     return $peg;
1454 :     }
1455 :    
1456 : overbeek 1.28 sub translate_assignments {
1457 :     my($fig,$cgi,$html,$from_func,$to_func) = @_;
1458 :    
1459 : overbeek 1.56 my @funcs = grep { $_ =~ /^\S.*\S$/ } split(/[\012\015]+/,$from_func);
1460 :    
1461 : overbeek 1.28 my $user = $cgi->param('save_user');
1462 :     if ($user)
1463 :     {
1464 :     &FIG::verify_dir("$FIG_Config::data/Assignments/$user");
1465 :     my $file = &FIG::epoch_to_readable(time) . ":$user:translation";
1466 :     if (open(TMP,">$FIG_Config::data/Assignments/$user/$file"))
1467 :     {
1468 : overbeek 1.55 my($peg,$func);
1469 : overbeek 1.28
1470 : overbeek 1.56 foreach $from_func (@funcs)
1471 : overbeek 1.28 {
1472 : overbeek 1.57 my $from_funcQ = quotemeta $from_func;
1473 :    
1474 : overbeek 1.56 foreach $peg ($fig->seqs_with_role($from_func))
1475 : overbeek 1.28 {
1476 : overbeek 1.56 if ($peg =~ /^fig\|/)
1477 : overbeek 1.28 {
1478 : overbeek 1.56 $func = $fig->function_of($peg);
1479 :     if ($func eq $from_func)
1480 :     {
1481 :     print TMP "$peg\t$to_func\n";
1482 :     }
1483 : overbeek 1.73 else
1484 : overbeek 1.57 {
1485 : overbeek 1.73 my @pieces = grep { $_ } split(/(\s+[\/@]\s+)|(\s*;\s+)/,$func);
1486 :     if (@pieces > 1)
1487 :     {
1488 :     my $func1 = join("",map { $_ =~ s/^$from_funcQ$/$to_func/; $_ } @pieces);
1489 :     if ($func ne $func1)
1490 :     {
1491 :     print TMP "$peg\t$func1\n";
1492 :     }
1493 :     }
1494 : overbeek 1.57 }
1495 : overbeek 1.28 }
1496 :     }
1497 :     }
1498 :     close(TMP);
1499 :     }
1500 :     push(@$html,$cgi->h1("Saved Assignment Set $file"));
1501 :     }
1502 :     else
1503 :     {
1504 : parrello 1.75 push(@$html,$cgi->h1("You need to specify a user to save an assignment set"));
1505 : overbeek 1.28 }
1506 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3