Commit e472cacb authored by Anze Vavpetic's avatar Anze Vavpetic
Browse files

nodes for querying biomine can now be selected using the rule browser.

parent 14d947eb
......@@ -21,8 +21,21 @@ def segmine_biomine_visualizer(input_dict):
def segmine_rule_browser(input_dict):
return {'node_list' : []}
def segmine_rule_browser_finished(input_dict):
return {'node_list' : []}
def segmine_rule_browser_finished(postdata, input_dict, output_dict):
rules = input_dict['rules']
widget_id = postdata.get('widget_id')[0]
selectedCell = postdata.get('selectedCell')[0]
key, _, idx = selectedCell.split('_')
node_list = []
rule = rules[int(idx)]
if key == 'terms':
terms = rule['description']['terms'] + \
rule['description']['interactingTerms']
node_list.extend([term['termID'] for term in terms])
elif key in ['coveredGenes', 'coveredTopGenes']:
genes = ['EntrezGene:%s' % gene for gene in rule[key]]
node_list.extend(genes)
return {'node_list' : node_list}
def segmine_fc_gene_filter_finished(postdata, input_dict, output_dict):
from orngBioinformatics import obiExpression as rankers
......
......@@ -6,6 +6,7 @@ import json
def recursive_asdict(d):
from suds.sudsobject import asdict
from suds.sax.text import Text
"""Convert Suds object into serializable format."""
out = {}
for k, v in asdict(d).iteritems():
......@@ -17,8 +18,12 @@ def recursive_asdict(d):
if hasattr(item, '__keylist__'):
out[k].append(recursive_asdict(item))
else:
if isinstance(item, Text):
item = str(item)
out[k].append(item)
else:
if isinstance(v, Text):
v = str(v)
out[k] = v
return out
......
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} wants your input!" width=800 height=600>
<center>
<form>
<form id="segs_rules_form{{widget.pk}}">
<table id="segs_rules{{widget.pk}}">
<thead>
<tr>
......@@ -18,19 +18,19 @@
{% for rule in rules %}
<tr>
<td>{{ forloop.counter }}</td>
<td>
<td id="terms_{{widget.pk}}_{{forloop.counter0}}" class="selectable-cell">
{% for term in rule.description.terms %}
<a data-toggle="tooltip" title="{{term.termID}}" id="{{term.termID}}">{{ term.name }}</a>{% if forloop.counter < rule.description.terms|length %},{% endif %}
<span data-toggle="tooltip" title="{{term.termID}}" id="{{term.termID}}">{{ term.name }}</span>{% if forloop.counter < rule.description.terms|length %},{% endif %}
{% endfor %}
{% if rule.description.interactingTerms %}
<br/>INTERACTING:
{% endif %}
{% for term in rule.description.interactingTerms %}
<a data-toggle="tooltip" title="{{term.termID}}" id="{{term.termID}}">{{ term.name }}</a>{% if forloop.counter < rule.description.interactingTerms|length %},{% endif %}
<span data-toggle="tooltip" title="{{term.termID}}" id="{{term.termID}}">{{ term.name }}</span>{% if forloop.counter < rule.description.interactingTerms|length %},{% endif %}
{% endfor %}
</td>
<td>{{rule.coveredTopGenes|length}}</td>
<td>{{rule.coveredGenes|length}}</td>
<td id="coveredTopGenes_{{widget.pk}}_{{forloop.counter0}}" class="selectable-cell">{{rule.coveredTopGenes|length}}</td>
<td id="coveredGenes_{{widget.pk}}_{{forloop.counter0}}" class="selectable-cell">{{rule.coveredGenes|length}}</td>
<td>{{rule.fisher_pval|floatformat:3}}</td>
<td>{{rule.GSEA_pval|floatformat:3}}</td>
<td>{{rule.PAGE_pval|floatformat:3}}</td>
......@@ -44,10 +44,15 @@
{% endfor %}
</tbody>
</table>
<input type="hidden" id="selectedCell{{widget.pk}}" name="selectedCell" value=""/>
<input type="hidden" name="widget_id" value="{{widget.pk}}"/>
</form>
</center>
</div>
<style type="text/css">
.ui-selecting { background: #eee; }
.ui-selected { background: #dde; }
</style>
<script type="text/javascript">
$(function () {
$(document).ready(function() {
......@@ -57,9 +62,14 @@
"sPaginationType": "full_numbers"
});
$('#segs_rules{{widget.pk}}').selectable({
filter: "td"
filter: ".selectable-cell"
});
});
// Check which elements are selected on submit
$('.selectable-cell').click(function() {
var id = $(this).attr('id');
$('#selectedCell{{widget.pk}}').val(id);
});
});
</script>
</div>
\ No newline at end of file
Supports Markdown
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