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

Annotation of /FigWebServices/get_dlit.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (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.5 push(@$html,$cgi->h1("You should be using get_dlits.cgi -- add an 's' and try again"));
63 :     &HTML::show_page($cgi,$html);
64 :     exit;
65 :     #######
66 : overbeek 1.4
67 :     my $user = $cgi->param('user');
68 : overbeek 1.1 my $curator = $cgi->param('curator');
69 :     my $roleN = $cgi->param('roleN');
70 : overbeek 1.4 if ($roleN) { $roleN =~ s/^(\d+)\t.*$/$1/; }
71 : overbeek 1.1 my @checked = $cgi->param('checked');
72 :    
73 :     if (! $user)
74 :     {
75 :     push(@$html,$cgi->h1('you need to set user= in the URL'));
76 :     }
77 :     elsif (! -d "$FIG_Config::data/DlitByCurator")
78 :     {
79 :     push(@$html,$cgi->h1("dlit data not installed"));
80 :     }
81 :     elsif (! $curator)
82 :     {
83 :     if (opendir(CUR,"$FIG_Config::data/DlitByCurator/ByCurator"))
84 :     {
85 : overbeek 1.3 my @cur = sort grep { $_ !~ /^\./ } readdir(CUR);
86 : overbeek 1.1 my $curN = @cur;
87 :     push(@$html, $cgi->start_form(-action => "get_dlit.cgi", -method => 'post'),
88 :     $cgi->hidden(-name => 'user', -value=>$user),
89 :     "Pick one<br>",
90 :     $cgi->scrolling_list( -name => 'curator',
91 :     -values => [ @cur ],
92 :     -size => $curN
93 :     ),
94 :     $cgi->br,
95 :     $cgi->submit( 'Pick One' ),
96 :     $cgi->end_form
97 :     );
98 :     }
99 :    
100 :     }
101 :     elsif (! $roleN)
102 :     {
103 :     if (opendir(CUR,"$FIG_Config::data/DlitByCurator/ByCurator/$curator"))
104 :     {
105 : overbeek 1.3 my @roles = sort grep { $_ !~ /^\./ } readdir(CUR);
106 : overbeek 1.4 my %rolesH = map { $_ => 1 } @roles;
107 :     my @rolesE = map { $_ =~ /^(\d+)\t(\S.*\S)/; $rolesH{$1} ? [$1,$2] : () }
108 :     `cat $FIG_Config::data/DlitByCurator/index.of.roles`;
109 :     my @rolesV = map { $_->[0] } @rolesE;
110 :     my %role_map = map { $_->[0] => $_->[1] } @rolesE;
111 :    
112 :     push(@$html, $cgi->start_form(-action => "get_dlit.cgi", -method => 'post', -target => '_blank'),
113 : overbeek 1.1 $cgi->hidden(-name => 'user', -value=>$user),
114 :     $cgi->hidden(-name => 'curator', -value=>$curator),
115 :     "Pick one<br>",
116 :     $cgi->scrolling_list( -name => 'roleN',
117 : overbeek 1.4 -values => [ sort @rolesV ],
118 :     -labels => \%role_map,
119 : overbeek 1.1 -size => 20
120 :     ),
121 :     $cgi->br,
122 :     $cgi->submit( 'Pick One' ),
123 :     $cgi->end_form
124 :     );
125 :     }
126 :    
127 :     }
128 :     elsif (@checked == 0)
129 :     {
130 :     my $col_hdrs = ['Use','role','PubMed','Peg','Species','SP-ID','Swiss Prot Function','Paper'];
131 :     my $tab = [];
132 :     foreach $_ (`cat $FIG_Config::data/DlitByCurator/ByCurator/$curator/$roleN`)
133 :     {
134 :     chop;
135 :     my($cur,$role,$pubmed,$ids,$sp_func,$paper) = split(/\t/,$_);
136 :     my @ids = split(/,/,$ids);
137 :     foreach my $tuple (@ids)
138 :     {
139 :     my($peg,$sp,$gs) = split(/:/,$tuple);
140 :     my $check = $cgi->checkbox(-name => 'checked', -value => "$peg:$pubmed", -checked => 0, -override => 1, -label => '');
141 :     push(@$tab,[$check,
142 :     $role,
143 : overbeek 1.4 "<a target=_blank href=http://www.ncbi.nlm.nih.gov/sites/entrez?db=pubmed&cmd=search&term=$pubmed>$pubmed</a>",
144 : overbeek 1.1 &HTML::fid_link($cgi,$peg),
145 :     $gs,
146 :     &HTML::sp_link($cgi,"sp|$sp"),
147 :     $sp_func,
148 :     $paper
149 :     ]);
150 :     }
151 :     }
152 :     push(@$html, $cgi->start_form(-action => "get_dlit.cgi", -method => 'post'),
153 :     $cgi->hidden(-name => 'user', -value=>$user),
154 :     $cgi->hidden(-name => 'curator', -value=>$curator),
155 :     $cgi->hidden(-name => 'roleN', -value=>$roleN),
156 :     &HTML::make_table($col_hdrs,$tab,'Possible Papers'),
157 :     $cgi->br,
158 :     $cgi->submit( 'Save Dlits' ),
159 :     $cgi->end_form
160 :     );
161 :    
162 :    
163 :     }
164 :     elsif (@checked > 0)
165 :     {
166 :     if (open(DLITS,">>$FIG_Config::data/DlitByCurator/dlits"))
167 :     {
168 :     foreach $_ (@checked)
169 :     {
170 :     $_ =~ s/:/\t/;
171 : overbeek 1.2 print DLITS "$_\t$user\n";
172 : overbeek 1.1 }
173 :     close(DLITS);
174 :     }
175 :     &FIG::verify_dir("$FIG_Config::data/DlitByCurator/Saved/$curator");
176 :     system("mv $FIG_Config::data/DlitByCurator/ByCurator/$curator/$roleN $FIG_Config::data/DlitByCurator/Saved/$curator/$roleN");
177 :     push(@$html,$cgi->h1("$roleN processed"));
178 :     }
179 :    
180 :     &HTML::show_page($cgi,$html);
181 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3