Skip to content

Commit

Permalink
iheatmap: index rows
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeboucas committed May 25, 2020
1 parent 2bdabd3 commit ae501f8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
5 changes: 3 additions & 2 deletions flaski/apps/main/iheatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ def figure_defaults():
"xvals":"",\
"ycols":[],\
"yvals":"",\
"available_rows":[],\
"title":'',\
"title_size":STANDARD_SIZES,\
"title_size_value":"10",\
Expand Down Expand Up @@ -438,7 +439,7 @@ def figure_defaults():
"zscore_value":"none",\
"xaxis_font_size":"10",\
"yaxis_font_size":"10",\
"findrow":"",\
"findrow":[],\
"findrowtype":["percentile","n rows", "absolute",],\
"findrowtype_value":"n rows",\
"findrowup":"",\
Expand All @@ -458,7 +459,7 @@ def figure_defaults():
notUpdateList=["inputsessionfile"]

# lists without a default value on the arguments
excluded_list=[]
excluded_list=["available_rows","findrow"]

# lists with a default value on the arguments
allargs=list(plot_arguments.keys())
Expand Down
17 changes: 16 additions & 1 deletion flaski/apps/routes/iheatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def iheatmap(download=None):
plot_arguments = session["plot_arguments"]
for a in list(plot_arguments.keys()):
if ( a in list(request.form.keys()) ) & ( a not in list(lists.keys())+session["notUpdateList"] ):
if a == "yvals":
if a == ["yvals","findrow"]:
plot_arguments[a]=request.form.getlist(a)
else:
plot_arguments[a]=request.form[a]
Expand All @@ -162,6 +162,14 @@ def iheatmap(download=None):
if (plot_arguments[checkbox][0]!="."):
plot_arguments[checkbox]="off"

if "df" in list(session.keys()):
available_rows=pd.read_json(session["df"])
if plot_arguments["xvals"] in available_rows.columns.tolist():
available_rows=available_rows[plot_arguments["xvals"]].tolist()
available_rows=list(set(available_rows))
available_rows.sort()
plot_arguments["available_rows"]=available_rows

# UPDATE SESSION VALUES
session["plot_arguments"]=plot_arguments

Expand Down Expand Up @@ -203,6 +211,13 @@ def iheatmap(download=None):

session["plot_arguments"]["ycols"]=cols
session["plot_arguments"]["yvals"]=cols[1:]

available_rows=pd.read_json(session["df"])
if plot_arguments["xvals"] in available_rows.columns.tolist():
available_rows=available_rows[plot_arguments["xvals"]].tolist()
available_rows=list(set(available_rows))
available_rows.sort()
session["plot_arguments"]["available_rows"]=available_rows

sometext="Please select which columns should be used for plotting."
plot_arguments=session["plot_arguments"]
Expand Down
35 changes: 32 additions & 3 deletions flaski/templates/apps/iheatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ <h1 class="h3 mb-0 text-gray-800">iHeatmap</h1>
<div class="column">
<div class="sidebar-heading">Row names:</div>
<div class="input-group margin-bottom-sm" style="padding-right: 6px; padding-left: 15px; padding-bottom: 15px;" >
<select title=xcols name=xvals method="GET" action="/" style="width:365px">
<select title=xcols name=xvals method="GET" action="/" style="height:50px;width:365px">
{% for xcol in xcols %}
<option value="{{xcol}}" {% if xcol==xvals %} selected {% endif %}>{{xcol}}</option>
{% endfor %}
</select>
</div>
</div>

<div class="column">
<!--div class="column">
<div class="sidebar-heading">Data columns:</div>
<div class="input-group margin-bottom-sm" style="padding-right:6px;padding-left:15px;padding-bottom:15px;" >
<select multiple name=yvals method="GET" action="/" style="width:365px">
Expand All @@ -80,8 +80,37 @@ <h1 class="h3 mb-0 text-gray-800">iHeatmap</h1>
{% endfor %}
</select>
</div>
</div-->

<div class="row" style="padding-right:15px;padding-left:13px;padding-top:0px;padding-bottom:10px;">
<div class="column" >
<div class="sidebar-heading">Groups:</div>
<div style="padding-left:13px;">
<select name="yvals" method="GET" action="/" class="js-example-basic-multiple" multiple="multiple" tabindex="4" style="width:364px;">
{% for ycol in ycols %}
<option value="{{ycol}}" {% if ycol in yvals %} selected {% endif %}>{{ycol}}</option>
{% endfor %}
</select>
</div>
</div>
</div>

<div class="row" style="padding-right:15px;padding-left:13px;padding-top:0px;padding-bottom:10px;">
<div class="column" >
<div class="sidebar-heading">Rows:</div>
<div style="padding-left:13px;">
<select name="findrow" method="GET" action="/" class="js-example-basic-multiple" multiple="multiple" tabindex="4" style="width:364px;">
{% for available_rows_ in available_rows %}
<option value="{{available_rows_}}" {% if available_rows_ in findrow %} selected {% endif %}>{{available_rows_}}</option>
{% endfor %}
</select>
</div>
</div>
</div>

<!--label style="padding-left:0px;padding-right:8px;"> Row name(s): </label><textarea type="text" name="findrow" value='{{ findrow }}' rows="3" cols="30" style="width:200px;height:22px;padding-left:4px;">{{ findrow }}</textarea-->


<!--div class="column">
<div class="sidebar-heading" style="padding-left: 6px;">Groups:</div>
<div class="input-group margin-bottom-sm" style="padding-right: 10px; padding-left: 6px; padding-bottom: 15px;" >
Expand Down Expand Up @@ -275,7 +304,7 @@ <h1 class="h3 mb-0 text-gray-800">iHeatmap</h1>
<div class="bg-white py-2 collapse-inner rounded openmenu">
<div class="row arguments">

<label style="padding-left:0px;padding-right:8px;"> Row name(s): </label><textarea type="text" name="findrow" value='{{ findrow }}' rows="3" cols="30" style="width:200px;height:22px;padding-left:4px;">{{ findrow }}</textarea>
<!--label style="padding-left:0px;padding-right:8px;"> Row name(s): </label><textarea type="text" name="findrow" value='{{ findrow }}' rows="3" cols="30" style="width:200px;height:22px;padding-left:4px;">{{ findrow }}</textarea-->
<label style="width:263px;">Find related rows: </label>
<label style="padding-left:22px;"> bound type: <select name=findrowtype_value method="GET" action="/">
{% for findrowtype_ in findrowtype %}
Expand Down

0 comments on commit ae501f8

Please sign in to comment.