Changeset 311 for trunk/vertex
- Timestamp:
- 05/05/08 10:57:51 (7 months ago)
- Files:
-
- trunk/vertex/lib/vertex/web/user.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/vertex/lib/vertex/web/user.py
r310 r311 10 10 'ret' : 'chr6:5,788,957-6,042,376', 11 11 'slit1' : 'chr6:23,800,220-23,852,953', 12 'foxd3' : 'chr8:28 ,540,680-28,566,644',12 'foxd3' : 'chr8:28514716-28592608', 13 13 'sox10' : 'chr1:52,958,231-53,024,630' } 14 14 … … 17 17 'ret-c' : 'chr6:5,985,800-5,986,800', 18 18 'ret-d' : 'chr6:5,890,500-5,891,000', 19 'ret-e' : 'chr6:5,894,800-5,895,100' } 20 21 motifs = { 'WGATAR' : 'purple', 19 'ret-e' : 'chr6:5,894,800-5,895,100', 20 'foxd3.3' : 'chr8:28,516,163-28,518,242', 21 'foxd3.9' : 'chr8:28,541,367-28,542,246'} 22 23 motifs = { 'WGATARA' : 'purple', 22 24 'AGCGGA' : 'green', 23 25 'GGGTTGC' : 'red' } … … 29 31 Top-level user interface. 30 32 """ 31 _q_exports = ['', 'v' ]33 _q_exports = ['', 'v', 'add_motif', 'delete_motif'] 32 34 33 35 def __init__(self, username): … … 58 60 s += "Constructs: <ul><li>" + "<li>".join(x) + "</ul>" 59 61 62 s += "<hr>" 63 64 if motifs: 65 x = [] 66 for k in motifs: 67 x.append("<tt>%s</tt>: %s <a href='delete_motif?iupac=%s'>[delete]</a>" % (k, motifs[k], k)) 68 s += "Motifs: <ul><li>" + "<li>".join(x) + "</ul>" 69 70 s += "<form method='POST' action='add_motif'>Add motif: <input type='text' name='iupac'> <select name='color'><option value='red'> red<option value='blue'> blue</select><input type='submit' value='add'></form>" 71 60 72 return s 73 74 def add_motif(self): 75 request = quixote.get_request() 76 iupac = request.form['iupac'].strip().upper() 77 color = request.form['color'] 78 79 motifs[iupac] = color 80 81 make_motif_nlmsa() 82 83 return quixote.redirect('./') 84 85 def delete_motif(self): 86 request = quixote.get_request() 87 iupac = request.form['iupac'] 88 89 if iupac in motifs: 90 del motifs[iupac] 91 92 make_motif_nlmsa() 93 94 return quixote.redirect('./') 61 95 62 96 ### … … 76 110 maps.append(constructs_nlmsa) 77 111 78 maps.append(motif_nlmsa) 112 if motif_nlmsa: 113 maps.append(motif_nlmsa) 79 114 80 115 colors = [ 'red', 'black', 'blue', 'black' ] … … 132 167 x = [] 133 168 for motif, color in motifs.items(): 134 x.append(' %s(%s)' % (motif, color,))169 x.append('<tt>%s</tt> (%s)' % (motif, color,)) 135 170 motiflist = ", ".join(x) 136 171 … … 154 189 <p> 155 190 Motifs: %s 191 <p> 156 192 <img src='draw/%s' width='1000'> 157 193 """ % (view, where, size, size / 1000, where, … … 208 244 return nlmsa 209 245 210 data.load() 211 212 x = [] 213 for v in views.values(): 214 (chr, start, stop) = coords.translate(v) 215 subseq = data.genome[chr][start:stop] 216 x.append(subseq) 217 218 motif_nlmsa = make_motif_search_nlmsa(data.genome, x, motifs) 246 motif_nlmsa = None 247 def make_motif_nlmsa(): 248 global motif_nlmsa 249 data.load() 250 251 if not motifs: 252 motif_nlmsa = None 253 return 254 255 x = [] 256 for v in views.values(): 257 (chr, start, stop) = coords.translate(v) 258 subseq = data.genome[chr][start:stop] 259 x.append(subseq) 260 261 motif_nlmsa = make_motif_search_nlmsa(data.genome, x, motifs)
