Changeset 289

Show
Ignore:
Timestamp:
01/31/08 18:43:05 (10 months ago)
Author:
t
Message:

added simple site soring system.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cartwheel-server/website/canal/motif/__init__.py

    r288 r289  
    1010from canal.motif import utils 
    1111from canal.motif.analyze import AnalyzeSequenceHandler 
     12from canal.motif.score_sites import ScoreSitesHandler 
    1213 
    1314from pages import _q_index, set_DNA_bias 
     
    2526from cartwheel.website.RawPWMMotif import RawPWMMotif 
    2627 
    27 _q_exports = ['delete', 'edit', 'go_analyze', 'set_DNA_bias', 
     28_q_exports = ['delete', 'edit', 'go_analyze', 'go_score', 'set_DNA_bias', 
    2829              'add_iupac_motif', 
    2930              'build_pwm_from_list', 
     
    6869    return request.redirect('./analyze%s' % (seq_id,)) 
    6970 
     71def go_score(request): 
     72    """ 
     73    Redirect to the sequence analysis handler. 
     74    """ 
     75    motif_id = request.form['motif'] 
     76    return request.redirect('./score%s' % (motif_id,)) 
     77 
    7078def _q_lookup(request, component): 
    7179    if component.startswith('analyze'): 
     
    7684 
    7785        return AnalyzeSequenceHandler(sequence) 
     86     
     87    elif component.startswith('score'): 
     88        motif_id = int(component[len('score'):]) 
     89 
     90        m = cartwheel.website.get_object_manager() 
     91        motif = m.load(motif_id) 
     92 
     93        return ScoreSitesHandler(motif) 
    7894 
    7995#### 
  • trunk/cartwheel-server/website/canal/motif/pages.ptl

    r288 r289  
    8686        (To analyze a sequence with motifs, you must first <a href='../sequences/'>enter some sequences</a>) 
    8787        """ 
    88      
     88 
     89    matrix_motifs = [ m for m in motifs if hasattr(m, 'make_pwm') ] 
     90 
     91    if matrix_motifs: 
     92        """ 
     93        <form method="POST" action="go_score"> 
     94        <b>Score sites with a matrix motif:</b> <select name='motif'> 
     95        """ 
     96 
     97        for m in matrix_motifs: 
     98            """ 
     99            <option value='%d'> %s 
     100            """ % (m.id, m.name,) 
     101         
     102        """ 
     103        </select> 
     104        <input type='submit' value='score sites'> 
     105        </form> 
     106        """ 
     107 
    89108    """ 
    90109    <b>Other actions:</b> <ul>