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

Annotation of /FigWebServices/get_dlits.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (view) (download)

1 : overbeek 1.1 # -*- perl -*-
2 :     #
3 : golsen 1.7 # Copyright (c) 2003-2008 University of Chicago and Fellowship
4 : overbeek 1.1 # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : golsen 1.8 #
20 :     # DBMS tables used:
21 :     #
22 :     # dlit
23 :     # flds => "status char(1), md5_hash varchar(32), pubmed varchar(16), curator varchar(30), go_code varchar(15)"
24 :     #
25 :     # titles
26 :     # flds => "pubmed varchar(16), title varchar(1000)"
27 :     #
28 :     # hash_role
29 :     # flds => "md5_hash char(32), role varchar(1000)"
30 :     #
31 :     # curr_role
32 :     # flds => "curator varchar(30), role varchar(1000)"
33 :     #
34 :     # genome_hash
35 :     # flds => "genome varchar(32), md5_hash char(32)"
36 :     #
37 : overbeek 1.1
38 :     use FIG;
39 :     my $fig = new FIG;
40 :    
41 :     use HTML;
42 :     use strict;
43 :    
44 :     use CGI;
45 :     my $cgi = new CGI;
46 :    
47 :    
48 :     if (0)
49 :     {
50 :     my $VAR1;
51 :     eval(join("",`cat /tmp/get_dlit_parms`));
52 :     $cgi = $VAR1;
53 :     # print STDERR &Dumper($cgi);
54 :     }
55 :    
56 :     if (0)
57 :     {
58 :     print $cgi->header;
59 :     my @params = $cgi->param;
60 :     print "<pre>\n";
61 :     foreach $_ (@params)
62 :     {
63 : golsen 1.7 print "$_\t:",join(",",$cgi->param($_)),":\n";
64 : overbeek 1.1 }
65 :    
66 :     if (0)
67 :     {
68 : golsen 1.7 if (open(TMP,">/tmp/get_dlit_parms"))
69 :     {
70 :     print TMP &Dumper($cgi);
71 :     close(TMP);
72 :     }
73 : overbeek 1.1 }
74 :     exit;
75 :     }
76 :     my($genome);
77 :    
78 :     my $html = [];
79 :     unshift @$html, "<TITLE>Get Dlits</TITLE>\n";
80 :    
81 : golsen 1.7 my $user = $cgi->param('user'); # Current user
82 :     my $curator = $cgi->param('curator') || ''; # Filter roles by subsystem curator
83 :     my $genomeD = $cgi->param('genomeD'); # Find lit by genome
84 : golsen 1.8 my $ref_id = $cgi->param('ref_id'); # Show data by reference
85 : golsen 1.7 my $role = $cgi->param('role'); # Find lit by role
86 :     my $show_just = $cgi->param('show_just'); # Filter lit by status
87 : overbeek 1.1 $show_just = ($show_just eq "all") ? '' : $show_just;
88 :    
89 : golsen 1.7 # Requested actions:
90 :    
91 :     my ( $submit1, $submit2, $submit3, $submit4, $submit5 );
92 :     if ( $cgi->param( 'Process Changes' ) ) { $submit5 = 1 }
93 : golsen 1.8 if ( $ref_id ) {}
94 :     elsif ( $cgi->param( 'Change subsystem curator' ) ) {}
95 : golsen 1.7 elsif ( $cgi->param( 'Show Genomes' ) ) { $submit1 = 1 }
96 :     elsif ( $cgi->param( 'Show Roles' ) ) { $submit2 = 1 }
97 :     elsif ( $cgi->param( 'Show Genome' ) ) { $submit3 = 1 }
98 :     elsif ( $cgi->param( 'Show Role' ) ) { $submit4 = 1 }
99 :    
100 :     my $done = 0;
101 :    
102 : overbeek 1.1 my $rdbH = $fig->db_handle;
103 :    
104 : golsen 1.7 if (! -d "$FIG_Config::data/Dlits")
105 : overbeek 1.1 {
106 : golsen 1.7 push( @$html, $cgi->h1("dlit data are not installed") );
107 :     $done = 1;
108 : overbeek 1.1 }
109 : golsen 1.7 elsif ( ! $user )
110 : overbeek 1.1 {
111 : golsen 1.7 push( @$html, $cgi->h2('To curate literature, please provide a user name') );
112 :     push( @$html, $cgi->start_form(-action => "get_dlits.cgi", -method => 'post'),
113 :     'Username: ',
114 :     $cgi->textfield( -name=>"user", -size => 20 ),
115 :     $cgi->br,
116 :     $cgi->submit( 'Set user' ),
117 :     $cgi->end_form
118 :     );
119 :     $done = 1;
120 : overbeek 1.1 }
121 : golsen 1.7
122 :     # Process a page of curated literature ----------------------------------------
123 :    
124 :     if ( $submit5 && ! $done )
125 :     {
126 :     &process_changes( $fig, $cgi, $html );
127 :     my $prev_req = $cgi->param( 'prev_req' );
128 :     $submit3 = 1 if $prev_req eq 'Show Genome';
129 :     $submit4 = 1 if $prev_req eq 'Show Role';
130 : overbeek 1.1 }
131 : golsen 1.7
132 :     # If there is a problem, skip the rest of the action tests --------------------
133 :     # This is organized this way so that a useful page can be
134 :     # provided after processing a curated page.
135 :    
136 :     if ( $done ) { }
137 :    
138 : golsen 1.8 # All sequences in a reference ------------------------------------------------
139 :    
140 :     elsif ( $ref_id )
141 :     {
142 :     my $and_status = $show_just ? " AND ( dlits.status = '$show_just' )" : '';
143 :     my $tuples = $rdbH->SQL( "SELECT DISTINCT status,md5_hash
144 :     FROM dlits
145 :     WHERE ( pubmed = '$ref_id' )"
146 :     . $and_status
147 :     );
148 :     my @to_display = ();
149 :     foreach my $x ( @$tuples )
150 :     {
151 :     my( $status, $hash ) = @$x;
152 :     my @pegs = $fig->pegs_with_md5( $hash );
153 :     if ( @pegs > 0 )
154 :     {
155 :     push( @to_display, [ $status, $pegs[0], $ref_id ] );
156 :     }
157 :     }
158 :    
159 :     &display_set( $fig, $cgi, $html, \@to_display, "Genes linked to Reference: $ref_id", 'Show Reference' ) ;
160 :     }
161 :    
162 : golsen 1.7 # Literature selected by role -------------------------------------------------
163 :    
164 :     elsif ( $submit4 && $role )
165 : overbeek 1.1 {
166 : golsen 1.7 my $roleQ = quotemeta $role;
167 : golsen 1.8 my $and_status = $show_just ? " AND ( dlits.status = '$show_just' )" : '';
168 : golsen 1.7 my $tuples = $rdbH->SQL( "SELECT DISTINCT dlits.status,dlits.md5_hash,dlits.pubmed
169 : golsen 1.8 FROM hash_role,dlits
170 :     WHERE hash_role.role = '$roleQ' AND hash_role.md5_hash = dlits.md5_hash"
171 :     . $and_status
172 : golsen 1.7 );
173 : overbeek 1.1 my @to_display = ();
174 : golsen 1.8 foreach my $x ( @$tuples )
175 : overbeek 1.1 {
176 : golsen 1.8 my( $status, $hash, $pubmed ) = @$x;
177 :     my @pegs = $fig->pegs_with_md5( $hash );
178 :     if ( @pegs > 0 )
179 : golsen 1.7 {
180 : golsen 1.8 push( @to_display, [ $status, $pegs[0], $pubmed ] );
181 : golsen 1.7 }
182 : overbeek 1.1 }
183 : golsen 1.8
184 :     &display_set( $fig, $cgi, $html, \@to_display, "Genes for Role: $role", 'Show Role' );
185 : golsen 1.7 }
186 :    
187 :     # Show the role list ----------------------------------------------------------
188 :    
189 :     elsif ( $submit2 || $submit4 )
190 :     {
191 :     # Did user request role literature, and not select a role?
192 :     push @$html, $cgi->h3( '<FONT Color=red>Please select a role.</FONT>' ) if $submit4;
193 :    
194 :     my $where1 = $show_just ? " AND (dlits.status = '$show_just')" : "";
195 :     my $where2 = $curator ? " AND (curr_role.curator = '$curator' AND curr_role.role = hash_role.role)" : "";
196 :    
197 :     my @roles = sort { lc $a cmp lc $b } # Make sort case insensitive
198 :     map { $_->[0] }
199 :     @{ $rdbH->SQL( "SELECT DISTINCT hash_role.role
200 :     FROM hash_role,dlits,curr_role
201 :     WHERE hash_role.md5_hash = dlits.md5_hash $where1 $where2"
202 :     ) };
203 :     push( @$html, $cgi->start_form(-action => "get_dlits.cgi", -method => 'post'),
204 :     $cgi->hidden(-name => 'user', -value => $user),
205 :     $cgi->hidden(-name => 'curator', -value => $curator)
206 :     );
207 :    
208 :     my $whom = $curator ? "'$curator'" : "any one";
209 :     my $status = $show_just ? " with literature of status code '$show_just':" : ":";
210 :     push( @$html, $cgi->h3( "Subsystem roles curated by $whom" . $status ) );
211 :    
212 :     push( @$html, $cgi->scrolling_list( -name => 'role',
213 :     -values => [@roles],
214 :     -size => 30
215 :     ),
216 :     $cgi->br, &show_just_selector( $cgi ),
217 :     $cgi->br, $cgi->submit( 'Show Role' ),
218 :     $cgi->br, $cgi->submit( 'Show Genomes' ),
219 :     $cgi->br, $cgi->submit( 'Change subsystem curator' ), " currently '$curator'.",
220 :     $cgi->end_form
221 :     );
222 : overbeek 1.1 }
223 : golsen 1.7
224 :     # Literature selected by genome -----------------------------------------------
225 :    
226 :     elsif ( $submit3 && $genomeD && ( $genomeD =~ /\((\d+\.\d+)\)$/ ) )
227 : overbeek 1.1 {
228 : golsen 1.7 my $genome = $1;
229 :     my $where = $show_just ? " AND (dlits.status = '$show_just')" : '';
230 :     my $tuples = $rdbH->SQL( "SELECT DISTINCT dlits.status,dlits.md5_hash,dlits.pubmed
231 :     FROM genome_hash,dlits
232 :     WHERE genome_hash.genome = '$genome' AND genome_hash.md5_hash = dlits.md5_hash $where"
233 :     );
234 : overbeek 1.1 my @to_display = ();
235 : golsen 1.7 foreach my $x ( @$tuples )
236 : overbeek 1.1 {
237 : golsen 1.7 my ( $status, $hash, $pubmed ) = @$x;
238 :     foreach my $peg ( $fig->pegs_with_md5($hash) )
239 :     {
240 :     if ( &FIG::genome_of($peg) eq $genome )
241 :     {
242 :     push(@to_display,[ $status, $peg, $pubmed ]);
243 :     }
244 :     }
245 : overbeek 1.1 }
246 : golsen 1.7 &display_set( $fig, $cgi, $html, \@to_display, "Genes for $genomeD", 'Show Genome' );
247 :     }
248 :    
249 :     # Show genome list ------------------------------------------------------------
250 :    
251 :     elsif ( $submit1 || $submit3 )
252 :     {
253 :     # Did user request genome literature, and not select a genome?
254 :     push @$html, $cgi->h3( '<FONT Color=red>Please select a genome.</FONT>' ) if $submit3;
255 :    
256 :     my $where = $show_just ? " AND (dlits.status = '$show_just')" : "";
257 :    
258 :     my $genomes = $rdbH->SQL( "SELECT DISTINCT genome_hash.genome
259 :     FROM genome_hash,dlits
260 :     WHERE genome_hash.md5_hash = dlits.md5_hash $where"
261 :     );
262 :     my @genomes = sort { lc $a cmp lc $b } # Make sort case insensitive
263 :     map { &compute_genome_label( $fig, $_->[0] ) }
264 :     @$genomes;
265 :    
266 :     push( @$html, $cgi->start_form(-action => "get_dlits.cgi", -method => 'post'),
267 :     $cgi->hidden(-name => 'user', -value => $user),
268 :     $cgi->hidden(-name => 'curator', -value => $curator),
269 :     $cgi->scrolling_list( -name => 'genomeD',
270 :     -values => [@genomes],
271 :     -size => 30
272 :     ),
273 :     $cgi->br, &show_just_selector( $cgi ),
274 :     $cgi->br, $cgi->submit( 'Show Genome' ),
275 :     $cgi->br, $cgi->submit( 'Show Roles' ),
276 :     $cgi->br, $cgi->submit( 'Change subsystem curator' ), " currently '$curator'.",
277 :     $cgi->end_form
278 :     );
279 : overbeek 1.1 }
280 : golsen 1.7
281 :     # Default = display subsystem curators ----------------------------------------
282 :    
283 : overbeek 1.1 else
284 :     {
285 : golsen 1.7 my @cur = map { $_->[0] }
286 :     sort { $a->[1] cmp $b->[1] || length $a->[0] <=> length $b->[0] }
287 :     map { my $cur = $_->[0];
288 :     my $nam = lc $cur;
289 :     $nam =~ s/^master[:_]?//;
290 :     [ $cur, $nam ]
291 :     }
292 :     @{ $rdbH->SQL( "SELECT DISTINCT curator FROM dlits" ) };
293 :     my $curN = @cur;
294 :    
295 :     push( @$html, $cgi->start_form(-action => "get_dlits.cgi", -method => 'post'),
296 :     $cgi->hidden(-name => 'user', -value=>$user),
297 :     $cgi->scrolling_list( -name => 'curator',
298 :     -values => [ @cur ],
299 :     -size => $curN
300 :     ),
301 :     $cgi->br,
302 :     &show_just_selector( $cgi ),
303 :     $cgi->submit( 'Show Roles' ),
304 :     $cgi->br,
305 :     $cgi->submit( 'Show Genomes' ),
306 :     $cgi->end_form
307 :     );
308 :     }
309 :     &HTML::show_page($cgi,$html);
310 :     exit;
311 : overbeek 1.1
312 :    
313 : golsen 1.7 sub show_just_selector
314 :     {
315 :     my ( $cgi, $html ) = @_;
316 :     my $default = $cgi->param( 'show_just' );
317 :     $default =~ /^[ A-Z]$/ or $default = 'all';
318 :     return 'Show literature links with all status codes, or pick a specific one: '
319 :     . $cgi->scrolling_list( -name => 'show_just',
320 :     -values => ['all',' ','D','R','N','G'],
321 :     -default => $default,
322 :     -override => 1,
323 :     -size => 1
324 :     )
325 :     . $cgi->br;
326 : overbeek 1.1 }
327 :    
328 :    
329 :     sub compute_genome_label
330 :     {
331 :     my($fig, $org) = @_;
332 :    
333 :     my $gs = $fig->genus_species($org);
334 :     return "$gs ($org)";
335 :     }
336 :    
337 : golsen 1.7
338 : overbeek 1.1 sub title_of {
339 : golsen 1.8 my( $fig, $pubmed ) = @_;
340 : overbeek 1.1
341 :     my $rdbH = $fig->db_handle;
342 : golsen 1.7 my $retval = $rdbH->SQL( "SELECT title
343 :     FROM pubmed_titles
344 :     WHERE (pubmed = $pubmed)"
345 :     );
346 :     return ( @$retval > 0 ) ? $retval->[0]->[0] : "";
347 :     }
348 :    
349 :    
350 :     sub pubmed_link
351 :     {
352 :     return "<a target=_blank href=http://www.ncbi.nlm.nih.gov/sites/entrez?db=pubmed&cmd=search&term=$_[0]>$_[0]</a>";
353 : overbeek 1.1 }
354 : golsen 1.7
355 : overbeek 1.1
356 :     sub display_set {
357 : golsen 1.7 my( $fig, $cgi, $html, $to_display, $tab_title, $submit ) = @_;
358 : overbeek 1.1
359 : golsen 1.7 my %status_code = ( 'D' => 1, ' ' => 2, 'N' => 3, 'R' => 4, 'G' => 5 );
360 : overbeek 1.1
361 : golsen 1.7 # @$to_distplay items are [ $status, $peg, $pubmed ]
362 : overbeek 1.1
363 : golsen 1.7 foreach $_ ( @$to_display ) { $_->[0] =~ s/^\s*$/ /; } # fix empty status strings
364 :     my @tuples = sort { ( $status_code{$a->[0]} <=> $status_code{$b->[0]} )
365 :     or &FIG::by_fig_id( $a->[1], $b->[1] )
366 :     or ( $a->[2] <=> $b->[2] )
367 :     }
368 :     @$to_display;
369 : overbeek 1.1 my $total_tuples = @tuples;
370 :    
371 : golsen 1.7 my $from; # Offset to first item displayed
372 : golsen 1.8 my $n_per_page = 100; # Really the lines per page
373 : golsen 1.7
374 :     if ( $cgi->param( 'Go to item numbers' ) )
375 :     {
376 :     $from = $cgi->param( 'offset_select' );
377 :     }
378 :     else
379 :     {
380 :     $from = $cgi->param( 'from_line' ) || 0;
381 : golsen 1.8 $from -= $n_per_page if $cgi->param( 'Previous page' );
382 :     $from += $n_per_page if $cgi->param( 'Next page' );
383 : golsen 1.7 }
384 :    
385 :     # Cut down the array to that to be displayed
386 :    
387 :     if ( $total_tuples > 0 )
388 :     {
389 :     if ( $from < 0 ) { $from = 0 }
390 :     if ( $from > $total_tuples )
391 :     {
392 : golsen 1.8 $from = $n_per_page * int( ( $total_tuples - 1 ) / $n_per_page );
393 : golsen 1.7 }
394 :     splice( @tuples, 0, $from );
395 : golsen 1.8 splice( @tuples, $n_per_page );
396 : golsen 1.7 }
397 : overbeek 1.1 else
398 :     {
399 : golsen 1.7 undef $from;
400 : overbeek 1.1 }
401 :    
402 : golsen 1.7 # Add status code key at top of page
403 :    
404 :     &desc( $html );
405 :    
406 :     # Build the html form
407 :    
408 :     push( @$html, $cgi->start_form(-action => "get_dlits.cgi", -method => 'post') );
409 :    
410 :     # Current user
411 :     my $user = $cgi->param('user');
412 :     push( @$html, $cgi->hidden( -name => 'user', -value => $user, -override => 1 ) );
413 :    
414 :     # Filter roles by subsystem curator
415 : golsen 1.8 my $curator = $cgi->param('curator');
416 : golsen 1.7 push( @$html, $cgi->hidden( -name => 'curator', -value => $curator, -override => 1 ) ) if $curator;
417 :    
418 :     # Find lit by genome
419 :     my $genomeD = $cgi->param('genomeD');
420 :     push( @$html, $cgi->hidden( -name => 'genomeD', -value => $genomeD, -override => 1 ) ) if $genomeD;
421 :    
422 : golsen 1.8 # Show sequences associated with a reference
423 :     my $ref_id = $cgi->param('ref_id');
424 :     push( @$html, $cgi->hidden( -name => 'ref_id', -value => $ref_id, -override => 1 ) ) if $ref_id;
425 :    
426 : golsen 1.7 # Find lit by role
427 :     my $role = $cgi->param('role');
428 :     push( @$html, $cgi->hidden( -name => 'role', -value => $role, -override => 1 ) ) if $role;
429 :    
430 :     # Requested action
431 :     push( @$html, $cgi->hidden( -name => 'prev_req', -value => $submit, -override => 1 ) ) if $submit;
432 :    
433 :     # Used to inherit action
434 :     push( @$html, $cgi->hidden( -name => $submit, -value => 1, -override => 1 ) ) if $submit;
435 :    
436 :     push( @$html, $cgi->br );
437 :    
438 : golsen 1.8 # If this is not a table built around one reference, we want to append
439 :     # links to all proteins associated with the reference. We will
440 :     # compute this on a unique set of the references:
441 :    
442 :     my %genes_in_pub;
443 :     if ( ! $ref_id )
444 :     {
445 :     foreach ( @tuples )
446 :     {
447 :     my $pub = $_->[2];
448 :     next if defined $genes_in_pub{ $pub };
449 :     # This count intentionally omits filtering by status
450 :     $genes_in_pub{ $pub } = scalar ( &all_seqs_in_pub( $fig, $pub ) );
451 :     }
452 :     }
453 :    
454 : golsen 1.7 # Build the status selection table
455 :    
456 :     my $col_hdrs = [' ','G','N','R','D','PEG','Function','Genus/Species','PubMed','Title'];
457 :     my $tab = [];
458 : overbeek 1.1 my $i;
459 : golsen 1.8 for ( $i = 0; ($i < @tuples); $i++ )
460 : overbeek 1.1 {
461 : golsen 1.7 my $tuple = $tuples[$i];
462 :     my( $status, $peg, $pubmed ) = @$tuple;
463 :     next if (! $fig->is_real_feature($peg));
464 :     my $gs = $fig->genus_species( &FIG::genome_of( $peg ) );
465 :     $gs =~ s/^(\S+\s+\S+).*$/$1/;
466 :     my $title = &title_of( $fig, $pubmed );
467 :     my $func = $fig->function_of($peg);
468 :     my @codes = $cgi->radio_group( -name => "tuple:$peg:$pubmed:$status",
469 :     -values => [' ','G','N','R','D'],
470 :     -default => "$status",
471 :     -nolabels => 1
472 :     );
473 :    
474 : golsen 1.8 my $pub_link = &pubmed_link( $pubmed );
475 :    
476 :     # Does this paper cover more than one protein?
477 :    
478 :     if ( $genes_in_pub{ $pubmed } > 1 )
479 :     {
480 :     # This link intentionally omits filtering by status
481 :     $pub_link .= "<BR />(<A HRef='get_dlits.cgi?user=$user&ref_id=$pubmed' Target=_blank>$genes_in_pub{$pubmed} seqs</A>)";
482 :     }
483 : golsen 1.7 if (($i % 15) == 14) { push(@$tab,$col_hdrs) }
484 : golsen 1.8 push( @$tab, [ @codes, &HTML::fid_link( $cgi, $peg ), $func, $gs, $pub_link, $title ] );
485 : golsen 1.7 }
486 :    
487 :     push( @$html,&HTML::make_table( $col_hdrs, $tab, $tab_title ) );
488 :    
489 :     push( @$html, $cgi->br, &show_just_selector( $cgi ) );
490 :    
491 :     # Navigation controls through long lists
492 :    
493 : golsen 1.8 if ( defined( $from ) && ( $total_tuples > $n_per_page ) )
494 : golsen 1.7 {
495 :     my $i1 = $from + 1;
496 : golsen 1.8 my $i2 = $from + $n_per_page;
497 : golsen 1.7 $i2 = $total_tuples if $i2 > $total_tuples;
498 :     push( @$html, $cgi->hidden( -name => 'from_line', -value => $from, -override => 1 ) );
499 :     push( @$html, $cgi->br, "Currently displaying items $i1 - $i2 of $total_tuples.", $cgi->br );
500 :     push( @$html, $cgi->submit( 'Previous page' ) ) if $from > 0;
501 :     push( @$html, $cgi->submit( 'Next page' ) ) if $i2 < $total_tuples;
502 :    
503 :     my @offsets;
504 :     my %labels;
505 : golsen 1.8 for ( my $i = 0; $i < $total_tuples; $i += $n_per_page )
506 : golsen 1.7 {
507 :     push @offsets, $i;
508 : golsen 1.8 my $imax = $i + $n_per_page;
509 : golsen 1.7 $imax = $total_tuples if $imax > $total_tuples;
510 :     $labels{ $i } = ( $i+1 ) . " - $imax";
511 :     }
512 :     push( @$html, $cgi->submit( 'Go to item numbers' ),
513 :     $cgi->scrolling_list( -name => 'offset_select',
514 :     -values => \@offsets,
515 :     -labels => \%labels,
516 :     -default => $from,
517 :     -size => 1,
518 :     -override => 1
519 :     ),
520 :     $cgi->br );
521 : overbeek 1.1 }
522 : golsen 1.7
523 :     # Some action buttons:
524 :    
525 :     push( @$html, $cgi->br, $cgi->submit( 'Process Changes' ), "entered on this page." );
526 :    
527 : golsen 1.8 # Display some general navigation buttons. However, these are not
528 :     # consistent with the intended use of the publication-based view.
529 : golsen 1.7
530 : golsen 1.8 if ( ! $ref_id )
531 : golsen 1.7 {
532 : golsen 1.8 push( @$html, $cgi->br, $cgi->submit( 'Show Genomes' ), "discarding any changes made on this page." );
533 :     if ( $curator )
534 :     {
535 :     push( @$html, $cgi->br, $cgi->submit( 'Show Roles' ),
536 :     "for subsystem curator '$curator', discarding any changes made on this page." );
537 :     }
538 :     push( @$html, $cgi->br, $cgi->submit( 'Change subsystem curator' ), " currently '$curator', discarding any changes made on this page." );
539 : golsen 1.7 }
540 :    
541 : golsen 1.8 push( @$html, $cgi->end_form );
542 :     }
543 :    
544 : golsen 1.7
545 : golsen 1.8 # dlit
546 :     # flds => "status char(1), md5_hash varchar(32), pubmed varchar(16), curator varchar(30), go_code varchar(15)"
547 :    
548 :     sub all_seqs_in_pub {
549 :     my ( $fig, $pubmed, $status ) = @_;
550 :     my $rdbH = $fig->db_handle;
551 :     my $and_status = $status ? " AND ( status = '$status' )" : "";
552 :     my $response = $rdbH->SQL( "SELECT DISTINCT md5_hash
553 :     FROM dlits
554 :     WHERE ( pubmed = '$pubmed' )"
555 :     . $and_status
556 :     );
557 :     return ( ref $response ) ? map { $_->[0] } @$response : ();
558 : overbeek 1.1 }
559 :    
560 : golsen 1.7
561 : overbeek 1.4 sub desc {
562 : golsen 1.7 my( $html ) = @_;
563 : overbeek 1.4
564 : golsen 1.7 my $col_hdrs = [ "Code", "Meaning" ];
565 :     my $tab = [ [ [" ","TD Align=center"], "No one has curated this link yet" ],
566 :     [ ["G","TD Align=center"], "Genome paper - marks all uncurated protein links of this paper to 'G' (implicitly irrelevant)" ],
567 :     [ ["N","TD Align=center"], "Not relevant to this protein" ],
568 :     [ ["R","TD Align=center"], "Relevant, but not strong enough to determine function" ],
569 :     [ ["D","TD Align=center"], "Direct reference that can be used to support function assertion" ]
570 :     ];
571 :     push( @$html, &HTML::make_table( $col_hdrs, $tab, "Code Meanings" ), "<hr>" );
572 : overbeek 1.4 }
573 :    
574 : golsen 1.7
575 : overbeek 1.1 sub process_changes {
576 : golsen 1.7 my( $fig, $cgi, $html ) = @_;
577 :     my $user = $cgi->param('user');
578 : overbeek 1.1
579 :     my @tuples = grep { $_->[2] ne $_->[3] }
580 :     map { ($_ =~ /^tuple:(fig\|\d+\.\d+\.peg\.\d+)\s*:\s*(\d+)\s*:([ RDGN])/) ? [$1,$2,$3,$cgi->param($_)] : () }
581 :     $cgi->param();
582 : golsen 1.7 my $n_change = 0;
583 :     foreach my $tuple ( @tuples )
584 : overbeek 1.1 {
585 : golsen 1.7 my( $peg, $pubmed, $from, $to ) = @$tuple;
586 :     $fig->add_dlit( -status => $to,
587 :     -peg => $peg,
588 :     -pubmed => $pubmed,
589 :     -curator => $user,
590 :     -override => 1
591 :     );
592 :     $n_change++;
593 : overbeek 1.1 }
594 : golsen 1.7
595 :     push( @$html, $cgi->h2( "<FONT Color=green>Made $n_change requested changes.</FONT>" ) );
596 : overbeek 1.1 }
597 :    
598 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3