Commit 1d469548 authored by Anze Vavpetic's avatar Anze Vavpetic

exported sdmsegs webservice to ilp package; moved sdm segs rule viewer from...

exported sdmsegs webservice to ilp package; moved sdm segs rule viewer from workflows/library.py to the ilp package
parent 28359048
This diff is collapsed.
......@@ -39,3 +39,6 @@ def ilp_rsd(input_dict):
# Run rsd
features, arff, rules = rsd.induce(b, examples=examples, pos=pos, neg=neg, cn2sd=subgroups)
return {'features' : features, 'arff' : arff, 'rules' : rules}
def ilp_sdmsegs_rule_viewer(input_dict):
return {}
\ No newline at end of file
<div id="widgetvisualization-{{widget.pk}}" rel="{{widget.pk}}" class="widgetvisualizationdialog" title="{{widget.name}} visualization">
<div style="width:400px;font-family:monospace;">
<table style="width:auto; border-collapse:collapse;">
{% for i in input_dict.intList %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{% if forloop.first %} {% else %}+{% endif %}
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{{ i }}
</td>
</tr>
{% endfor %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px; padding-top: 4px; margin:2px;">
=
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px;margin:2px;">
{{ input_dict.sum }}
</td>
</tr>
</table>
<br/>
{{ check }}
</div>
</div>
\ No newline at end of file
......@@ -11,7 +11,7 @@
<th class="tablecellcenter">Positive examples</th>
<th class="tablecellcenter">WRAcc</th>
</tr>
{% for ex in output_dict.json_output.items %}
{% for ex in rules.items %}
<tr class="tablerow{{widget.pk}}">
<td class='tablecellright'> {{ex.0}} </td>
<td class='tablecellleft'>
......
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
......@@ -787,9 +787,6 @@ def data_table(input_dict):
def data_info(input_dict):
return {}
def sdmsegs(input_dict):
return{}
def definition_sentences(input_dict):
return {}
......
......@@ -172,26 +172,6 @@ def data_info_view(request,input_dict,output_dict,widget):
return render(request, 'visualizations/data_table_info.html',{'widget':widget,'input_dict':input_dict,'output_dict':output_dict, 'info_dict':info_dict})
def sdmsegs_viewer(request,input_dict,output_dict,widget):
import json
d = json.loads(input_dict['json'])
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)
}
output_dict = {'json_output':output}
return render(request, 'visualizations/sdmsegs_viewer.html',{'widget':widget,'input_dict':input_dict,'output_dict':output_dict})
def treeToJSON(node, path="", nodes={}):
#made by Bogdan Okresa Duric :)
......
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