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

Annotation of /FigWebServices/get_dlit.cgi

Parent Directory Parent Directory | Revision Log Revision Log


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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3