Commit 3f0439c2 authored by Anze Vavpetic's avatar Anze Vavpetic

added sdmaleph widget; updated sdmsegs viewer to use simpler result dictionary...

added sdmaleph widget; updated sdmsegs viewer to use simpler result dictionary and to use DataTable.js
parent e551939f
This diff is collapsed.
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} wants your input!">
<form id="interactionform-{{widget.pk}}" name="interactionform-{{widget.pk}}">
{% for i in intList %}
<input type="checkbox" name="intListOut" value="{{i}}" style="display:inline;width:auto;">{{i}}<br>
{% endfor %}
<input type="hidden" name="widget_id" value="{{widget.pk}}">
</form>
</div>
\ No newline at end of file
<div id="widgetvisualization-{{widget.pk}}" width="600" height="400" rel="{{widget.pk}}" class="widgetvisualizationdialog" title="{{widget.name}} results">
<div id="widget-data-table-{{widget.pk}}" style=" margin: 0 auto">
<center>
<table class="datasetTable">
<tr>
<th class="tablecellcenter">#</th>
<th class="tablecellcenter">Description</th>
<th class="tablecellcenter">Covered examples</th>
<th class="tablecellcenter">Positive examples</th>
<th class="tablecellcenter">WRAcc</th>
</tr>
{% for ex in rules.items %}
<tr class="tablerow{{widget.pk}}">
<td class='tablecellright'> {{ex.0}} </td>
<td class='tablecellleft'>
{% for e in ex.1.name %}
<p>{{e}}</p>
{% endfor %}
</td>
<td class='tablecellcenter'> {{ex.1.allGenes}} </td>
<td class='tablecellcenter'> {{ex.1.topGenes}} </td>
<td class='tablecellleft'> {{ex.1.wracc}} </td>
</tr>
{% endfor %}
<table id="sdmsegs_rules{{widget.pk}}">
<thead>
<tr>
<th>#</th>
<th>Description</th>
<th>Positive examples</th>
<th>All examples</th>
<th>WRAcc</th>
</tr>
</thead>
<tbody>
{% for rule in rules %}
<tr>
<td>{{ forloop.counter1 }}</td>
<td>
{{ rule.terms|join:", " }}
{% if rule.interacting_terms %}
<br/>INTERACTING: {{rule.interacting_terms|join:", "}}
{% endif %}
</td>
<td> {{rule.support|length}} </td>
<td> {{rule.coverage|length}} </td>
<td> {{rule.scores.wracc|floatformat:3}} </td>
</tr>
{% endfor %}
</tbody>
</table>
</center>
</div>
<script type="text/javascript">
$(function () {
$(document).ready(function() {
$('#sdmsegs_rules{{widget.pk}}').dataTable( {
"bSortCellsTop" : true,
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
} );
});
</script>
</div>
\ No newline at end of file
......@@ -2,19 +2,4 @@ from django.shortcuts import render
import json
def ilp_sdmsegs_rule_viewer(request,input_dict,output_dict,widget):
d = json.loads(input_dict['sdmsegs_rules'])
output = {}
for k, v in d['A']['WRAcc'].items():
terms = []
for t in v['terms']:
try:
terms.append(d['ontDict'][t])
except Exception, e:
pass
output[int(k)] = {
'name': terms,
'topGenes': int(len(v['topGenes'])),
'allGenes': int(len(v['allGenes'])),
'wracc': round(v['scores']['wracc'], 3)
}
return render(request, 'visualizations/sdmsegs_viewer.html',{'widget':widget,'input_dict':input_dict,'rules':output})
\ No newline at end of file
return render(request, 'visualizations/sdmsegs_viewer.html',{'widget':widget,'rules':json.loads(input_dict['sdmsegs_rules'])})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment