Debian Codegraph @

wdemo/wspec/webace_view.pl

raw
1 # view preferences for humace and chr acedb db's at sanger
2 # Tim Hubbard, 13/2/97
3 # $Id: webace_view.pl,v 1.1 2001/01/17 14:31:31 edgrif Exp $
4
5 # This can be either a database specific or global file affecting
6 # behaviour of 'display' CGI script.
7
8 # Description of variables
9 # things that you can edit are preceeded by '# EDITABLE'
10 #
11 # $use_fmap_view and $use_gmap_view are flags
12 # - set either of these to =0 if you want to disable that view control
13 #
14 # @fmap_view, %fmap_view are parameters used by CGI.pm popup_menu
15 # call and define the available options for the user.
16 # - edit these to define list of views available
17 # [these are defined inside fmap_view or gmap_view]
18 #
19 # %fmap_head specifies the header to be displayed for each view
20 # and @fmap_head specifies the html for that header (similarly
21 # for %fmap_key and @fmap_key). These must be defined in the subroutine
22 # $gmap_view and $fmap_view as the relevant one only is return depending
23 # on the view selected.
24 #
25 # for gmap, the mapping between webace viewnames and acedb viewnames is
26 # provided by %gmap_acedb_viewcom (a global)
27 #
28 # for fmap, the sets of elements of a view are defined by
29 # %fmap_col, which is indexed by %fmap_col_index.
30 #
31
32 # A. fmap:
33 $use_fmap_view=1;
34
35 # default = as in acedb by default
36 # def = assembly_tags off (default view we want)
37 # hom = at, repeats, genepred off
38 # gene = at, repeats, genepred, homol off
39
40 # 1. subroutine rule for semantic view
41 $fmap_view=sub{
42 my($rview,$object,$rafmap_view,$rhfmap_view,
43 $rfmap_head,$rfmap_key)=@_;
44 my($lenview,%fmap_head,@fmap_head,
45 %fmap_key,@fmap_key,$view2);
46
47 # EDITABLE
48 @$rafmap_view=(
49 'auto',
50 'def',
51 'hom',
52 'ggp',
53 'gene',
54 );
55 # EDITABLE
56 %$rhfmap_view=(
57 'auto','Auto Select',
58 'def','All',
59 'hom','Genes and Homology',
60 'ggp','Genes and Predictions',
61 'gene','Genes Only',
62 );
63 # EDITABLE
64 %fmap_head=(
65 'auto',1,
66 'def',1,
67 'hom',1,
68 'ggp',1,
69 'gene',1,
70 );
71 # EDITABLE
72 @fmap_head[1]='';
73 # EDITABLE
74 %fmap_key=(
75 'auto',1,
76 'def',1,
77 'hom',1,
78 'ggp',2,
79 'gene',1,
80 );
81 # EDITABLE
82 # @fmap_key[1]=<<ENDOFTEXT;
83 #Feature colour key:
84 #<img src="/webace/I/darkgreen.gif"> Genes for which there is supporting evidence
85 #<img src="/webace/I/darkred.gif"> mRNA<p>
86 #ENDOFTEXT
87 # EDITABLE
88 #@fmap_key[2]=<<ENDOFTEXT;
89 #Feature colour key:
90 #<img src="/webace/I/darkgreen.gif"> Genes for which there is supporting evidence
91 #<img src="/webace/I/darkred.gif"> mRNA
92 #<img src="/webace/I/blue.gif"> Ab initio gene predictions<p>
93 ENDOFTEXT
94
95 # EDITABLE to define semantic rules
96 if($begin && $end){
97 $lenview=$end-$begin;
98 if($lenview>40000){
99 # $view2='gene';
100 $view2='ggp';
101 }elsif($lenview>4000){
102 $view2='hom';
103 }else{
104 $view2='def';
105 }
106 }else{
107
108 # if no begin or end, assume clone -> minimal view
109 # $view2='gene';
110 $view2='ggp';
111 }
112
113 # check view exists or default
114 unless($$rhfmap_view{$$rview}){
115 $$rview='def';
116 }
117 # use defined here only if auto
118 if($$rview ne 'auto'){
119 $view2=$$rview;
120 }
121 # select head/key
122 $$rfmap_head=$fmap_head[$fmap_head{$view2}];
123 $$rfmap_key=$fmap_key[$fmap_key{$view2}];
124 return $view2;
125
126 };
127
128 # 2. set of columns for views
129
130 # EDITABLE
131 %fmap_col_index=(
132 'default',0,
133 'def',1,
134 'hom',2,
135 'gene',3,
136 'ggp',4,
137 );
138
139 # default, def, hom, gene
140 # EDITABLE
141 %fmap_col=(
142
143 # methods
144
145 # real genes
146 'supported_CDS',
147 [1,1,1,1,1,],
148 'supported_mRNA',
149 [1,1,1,1,1,],
150
151 # repeats
152 'RepeatMasker',
153 [1,1,2,2,2,],
154 'RepeatMasker_SINE',
155 [1,1,2,2,2,],
156 'hmmfs_alu', #obs
157 [1,1,2,2,2,],
158 'repbase_tblastx', #obs
159 [1,1,2,2,2,],
160
161 # homologies
162 'BLASTX',
163 [1,1,1,2,2,],
164 '-BLASTX',
165 [1,1,1,2,2,],
166 'BLASTN',
167 [1,1,1,2,2,],
168 'est_hmmfs',
169 [1,1,1,2,2,],
170 'vertebrate_mRNA',
171 [1,1,1,2,2,],
172 'EST_clusters',
173 [1,1,1,2,2,],
174 'sanger_sts_hmmfs',
175 [1,1,1,2,2,],
176 'sts_hmmfs',
177 [1,1,1,2,2,],
178 'tandem',
179 [1,1,1,2,2,],
180 'cgidb_hmmfs',
181 [1,1,1,2,2,],
182
183 # gene prediction
184 'GENSCAN',
185 [1,1,2,2,1,],
186
187 # exon predictions
188 'Grail1', #old
189 [1,1,2,2,1,],
190 'Grail1.3',
191 [1,1,2,2,1,],
192 'Grail2',
193 [1,1,2,2,1,],
194 'FEXH',
195 [1,1,2,2,1,],
196 'HEXON',
197 [1,1,2,2,1,],
198 'Xpound',
199 [1,1,2,2,1,],
200
201 # other predictions
202 'Predicted_CpG_island',
203 [1,1,2,2,2,],
204
205 # hardcode acedb
206 # gene prediction
207 '-Coding',
208 [1,1,2,2,1,],
209 'Coding',
210 [1,1,2,2,1,],
211
212 # always off
213 'Assembly Tags',
214 [1,2,2,2,2,],
215
216 'Locator',
217 [1,1,1,1,1,],
218 'Sequences & ends',
219 [1,1,1,1,1,],
220 '-Confirmed introns',
221 [1,1,1,1,1,],
222 'Restriction map',
223 [1,1,1,1,1,],
224 'Summary bar',
225 [1,1,1,1,1,],
226 'Scale',
227 [1,1,1,1,1,],
228 'Confirmed introns',
229 [1,1,1,1,1,],
230 'EMBL features',
231 [1,1,1,1,1,],
232 'CDS Lines',
233 [2,2,2,2,2,],
234 'CDS Boxes',
235 [2,2,2,2,2,],
236 'Alleles',
237 [1,1,1,1,1,],
238 'cDNAs',
239 [2,2,2,2,2,],
240 'Gene Names',
241 [1,1,1,1,1,],
242 'Oligos',
243 [1,1,1,1,1,],
244 'Oligo_pairs',
245 [1,1,1,1,1,],
246 '3 Frame Translation',
247 [2,2,2,2,2,],
248 'ORF\'s',
249 [2,2,2,2,2,],
250 'Coding Frame',
251 [1,1,1,1,1,],
252 'ATG',
253 [2,2,2,2,2,],
254 'Gene Translation',
255 [2,2,2,2,2,],
256 'GC',
257 [1,1,1,1,1,],
258 'Coords',
259 [2,2,2,2,2,],
260 'DNA Sequence',
261 [2,2,2,2,2,],
262 'Brief Identifications',
263 [2,2,2,2,2,],
264 'Text Features',
265 [1,1,1,1,1,],
266 );
267
268 # B. gmap
269 $use_gmap_view=1;
270
271 # 1. define list of views
272 %gmap_acedb_viewcom=(
273 'def','',
274 'chr','-view webace_chr',
275 'chrctg1','-view webace_chrctg1',
276 'chrctg2','-view webace_chrctg2',
277 );
278
279 # 2. subroutine rule for view selection by maptype
280 $gmap_view=sub{
281 my($rview,$object,$rafmap_view,$rhfmap_view,
282 $rfmap_head,$rfmap_key)=@_;
283 my(%fmap_head,@fmap_head,
284 %fmap_key,@fmap_key,$view2);
285
286 # EDITABLE to define view/object selection rules
287 if($object=~/^Chr_\w+ctg\d+$/){
288
289 # EDITABLE
290 @$rafmap_view=(
291 'def',
292 'chrctg1',
293 'chrctg2',
294 );
295 # EDITABLE
296 %$rhfmap_view=(
297 'def','Default view',
298 'chrctg1','All clones',
299 'chrctg2','Selected clones',
300 );
301 # EDITABLE
302 %fmap_head=(
303 'def',1,
304 'chrctg1',1,
305 'chrctg2',1,
306 );
307 # EDITABLE
308 $fmap_head[1]='';
309 # EDITABLE
310 %fmap_key=(
311 'def',1,
312 'chrctg1',1,
313 'chrctg2',1,
314 );
315 # EDITABLE
316 $fmap_key[1]=<<ENDOFTEXT;
317 Clone status colour key:
318 <img src="/webace/I/black.gif"> Archived/Submitted
319 <img src="/webace/I/red.gif"> Finished
320 <img src="/webace/I/lightred.gif"> Contiguous
321 <img src="/webace/I/yellow.gif"> Assembly_start
322 <img src="/webace/I/green.gif"> Shotgun_complete
323 <img src="/webace/I/lightgray.gif"> Shotgun
324 <img src="/webace/I/blue.gif"> Library_made
325 <img src="/webace/I/lightblue.gif"> Fingerprinted
326 <img src="/webace/I/white.gif"> DNA_made/Streaked<p>
327 ENDOFTEXT
328 # EDITABLE
329 $view2='chrctg2';
330 }else{
331 # EDITABLE
332 @$rafmap_view=(
333 'def',
334 'chr',
335 );
336 # EDITABLE
337 %$rhfmap_view=(
338 'def','Default view',
339 'chr','Contigs only',
340 );
341 # EDITABLE
342 %fmap_head=(
343 'def',1,
344 'chr',1,
345 );
346 # EDITABLE
347 $fmap_head[1]='';
348 # EDITABLE
349 %fmap_key=(
350 'def',1,
351 'chr',1,
352 );
353 # EDITABLE
354 $fmap_key[1]=<<ENDOFTEXT;
355 Key: red bars are clone contigs.<p>
356 ENDOFTEXT
357 # EDITABLE
358 $view2='chr';
359 }
360
361 # in this case, set view if set to auto
362 # [no semantic zooming in this case]
363 if($$rview eq 'auto'){
364 $$rview=$view2;
365 }
366
367 # check view exists or default
368 unless($$rhfmap_view{$$rview}){
369 $$rview='def';
370 }
371 # use defined here only if auto
372 if($$rview ne 'auto'){
373 $view2=$$rview;
374 }
375 $$rfmap_head=$fmap_head[$fmap_head{$view2}];
376 $$rfmap_key=$fmap_key[$fmap_key{$view2}];
377 return $view2;
378
379 };
380
381 # C. External Links
382
383 $use_external_link=1;
384
385 $external_link=sub{
386 my($label)=@_;
387 my($type,@keys);
388 if($label=~/^Sequence:em:(\w+)/i){
389 $keys[0]=$1;
390 $type="EMBLAC";
391 }elsif($label=~/^Protein:sw:(\w+)/i){
392 $keys[0]=$1;
393 $type="SwissProtAC";
394 }elsif($label=~/^Protein:tr:(\w+)/i){
395 $keys[0]="tr:$1";
396 $type="TremblAC";
397 }elsif($label=~/^Protein:wp:(\w+)/i){
398 $keys[0]="wp:$1";
399 $type="WPAC";
400 }
401 return ($type,@keys);
402 };
403
404 # D. External Help
405
406 $use_external_help=0;
407
408 $external_help=sub{
409 my($label,$type)=@_;
410 my($link,$stem,$ext);
411 $stem="/webace/methods-help.html#";
412 if($label=~/^Sequence:/i && $type=~/Map/i){
413 $ext="mapsequence";
414 }elsif($label=~/^PAC:/i){
415 $ext="mappac";
416 }elsif($label=~/^STS:/i){
417 $ext="mapsts";
418 }elsif($label=~/^Probe:/i){
419 $ext="mapprobe";
420 }elsif($label=~/^Sequence:(em|sp|wp)/i){
421 $ext="sequence";
422 }elsif($label=~/^Protein:/i){
423 $ext="protein";
424 }elsif($label=~/^Sequence:\w+\.(fgeneh|genscan)/i){
425 $ext="gene_predictions";
426 }
427 if($ext){
428 $link=$stem.$ext;
429 }
430 return $link;
431 };
432