Skip to content

Commit

Permalink
aarnaeq & iheatmap working; testing write session to disk
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeboucas committed May 25, 2020
1 parent ae501f8 commit f22c906
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
10 changes: 6 additions & 4 deletions flaski/apps/main/iheatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ def make_figure(df,pa):
elif pa["zscore_value"] == "columns":
tmp=pd.DataFrame(stats.zscore(tmp, axis=0, ddof=1),columns=tmp.columns.tolist(), index=tmp.index.tolist())

if pa["findrow"]!="":
rows_to_find=pa["findrow"].split("\n")
rows_to_find=[ s.strip("\r") for s in rows_to_find ]
rows_to_find=[ s.strip(" ") for s in rows_to_find ]
if len(pa["findrow"]) > 0 :
print("Finding rows.")
rows_to_find=pa["findrow"]
# rows_to_find=pa["findrow"].split("\n")
# rows_to_find=[ s.strip("\r") for s in rows_to_find ]
# rows_to_find=[ s.strip(" ") for s in rows_to_find ]

possible_rows=tmp.index.tolist()
not_found=[ s for s in rows_to_find if s not in possible_rows ]
Expand Down
3 changes: 3 additions & 0 deletions flaski/apps/routes/aarnaseqlake.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ def aarnaseqlake(download=None):
plot_arguments["xcols"]=cols
plot_arguments["ycols"]=cols
plot_arguments["xvals"]="gene_name"
available_rows=list(set(df_ge["gene_name"].tolist()))
available_rows.sort()
plot_arguments["available_rows"]=available_rows
plot_arguments["yvals"]=[ s for s in cols if s not in ["gene_name","gene_id"] ]
plot_arguments["title"]="Heatmap"
plot_arguments["zscore_value"]="row"
Expand Down
18 changes: 9 additions & 9 deletions 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","findrow"]:
if a in ["yvals","findrow"]:
plot_arguments[a]=request.form.getlist(a)
else:
plot_arguments[a]=request.form[a]
Expand Down Expand Up @@ -247,18 +247,18 @@ def iheatmap(download=None):
df=pd.read_json(session["df"])

# CALL FIGURE FUNCTION
try:
fig, cols_cluster_numbers, index_cluster_numbers, df_=make_figure(df,plot_arguments)
#try:
fig, cols_cluster_numbers, index_cluster_numbers, df_=make_figure(df,plot_arguments)

figure_url = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
figure_url = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)

return render_template('/apps/iheatmap.html', figure_url=figure_url, filename=filename, apps=apps, **plot_arguments)
return render_template('/apps/iheatmap.html', figure_url=figure_url, filename=filename, apps=apps, **plot_arguments)

except Exception as e:
send_exception_email( user=current_user, eapp="iheatmap", emsg=e, etime=str(datetime.now()) )
flash(e,'error')
#except Exception as e:
# send_exception_email( user=current_user, eapp="iheatmap", emsg=e, etime=str(datetime.now()) )
# flash(e,'error')

return render_template('/apps/iheatmap.html', filename=filename, apps=apps, **plot_arguments)
# return render_template('/apps/iheatmap.html', filename=filename, apps=apps, **plot_arguments)

else:
if download == "download":
Expand Down
4 changes: 2 additions & 2 deletions flaski/templates/apps/iheatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ <h1 class="h3 mb-0 text-gray-800">iHeatmap</h1>

<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 class="sidebar-heading">Data columns:</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 %}
{% endfor %}
</select>
</div>
</div>
Expand Down

0 comments on commit f22c906

Please sign in to comment.