diff --git a/flaski/apps/main/iheatmap.py b/flaski/apps/main/iheatmap.py index ee71895d..5bf01a5b 100644 --- a/flaski/apps/main/iheatmap.py +++ b/flaski/apps/main/iheatmap.py @@ -387,6 +387,7 @@ def figure_defaults(): "xvals":"",\ "ycols":[],\ "yvals":"",\ + "available_rows":[],\ "title":'',\ "title_size":STANDARD_SIZES,\ "title_size_value":"10",\ @@ -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":"",\ @@ -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()) diff --git a/flaski/apps/routes/iheatmap.py b/flaski/apps/routes/iheatmap.py index b3a1d29d..0d6d6fcb 100644 --- a/flaski/apps/routes/iheatmap.py +++ b/flaski/apps/routes/iheatmap.py @@ -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] @@ -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 @@ -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"] diff --git a/flaski/templates/apps/iheatmap.html b/flaski/templates/apps/iheatmap.html index 5610b241..89fa8911 100644 --- a/flaski/templates/apps/iheatmap.html +++ b/flaski/templates/apps/iheatmap.html @@ -63,7 +63,7 @@