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

Annotation of /FigWebServices/get_dlit.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download)

1 : overbeek 1.1 # -*- perl -*-
2 :     #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # 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 :    
20 :     use FIG;
21 :     my $fig = new FIG;
22 :    
23 :     use HTML;
24 :     use strict;
25 :    
26 :     use CGI;
27 :     my $cgi = new CGI;
28 :    
29 :    
30 :     if (0)
31 :     {
32 :     my $VAR1;
33 :     eval(join("",`cat /tmp/get_dlit_parms`));
34 :     $cgi = $VAR1;
35 :     print STDERR &Dumper($cgi);
36 :     }
37 :    
38 :     if (0)
39 :     {
40 :     print $cgi->header;
41 :     my @params = $cgi->param;
42 :     print "<pre>\n";
43 :     foreach $_ (@params)
44 :     {
45 :     print "$_\t:",join(",",$cgi->param($_)),":\n";
46 :     }
47 :    
48 :     if (0)
49 :     {
50 :     if (open(TMP,">/tmp/get_dlit_parms"))
51 :     {
52 :     print TMP &Dumper($cgi);
53 :     close(TMP);
54 :     }
55 :     }
56 :     exit;
57 :     }
58 :     my($genome);
59 :    
60 :     my $html = [];
61 :     unshift @$html, "<TITLE>Get Dlits</TITLE>\n";
62 : overbeek 1.4
63 :     my $user = $cgi->param('user');
64 : overbeek 1.1 my $curator = $cgi->param('curator');
65 :     my $roleN = $cgi->param('roleN');
66 : overbeek 1.4 if ($roleN) { $roleN =~ s/^(\d+)\t.*$/$1/; }
67 : overbeek 1.1 my @checked = $cgi->param('checked');
68 :    
69 :     if (! $user)
70 :     {
71 :     push(@$html,$cgi->h1('you need to set user= in the URL'));
72 :     }
73 :     elsif (! -d "$FIG_Config::data/DlitByCurator")
74 :     {
75 :     push(@$html,$cgi->h1("dlit data not installed"));
76 :     }
77 :     elsif (! $curator)
78 :     {
79 :     if (opendir(CUR,"$FIG_Config::data/DlitByCurator/ByCurator"))
80 :     {
81 : overbeek 1.3 my @cur = sort grep { $_ !~ /^\./ } readdir(CUR);
82 : overbeek 1.1 my $curN = @cur;
83 :     push(@$html, $cgi->start_form(-action => "get_dlit.cgi", -method => 'post'),
84 :     $cgi->hidden(-name => 'user', -value=>$user),
85 :     "Pick one<br>",
86 :     $cgi->scrolling_list( -name => 'curator',
87 :     -values => [ @cur ],
88 :     -size => $curN
89 :     ),
90 :     $cgi->br,
91 :     $cgi->submit( 'Pick One' ),
92 :     $cgi->end_form
93 :     );
94 :     }
95 :    
96 :     }
97 :     elsif (! $roleN)
98 :     {
99 :     if (opendir(CUR,"$FIG_Config::data/DlitByCurator/ByCurator/$curator"))
100 :     {
101 : overbeek 1.3 my @roles = sort grep { $_ !~ /^\./ } readdir(CUR);
102 : overbeek 1.4 my %rolesH = map { $_ => 1 } @roles;
103 :     my @rolesE = map { $_ =~ /^(\d+)\t(\S.*\S)/; $rolesH{$1} ? [$1,$2] : () }
104 :     `cat $FIG_Config::data/DlitByCurator/index.of.roles`;
105 :     my @rolesV = map { $_->[0] } @rolesE;
106 :     my %role_map = map { $_->[0] => $_->[1] } @rolesE;
107 :    
108 :     push(@$html, $cgi->start_form(-action => "get_dlit.cgi", -method => 'post', -target => '_blank'),
109 : overbeek 1.1 $cgi->hidden(-name => 'user', -value=>$user),
110 :     $cgi->hidden(-name => 'curator', -value=>$curator),
111 :     "Pick one<br>",
112 :     $cgi->scrolling_list( -name => 'roleN',
113 : overbeek 1.4 -values => [ sort @rolesV ],
114 :     -labels => \%role_map,
115 : overbeek 1.1 -size => 20
116 :     ),
117 :     $cgi->br,
118 :     $cgi->submit( 'Pick One' ),
119 :     $cgi->end_form
120 :     );
121 :     }
122 :    
123 :     }
124 :     elsif (@checked == 0)
125 :     {
126 :     my $col_hdrs = ['Use','role','PubMed','Peg','Species','SP-ID','Swiss Prot Function','Paper'];
127 :     my $tab = [];
128 :     foreach $_ (`cat $FIG_Config::data/DlitByCurator/ByCurator/$curator/$roleN`)
129 :     {
130 :     chop;
131 :     my($cur,$role,$pubmed,$ids,$sp_func,$paper) = split(/\t/,$_);
132 :     my @ids = split(/,/,$ids);
133 :     foreach my $tuple (@ids)
134 :     {
135 :     my($peg,$sp,$gs) = split(/:/,$tuple);
136 :     my $check = $cgi->checkbox(-name => 'checked', -value => "$peg:$pubmed", -checked => 0, -override => 1, -label => '');
137 :     push(@$tab,[$check,
138 :     $role,
139 : overbeek 1.4 "<a target=_blank href=http://www.ncbi.nlm.nih.gov/sites/entrez?db=pubmed&cmd=search&term=$pubmed>$pubmed</a>",
140 : overbeek 1.1 &HTML::fid_link($cgi,$peg),
141 :     $gs,
142 :     &HTML::sp_link($cgi,"sp|$sp"),
143 :     $sp_func,
144 :     $paper
145 :     ]);
146 :     }
147 :     }
148 :     push(@$html, $cgi->start_form(-action => "get_dlit.cgi", -method => 'post'),
149 :     $cgi->hidden(-name => 'user', -value=>$user),
150 :     $cgi->hidden(-name => 'curator', -value=>$curator),
151 :     $cgi->hidden(-name => 'roleN', -value=>$roleN),
152 :     &HTML::make_table($col_hdrs,$tab,'Possible Papers'),
153 :     $cgi->br,
154 :     $cgi->submit( 'Save Dlits' ),
155 :     $cgi->end_form
156 :     );
157 :    
158 :    
159 :     }
160 :     elsif (@checked > 0)
161 :     {
162 :     if (open(DLITS,">>$FIG_Config::data/DlitByCurator/dlits"))
163 :     {
164 :     foreach $_ (@checked)
165 :     {
166 :     $_ =~ s/:/\t/;
167 : overbeek 1.2 print DLITS "$_\t$user\n";
168 : overbeek 1.1 }
169 :     close(DLITS);
170 :     }
171 :     &FIG::verify_dir("$FIG_Config::data/DlitByCurator/Saved/$curator");
172 :     system("mv $FIG_Config::data/DlitByCurator/ByCurator/$curator/$roleN $FIG_Config::data/DlitByCurator/Saved/$curator/$roleN");
173 :     push(@$html,$cgi->h1("$roleN processed"));
174 :     }
175 :    
176 :     &HTML::show_page($cgi,$html);
177 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3