From 8f5a9ab89a77890ee620bed882fcecff63594392 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 11 Oct 2012 16:56:01 -0500 Subject: Got sample table data from the trait page sent to the export python code --- wqflask/wqflask/show_trait/export_trait_data.py | 15 + wqflask/wqflask/show_trait/show_trait.py | 243 +++- .../static/new/javascript/show_trait.coffee | 51 +- .../wqflask/static/new/javascript/show_trait.js | 49 +- wqflask/wqflask/static/new/js_external/json2.js | 1298 ++++++++++++++++++++ wqflask/wqflask/templates/new_index_page.html | 85 ++ wqflask/wqflask/templates/show_trait.html | 1 + wqflask/wqflask/views.py | 14 + 8 files changed, 1719 insertions(+), 37 deletions(-) create mode 100644 wqflask/wqflask/show_trait/export_trait_data.py create mode 100644 wqflask/wqflask/static/new/js_external/json2.js create mode 100644 wqflask/wqflask/templates/new_index_page.html diff --git a/wqflask/wqflask/show_trait/export_trait_data.py b/wqflask/wqflask/show_trait/export_trait_data.py new file mode 100644 index 00000000..7c77f1c1 --- /dev/null +++ b/wqflask/wqflask/show_trait/export_trait_data.py @@ -0,0 +1,15 @@ +from __future__ import print_function, division + +import simplejson as json + +#import xlwt +from pprint import pformat as pf + +def export_sample_table(targs): + #print("* keys0 args is:", targs[0].keys()) + + for key, item in targs.iteritems(): + print("[arrow] key is:", key) + + sample_data = json.loads(targs['json_data']) + print("sample_data is:", pf(sample_data)) \ No newline at end of file diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 9b47f658..942ce336 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -146,7 +146,7 @@ class ShowTrait(templatePage): self.make_sample_lists(fd, variance_data_page, this_trait) - + if fd.allsamplelist: hddn['allsamplelist'] = string.join(fd.allsamplelist, ' ') @@ -161,9 +161,7 @@ class ShowTrait(templatePage): self.sample_group_types['primary_only'] = fd.RISet + " Only" self.sample_group_types['other_only'] = "Non-" + fd.RISet self.sample_group_types['all_cases'] = "All Cases" - sample_lists = [] - for group in self.sample_groups: - sample_lists.append(group.sample_list) + sample_lists = [group.sample_list for group in self.sample_groups] print("sample_lists is:", pf(sample_lists)) js_data = dict(sample_group_types = self.sample_group_types, sample_lists = sample_lists, @@ -182,7 +180,7 @@ class ShowTrait(templatePage): cell_id = self.fd.get('CellID') this_trait = webqtlTrait(db=database, name=probe_set_id, cellid=cell_id, cursor=self.cursor) - + ##identification, etc. self.fd.identification = '%s : %s' % (this_trait.db.shortname, probe_set_id) this_trait.returnURL = webqtlConfig.CGIDIR + webqtlConfig.SCRIPTFILE + '?FormID=showDatabase&database=%s\ @@ -195,12 +193,14 @@ class ShowTrait(templatePage): this_trait.retrieveInfo() this_trait.retrieveData() return this_trait - + def dispTraitInformation(self, fd, title1Body, hddn, this_trait): _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) + #tbl = HT.TableLite(cellpadding=2, Class="collap", style="margin-left:20px;", width="840", valign="top", id="target1") + #reset=HT.Input(type='Reset',name='',value=' Reset ',Class="button") #XZ, August 02, 2011: The display of icons is decided by the trait type (if trait exists), along with user log-in status. Note that the new submitted trait might not be trait object. @@ -800,12 +800,9 @@ class ShowTrait(templatePage): def dispBasicStatistics(self, fd, this_trait): - #XZ, June 22, 2011: The definition and usage of primary_samples, other_samples, - #specialStrains, all_samples are not clear and hard to understand. But since they are - #only used in this function for draw graph purpose, they will not hurt the business logic - #outside. As of June 21, 2011, this function seems work fine, so no hurry to clean up. - #These parameters and code in this function should be cleaned along with fd.f1list, - #fd.parlist, fd.samplelist later. + #XZ, June 22, 2011: The definition and usage of primary_samples, other_samples, specialStrains, all_samples are not clear and hard to understand. But since they are only used in this function for draw graph purpose, they will not hurt the business logic outside. As of June 21, 2011, this function seems work fine, so no hurry to clean up. These parameters and code in this function should be cleaned along with fd.f1list, fd.parlist, fd.samplelist later. + #stats_row = HT.TR() + #stats_cell = HT.TD() if fd.genotype.type == "riset": samplelist = fd.f1list + fd.samplelist @@ -817,6 +814,7 @@ class ShowTrait(templatePage): all_samples = [] primary_samples = [] #XZ: sample of primary group, e.g., BXD, LXS + #self.MDP_menu = HT.Select(name='stats_mdp', Class='stats_mdp') self.MDP_menu = [] # We're going to use the same named data structure as in the old version # but repurpose it for Jinja2 as an array @@ -827,15 +825,10 @@ class ShowTrait(templatePage): if sample.find('F1') < 0: specialStrains.append(sample) if (this_trait.data[sampleName].value != None) and (sample not in (fd.f1list + fd.parlist)): - #XZ: at current stage, other_samples doesn't include parent samples and - #F1 samples of primary group - other_samples.append(sample) + other_samples.append(sample) #XZ: at current stage, other_samples doesn't include parent samples and F1 samples of primary group else: if (this_trait.data[sampleName].value != None) and (sample not in (fd.f1list + fd.parlist)): - #XZ: at current stage, the primary_samples is the same as fd.samplelist - #ZS: I tried defining primary_samples as fd.samplelist instead, but in some - #cases it ended up including the parent samples (1436869_at BXD) - primary_samples.append(sample) + primary_samples.append(sample) #XZ: at current stage, the primary_samples is the same as fd.samplelist / ZS: I tried defining primary_samples as fd.samplelist instead, but in some cases it ended up including the parent samples (1436869_at BXD) if len(other_samples) > 3: other_samples.sort(key=webqtlUtil.natsort_key) @@ -843,6 +836,7 @@ class ShowTrait(templatePage): primary_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + primary_samples #XZ: note that fd.f1list and fd.parlist are added. all_samples = primary_samples + other_samples other_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + other_samples #XZ: note that fd.f1list and fd.parlist are added. + print("ac1") # This is the one used for first sall3 self.MDP_menu.append(('All Cases','0')) self.MDP_menu.append(('%s Only' % fd.RISet, '1')) self.MDP_menu.append(('Non-%s Only' % fd.RISet, '2')) @@ -858,6 +852,7 @@ class ShowTrait(templatePage): all_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + all_samples primary_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + primary_samples else: + print("ac3") all_samples = samplelist other_samples.sort(key=webqtlUtil.natsort_key) @@ -891,6 +886,13 @@ class ShowTrait(templatePage): # continue vals1.append(thisValFull) + + + #vals1 = [[sampleNameOrig.replace("_2nd_", ""), + # this_trait.data[sampleName].val, + # this_trait.data[sampleName].var] + # for sampleNameOrig in all_samples]] + # #Using just the RISet sample for sampleNameOrig in primary_samples: @@ -943,21 +945,29 @@ class ShowTrait(templatePage): if i == 0 and len(vals) < 4: stats_container = HT.Div(id="stats_tabs", style="padding:10px;", Class="ui-tabs") #Needed for tabs; notice the "stats_script_text" below referring to this element stats_container.append(HT.Div(HT.Italic("Fewer than 4 case data were entered. No statistical analysis has been attempted."))) - stats_script_text = """$(function() { $("#stats_tabs").tabs();});""" + #stats_script_text = """$(function() { $("#stats_tabs").tabs();});""" + #stats_cell.append(stats_container) break elif (i == 1 and len(primary_samples) < 4): stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs") - stats_container.append(HT.Div(HT.Italic("Fewer than 4 " + fd.RISet + " case data were entered. No statistical analysis has been attempted."))) + #stats_container.append(HT.Div(HT.Italic("Fewer than 4 " + fd.RISet + " case data were entered. No statistical analysis has been attempted."))) elif (i == 2 and len(other_samples) < 4): stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs") stats_container.append(HT.Div(HT.Italic("Fewer than 4 non-" + fd.RISet + " case data were entered. No statistical analysis has been attempted."))) - stats_script_text = """$(function() { $("#stats_tabs0").tabs(); $("#stats_tabs1").tabs(); $("#stats_tabs2").tabs();});""" + #stats_script_text = """$(function() { $("#stats_tabs0").tabs(); $("#stats_tabs1").tabs(); $("#stats_tabs2").tabs();});""" else: - stats_script_text = """$(function() { $("#stats_tabs0").tabs(); $("#stats_tabs1").tabs(); $("#stats_tabs2").tabs();});""" + continue if len(vals) > 4: stats_tab_list = [HT.Href(text="Basic Table", url="#statstabs-1", Class="stats_tab"),HT.Href(text="Probability Plot", url="#statstabs-5", Class="stats_tab"), HT.Href(text="Bar Graph (by name)", url="#statstabs-3", Class="stats_tab"), HT.Href(text="Bar Graph (by rank)", url="#statstabs-4", Class="stats_tab"), HT.Href(text="Box Plot", url="#statstabs-2", Class="stats_tab")] + #stats_tabs = HT.List(stats_tab_list) + #stats_container.append(stats_tabs) + # + #table_div = HT.Div(id="statstabs-1") + #table_container = HT.Paragraph() + # + #statsTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") if this_trait.db: if this_trait.cellid: @@ -967,6 +977,16 @@ class ShowTrait(templatePage): else: self.stats_data.append(BasicStatisticsFunctions.basicStatsTable(vals=vals)) + #statsTable.append(HT.TR(HT.TD(statsTableCell))) + + #table_container.append(statsTable) + #table_div.append(table_container) + #stats_container.append(table_div) + # + #normalplot_div = HT.Div(id="statstabs-5") + #normalplot_container = HT.Paragraph() + #normalplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + try: plotTitle = this_trait.symbol plotTitle += ": " @@ -983,7 +1003,7 @@ class ShowTrait(templatePage): #normalplot_container.append(normalplot) #normalplot_div.append(normalplot_container) #stats_container.append(normalplot_div) - + #boxplot_div = HT.Div(id="statstabs-2") #boxplot_container = HT.Paragraph() #boxplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") @@ -992,8 +1012,8 @@ class ShowTrait(templatePage): #boxplot_container.append(boxplot) #boxplot_div.append(boxplot_container) #stats_container.append(boxplot_div) - - + + #barName_div = HT.Div(id="statstabs-3") #barName_container = HT.Paragraph() #barName = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") @@ -1011,6 +1031,18 @@ class ShowTrait(templatePage): #barRank_container.append(barRank) #barRank_div.append(barRank_container) #stats_container.append(barRank_div) + + # stats_cell.append(stats_container) + # + #stats_script.append(stats_script_text) + # + #submitTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%", Class="target2") + #stats_row.append(stats_cell) + + #submitTable.append(stats_row) + #submitTable.append(stats_script) + + #title2Body.append(submitTable) def build_correlation_tools(self, fd, this_trait): @@ -1018,13 +1050,23 @@ class ShowTrait(templatePage): #species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) RISetgp = fd.RISet - + # We're checking a string here! assert isinstance(RISetgp, basestring), "We need a string type thing here" if RISetgp[:3] == 'BXD': RISetgp = 'BXD' if RISetgp: + #sample_correlation = HT.Input(type='button',name='sample_corr', value=' Compute ', Class="button sample_corr") + #lit_correlation = HT.Input(type='button',name='lit_corr', value=' Compute ', Class="button lit_corr") + #tissue_correlation = HT.Input(type='button',name='tiss_corr', value=' Compute ', Class="button tiss_corr") + #methodText = HT.Span("Calculate:", Class="ffl fwb fs12") + # + #databaseText = HT.Span("Database:", Class="ffl fwb fs12") + #databaseMenu1 = HT.Select(name='database1') + #databaseMenu2 = HT.Select(name='database2') + #databaseMenu3 = HT.Select(name='database3') + dataset_menu = [] print("[tape4] webqtlConfig.PUBLICTHRESH:", webqtlConfig.PUBLICTHRESH) print("[tape4] type webqtlConfig.PUBLICTHRESH:", type(webqtlConfig.PUBLICTHRESH)) @@ -1048,24 +1090,164 @@ class ShowTrait(templatePage): self.cursor.execute('SELECT Id, Name FROM Tissue order by Name') for item in self.cursor.fetchall(): tissue_id, tissue_name = item + #databaseMenuSub = HT.Optgroup(label = '%s ------' % tissue_name) + #dataset_sub_menu = [] + print("phun9") self.cursor.execute('''SELECT ProbeSetFreeze.FullName,ProbeSetFreeze.Name FROM ProbeSetFreeze, ProbeFreeze, InbredSet WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and ProbeFreeze.TissueId = %s and ProbeSetFreeze.public > %s and ProbeFreeze.InbredSetId = InbredSet.Id and InbredSet.Name like %s order by ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId ''', (tissue_id, webqtlConfig.PUBLICTHRESH, "%" + RISetgp + "%")) + print("phun8") dataset_sub_menu = [item for item in self.cursor.fetchall() if item] + #for item2 in self.cursor.fetchall(): + # dataset_sub_menu.append(item2) if dataset_sub_menu: dataset_menu.append(dict(tissue=tissue_name, datasets=dataset_sub_menu)) - + # ("**heading**", tissue_name)) + #dataset_menu.append(dataset_sub_menu) + dataset_menu_selected = None if len(dataset_menu): if this_trait and this_trait.db: dataset_menu_selected = this_trait.db.name + #criteriaText = HT.Span("Return:", Class="ffl fwb fs12") + + #criteriaMenu1 = HT.Select(name='criteria1', selected='500', onMouseOver="if (NS4 || IE4) activateEl('criterias', event);") + return_results_menu = (100, 200, 500, 1000, 2000, 5000, 10000, 15000, 20000) return_results_menu_selected = 500 + + #criteriaMenu1.append(('top 100','100')) + #criteriaMenu1.append(('top 200','200')) + #criteriaMenu1.append(('top 500','500')) + #criteriaMenu1.append(('top 1000','1000')) + #criteriaMenu1.append(('top 2000','2000')) + #criteriaMenu1.append(('top 5000','5000')) + #criteriaMenu1.append(('top 10000','10000')) + #criteriaMenu1.append(('top 15000','15000')) + #criteriaMenu1.append(('top 20000','20000')) + + #self.MDPRow1 = HT.TR(Class='mdp1') + #self.MDPRow2 = HT.TR(Class='mdp2') + #self.MDPRow3 = HT.TR(Class='mdp3') + + # correlationMenus1 = HT.TableLite( + # HT.TR(HT.TD(databaseText), HT.TD(databaseMenu1, colspan="3")), + # HT.TR(HT.TD(criteriaText), HT.TD(criteriaMenu1)), + # self.MDPRow1, cellspacing=0, width="619px", cellpadding=2) + # correlationMenus1.append(HT.Input(name='orderBy', value='2', type='hidden')) # to replace the orderBy menu + # correlationMenus2 = HT.TableLite( + # HT.TR(HT.TD(databaseText), HT.TD(databaseMenu2, colspan="3")), + # HT.TR(HT.TD(criteriaText), HT.TD(criteriaMenu2)), + # self.MDPRow2, cellspacing=0, width="619px", cellpadding=2) + # correlationMenus2.append(HT.Input(name='orderBy', value='2', type='hidden')) + # correlationMenus3 = HT.TableLite( + # HT.TR(HT.TD(databaseText), HT.TD(databaseMenu3, colspan="3")), + # HT.TR(HT.TD(criteriaText), HT.TD(criteriaMenu3)), + # self.MDPRow3, cellspacing=0, width="619px", cellpadding=2) + # correlationMenus3.append(HT.Input(name='orderBy', value='2', type='hidden')) + # + #else: + # correlationMenus = "" + + #corr_row = HT.TR() + #corr_container = HT.Div(id="corr_tabs", Class="ui-tabs") + # + #if (this_trait.db != None and this_trait.db.type =='ProbeSet'): + # corr_tab_list = [HT.Href(text='Sample r', url="#corrtabs-1"), + # HT.Href(text='Literature r', url="#corrtabs-2"), + # HT.Href(text='Tissue r', url="#corrtabs-3")] + #else: + # corr_tab_list = [HT.Href(text='Sample r', url="#corrtabs-1")] + # + #corr_tabs = HT.List(corr_tab_list) + #corr_container.append(corr_tabs) + + #if correlationMenus1 or correlationMenus2 or correlationMenus3: + #sample_div = HT.Div(id="corrtabs-1") + #sample_container = HT.Span() + # + #sample_type = HT.Input(type="radio", name="sample_method", value="1", checked="checked") + #sample_type2 = HT.Input(type="radio", name="sample_method", value="2") + # + #sampleTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + #sampleTD = HT.TD(correlationMenus1, HT.BR(), + # "Pearson", sample_type, " "*3, "Spearman Rank", sample_type2, HT.BR(), HT.BR(), + # sample_correlation, HT.BR(), HT.BR()) + # + #sampleTD.append(HT.Span("The ", + # HT.Href(url="/correlationAnnotation.html#sample_r", target="_blank", + # text="Sample Correlation")," is computed between trait data and", + # " any ",HT.BR()," other traits in the sample database selected above. Use ", + # HT.Href(url="/glossary.html#Correlations", target="_blank", text="Spearman Rank"), + # HT.BR(),"when the sample size is small (<20) or when there are influential \ + # outliers.", HT.BR(),Class="fs12")) + + #sampleTable.append(sampleTD) + + #sample_container.append(sampleTable) + #sample_div.append(sample_container) + #corr_container.append(sample_div) + # + #literature_div = HT.Div(id="corrtabs-2") + #literature_container = HT.Span() + + #literatureTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + #literatureTD = HT.TD(correlationMenus2,HT.BR(),lit_correlation, HT.BR(), HT.BR()) + #literatureTD.append(HT.Span("The ", HT.Href(url="/correlationAnnotation.html", target="_blank",text="Literature Correlation"), " (Lit r) between this gene and all other genes is computed",HT.BR(), + # "using the ", HT.Href(url="https://grits.eecs.utk.edu/sgo/sgo.html", target="_blank", text="Semantic Gene Organizer"), + # " and human, rat, and mouse data from PubMed. ", HT.BR(),"Values are ranked by Lit r, \ + # but Sample r and Tissue r are also displayed.", HT.BR(), HT.BR(), + # HT.Href(url="/glossary.html#Literature", target="_blank", text="More on using Lit r"), Class="fs12")) + #literatureTable.append(literatureTD) + # + #literature_container.append(literatureTable) + #literature_div.append(literature_container) + # + #if this_trait.db != None: + # if (this_trait.db.type =='ProbeSet'): + # corr_container.append(literature_div) + # + #tissue_div = HT.Div(id="corrtabs-3") + #tissue_container = HT.Span() + # + #tissue_type = HT.Input(type="radio", name="tissue_method", value="4", checked="checked") + #tissue_type2 = HT.Input(type="radio", name="tissue_method", value="5") + # + #tissueTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + #tissueTD = HT.TD(correlationMenus3,HT.BR(), + # "Pearson", tissue_type, " "*3, "Spearman Rank", tissue_type2, HT.BR(), HT.BR(), + # tissue_correlation, HT.BR(), HT.BR()) + #tissueTD.append(HT.Span("The ", HT.Href(url="/webqtl/main.py?FormID=tissueCorrelation", target="_blank", text="Tissue Correlation"), + #" (Tissue r) estimates the similarity of expression of two genes",HT.BR()," or \ + #transcripts across different cells, tissues, or organs (",HT.Href(url="/correlationAnnotation.html#tissue_r", target="_blank", text="glossary"),"). \ + #Tissue correlations",HT.BR()," are generated by analyzing expression in multiple samples usually taken from \ + #single cases.",HT.BR(),HT.Bold("Pearson")," and ",HT.Bold("Spearman Rank")," correlations have been computed for all pairs \ + #of genes",HT.BR()," using data from mouse samples.", + #HT.BR(), Class="fs12")) + #tissueTable.append(tissueTD) + # + #tissue_container.append(tissueTable) + #tissue_div.append(tissue_container) + #if this_trait.db != None: + # if (this_trait.db.type =='ProbeSet'): + # corr_container.append(tissue_div) + # + #corr_row.append(HT.TD(corr_container)) + # + #corr_script = HT.Script(language="Javascript") + #corr_script_text = """$(function() { $("#corr_tabs").tabs(); });""" + #corr_script.append(corr_script_text) + # + #submitTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%", Class="target4") + #submitTable.append(corr_row) + #submitTable.append(corr_script) + # + #title3Body.append(submitTable) self.corr_tools = dict(dataset_menu = dataset_menu, dataset_menu_selected = dataset_menu_selected, return_results_menu = return_results_menu, @@ -1344,7 +1526,7 @@ class ShowTrait(templatePage): this_trait=this_trait, sample_group_type='primary', header="%s Only" % (fd.RISet)) - + print("primary_samples.attributes:", pf(primary_samples.attributes)) other_sample_names = [] @@ -1368,7 +1550,7 @@ class ShowTrait(templatePage): this_trait=this_trait, sample_group_type='other', header="Non-%s" % (fd.RISet)) - + self.sample_groups = (primary_samples, other_samples) else: self.sample_groups = (primary_samples,) @@ -1376,4 +1558,5 @@ class ShowTrait(templatePage): #TODO: Figure out why this if statement is written this way - Zach #if (other_sample_names or (fd.f1list and this_trait.data.has_key(fd.f1list[0])) # or (fd.f1list and this_trait.data.has_key(fd.f1list[1]))): + # print("hjs") fd.allsamplelist = all_samples_ordered diff --git a/wqflask/wqflask/static/new/javascript/show_trait.coffee b/wqflask/wqflask/static/new/javascript/show_trait.coffee index a22a3beb..a89b29af 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait.coffee @@ -244,7 +244,7 @@ $ -> ##Hide Sample Rows With No Value (value of 'x') Code hide_no_value = -> - $('.value_se').each (index, element) => + $('.value_se').each (_index, element) => if $(element).find('.trait_value_input').val() == 'x' $(element).hide() @@ -254,7 +254,7 @@ $ -> ##Block Outliers Code block_outliers = -> - $('.outlier').each (index, element) => + $('.outlier').each (_index, element) => $(element).find('.trait_value_input').val('x') $('#block_outliers').click(block_outliers) @@ -263,7 +263,7 @@ $ -> ##Reset Table Values Code reset_samples_table = -> - $('.trait_value_input').each (index, element) => + $('.trait_value_input').each (_index, element) => console.log("value is:", $(element).val()) $(element).val($(element).data('value')) console.log("data-value is:", $(element).data('value')) @@ -272,6 +272,51 @@ $ -> $('#reset').click(reset_samples_table) ##End Reset Table Values Code + + ##Get Sample Data From Table Code + + get_sample_table_data = -> + samples = {} + primary_samples = [] + other_samples = [] + $('#sortable1').find('.value_se').each (_index, element) => + row_data = {} + row_data.name = $.trim($(element).find('.column_name-Sample').text()) + row_data.value = $(element).find('.edit_sample_value').val() + if $(element).find('.edit_sample_se').length != -1 + row_data.se = $(element).find('.edit_sample_se').val() + for own key, attribute_info of js_data.attribute_names + row_data[attribute_info.name] = $.trim($(element).find( + '.column_name-'+attribute_info.name.replace(" ", "_")).text()) + console.log("row_data is:", row_data) + primary_samples.push(row_data) + console.log("primary_samples is:", primary_samples) + samples.primary_samples = primary_samples + samples.other_samples = other_samples + return samples + + + export_sample_table_data = -> + sample_data = get_sample_table_data() + console.log("sample_data is:", sample_data) + json_sample_data = JSON.stringify(sample_data) + console.log("json_sample_data is:", json_sample_data) + $.ajax( + url: '/export_trait_data' + type: 'POST' + data: "json_data=" + json_sample_data + ) + + $('#export').click(export_sample_table_data) + + + + ##End Get Sample Data from Table Code + + ##Export Sample Table Data Code + + ##End Export Sample Table Data Code + console.log("before registering block_outliers") $('#block_outliers').click(block_outliers) diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index d6c5226f..e4f477f3 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -11,7 +11,7 @@ }; $(function() { - var block_by_attribute_value, block_by_index, block_outliers, change_stats_value, create_value_dropdown, edit_data_change, hide_no_value, hide_tabs, make_table, on_corr_method_change, populate_sample_attributes_values_dropdown, process_id, reset_samples_table, show_hide_outliers, stats_mdp_change, update_stat_values; + var block_by_attribute_value, block_by_index, block_outliers, change_stats_value, create_value_dropdown, edit_data_change, export_sample_table_data, get_sample_table_data, hide_no_value, hide_tabs, make_table, on_corr_method_change, populate_sample_attributes_values_dropdown, process_id, reset_samples_table, show_hide_outliers, stats_mdp_change, update_stat_values; hide_tabs = function(start) { var x, _i, _results; _results = []; @@ -281,7 +281,7 @@ $('#block_by_index').click(block_by_index); hide_no_value = function() { var _this = this; - return $('.value_se').each(function(index, element) { + return $('.value_se').each(function(_index, element) { if ($(element).find('.trait_value_input').val() === 'x') { return $(element).hide(); } @@ -290,14 +290,14 @@ $('#hide_no_value').click(hide_no_value); block_outliers = function() { var _this = this; - return $('.outlier').each(function(index, element) { + return $('.outlier').each(function(_index, element) { return $(element).find('.trait_value_input').val('x'); }); }; $('#block_outliers').click(block_outliers); reset_samples_table = function() { var _this = this; - return $('.trait_value_input').each(function(index, element) { + return $('.trait_value_input').each(function(_index, element) { console.log("value is:", $(element).val()); $(element).val($(element).data('value')); console.log("data-value is:", $(element).data('value')); @@ -305,6 +305,47 @@ }); }; $('#reset').click(reset_samples_table); + get_sample_table_data = function() { + var other_samples, primary_samples, samples, + _this = this; + samples = {}; + primary_samples = []; + other_samples = []; + $('#sortable1').find('.value_se').each(function(_index, element) { + var attribute_info, key, row_data, _ref; + row_data = {}; + row_data.name = $.trim($(element).find('.column_name-Sample').text()); + row_data.value = $(element).find('.edit_sample_value').val(); + if ($(element).find('.edit_sample_se').length !== -1) { + row_data.se = $(element).find('.edit_sample_se').val(); + } + _ref = js_data.attribute_names; + for (key in _ref) { + if (!__hasProp.call(_ref, key)) continue; + attribute_info = _ref[key]; + row_data[attribute_info.name] = $.trim($(element).find('.column_name-' + attribute_info.name.replace(" ", "_")).text()); + } + console.log("row_data is:", row_data); + return primary_samples.push(row_data); + }); + console.log("primary_samples is:", primary_samples); + samples.primary_samples = primary_samples; + samples.other_samples = other_samples; + return samples; + }; + export_sample_table_data = function() { + var json_sample_data, sample_data; + sample_data = get_sample_table_data(); + console.log("sample_data is:", sample_data); + json_sample_data = JSON.stringify(sample_data); + console.log("json_sample_data is:", json_sample_data); + return $.ajax({ + url: '/export_trait_data', + type: 'POST', + data: "json_data=" + json_sample_data + }); + }; + $('#export').click(export_sample_table_data); console.log("before registering block_outliers"); $('#block_outliers').click(block_outliers); console.log("after registering block_outliers"); diff --git a/wqflask/wqflask/static/new/js_external/json2.js b/wqflask/wqflask/static/new/js_external/json2.js new file mode 100644 index 00000000..2373c74d --- /dev/null +++ b/wqflask/wqflask/static/new/js_external/json2.js @@ -0,0 +1,1298 @@ + + + + + + + + + JSON-js/json2.js at master · douglascrockford/JSON-js · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+ +
+
+
+ + + + + +

+ public + + + / + JSON-js +

+
+ + + + + + + + + + +
+ + + + + + +
+ +
+ + branch: master + + +
+ +
Switch branches/tags
+
+
+ + +
+ +
+
Nothing to show
+
+ +

+ master +

+
+
+ + +
+
+
+
+ + + +
+ + + + + + + +
+
+ +
+ + + + + + + + +
+ + + + +
+ + douglascrockford + + + + + +
+ + +
+
+ +
+
+
+
+ + file + 487 lines (369 sloc) + 17.53 kb +
+ +
+
+ + + + + +
+
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+
+
+
/*
json2.js
2012-10-08

Public Domain.

NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

See http://www.JSON.org/js.html


This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html

USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.


This file creates a global JSON object containing two methods: stringify
and parse.

JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.

replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.

space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or '&nbsp;'),
it contains the characters used to indent at each level.

This method produces a JSON text from a JavaScript value.

When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value

For example, this would serialize Dates as ISO strings.

Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}

return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};

You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.

If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.

Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.

The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.

If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.

Example:

text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'


text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'


JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.

The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.

Example:

// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.

myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});

myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});


This is a reference implementation. You are free to copy, modify, or
redistribute.
*/

/*jslint evil: true, regexp: true */

/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/


// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.

if (typeof JSON !== 'object') {
    JSON = {};
}

(function () {
    'use strict';

    function f(n) {
        // Format integers to have at least two digits.
        return n < 10 ? '0' + n : n;
    }

    if (typeof Date.prototype.toJSON !== 'function') {

        Date.prototype.toJSON = function (key) {

            return isFinite(this.valueOf())
                ? this.getUTCFullYear() + '-' +
                    f(this.getUTCMonth() + 1) + '-' +
                    f(this.getUTCDate()) + 'T' +
                    f(this.getUTCHours()) + ':' +
                    f(this.getUTCMinutes()) + ':' +
                    f(this.getUTCSeconds()) + 'Z'
                : null;
        };

        String.prototype.toJSON =
            Number.prototype.toJSON =
            Boolean.prototype.toJSON = function (key) {
                return this.valueOf();
            };
    }

    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        gap,
        indent,
        meta = { // table of character substitutions
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        rep;


    function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

        escapable.lastIndex = 0;
        return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
            var c = meta[a];
            return typeof c === 'string'
                ? c
                : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
        }) + '"' : '"' + string + '"';
    }


    function str(key, holder) {

// Produce a string from holder[key].

        var i, // The loop counter.
            k, // The member key.
            v, // The member value.
            length,
            mind = gap,
            partial,
            value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

        if (value && typeof value === 'object' &&
                typeof value.toJSON === 'function') {
            value = value.toJSON(key);
        }

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

        if (typeof rep === 'function') {
            value = rep.call(holder, key, value);
        }

// What happens next depends on the value's type.

        switch (typeof value) {
        case 'string':
            return quote(value);

        case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

            return isFinite(value) ? String(value) : 'null';

        case 'boolean':
        case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

            return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

        case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

            if (!value) {
                return 'null';
            }

// Make an array to hold the partial results of stringifying this object value.

            gap += indent;
            partial = [];

// Is the value an array?

            if (Object.prototype.toString.apply(value) === '[object Array]') {

// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

                length = value.length;
                for (i = 0; i < length; i += 1) {
                    partial[i] = str(i, value) || 'null';
                }

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

                v = partial.length === 0
                    ? '[]'
                    : gap
                    ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
                    : '[' + partial.join(',') + ']';
                gap = mind;
                return v;
            }

// If the replacer is an array, use it to select the members to be stringified.

            if (rep && typeof rep === 'object') {
                length = rep.length;
                for (i = 0; i < length; i += 1) {
                    if (typeof rep[i] === 'string') {
                        k = rep[i];
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            } else {

// Otherwise, iterate through all of the keys in the object.

                for (k in value) {
                    if (Object.prototype.hasOwnProperty.call(value, k)) {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            }

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

            v = partial.length === 0
                ? '{}'
                : gap
                ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
                : '{' + partial.join(',') + '}';
            gap = mind;
            return v;
        }
    }

// If the JSON object does not yet have a stringify method, give it one.

    if (typeof JSON.stringify !== 'function') {
        JSON.stringify = function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

            var i;
            gap = '';
            indent = '';

// If the space parameter is a number, make an indent string containing that
// many spaces.

            if (typeof space === 'number') {
                for (i = 0; i < space; i += 1) {
                    indent += ' ';
                }

// If the space parameter is a string, it will be used as the indent string.

            } else if (typeof space === 'string') {
                indent = space;
            }

// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.

            rep = replacer;
            if (replacer && typeof replacer !== 'function' &&
                    (typeof replacer !== 'object' ||
                    typeof replacer.length !== 'number')) {
                throw new Error('JSON.stringify');
            }

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

            return str('', {'': value});
        };
    }


// If the JSON object does not yet have a parse method, give it one.

    if (typeof JSON.parse !== 'function') {
        JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

            var j;

            function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

                var k, v, value = holder[key];
                if (value && typeof value === 'object') {
                    for (k in value) {
                        if (Object.prototype.hasOwnProperty.call(value, k)) {
                            v = walk(value, k);
                            if (v !== undefined) {
                                value[k] = v;
                            } else {
                                delete value[k];
                            }
                        }
                    }
                }
                return reviver.call(holder, key, value);
            }


// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.

            text = String(text);
            cx.lastIndex = 0;
            if (cx.test(text)) {
                text = text.replace(cx, function (a) {
                    return '\\u' +
                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
                });
            }

// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.

// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

            if (/^[\],:{}\s]*$/
                    .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
                        .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
                        .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

                j = eval('(' + text + ')');

// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

                return typeof reviver === 'function'
                    ? walk({'': j}, '')
                    : j;
            }

// If the text is not JSON parseable, then a SyntaxError is thrown.

            throw new SyntaxError('JSON.parse');
        };
    }
}());
+
+
+ +
+
+
+
+ +
+ + + +
+
+
+
+ + +
+ + + + + + + + +
+

Markdown Cheat Sheet

+ +
+ +
+
+

Format Text

+

Headers

+
+# This is an <h1> tag
+## This is an <h2> tag
+###### This is an <h6> tag
+

Text styles

+
+*This text will be italic*
+_This will also be italic_
+**This text will be bold**
+__This will also be bold__
+
+*You **can** combine them*
+
+
+
+

Lists

+

Unordered

+
+* Item 1
+* Item 2
+  * Item 2a
+  * Item 2b
+

Ordered

+
+1. Item 1
+2. Item 2
+3. Item 3
+   * Item 3a
+   * Item 3b
+
+
+

Miscellaneous

+

Images

+
+![GitHub Logo](/images/logo.png)
+Format: ![Alt Text](url)
+
+

Links

+
+http://github.com - automatic!
+[GitHub](http://github.com)
+

Blockquotes

+
+As Kanye West said:
+
+> We're living the future so
+> the present is our past.
+
+
+
+
+ +

Code Examples in Markdown

+
+

Syntax highlighting with GFM

+
+```javascript
+function fancyAlert(arg) {
+  if(arg) {
+    $.facebox({div:'#foo'})
+  }
+}
+```
+
+
+

Or, indent your code 4 spaces

+
+Here is a Python code example
+without syntax highlighting:
+
+    def foo:
+      if not bar:
+        return true
+
+
+

Inline code for comments

+
+I think you should use an
+`<addr>` element here instead.
+
+
+ +
+ + + +
+ + Something went wrong with that request. Please try again. + +
+ +
+

Looking for the GitHub logo?

+ +
+ + + + + + + + diff --git a/wqflask/wqflask/templates/new_index_page.html b/wqflask/wqflask/templates/new_index_page.html new file mode 100644 index 00000000..46839690 --- /dev/null +++ b/wqflask/wqflask/templates/new_index_page.html @@ -0,0 +1,85 @@ + + + GeneNetwork + + + + + + + + + +
+

Select and Search

+ + +
+ + diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index a20017da..1e1d8b8f 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -1378,6 +1378,7 @@ + diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 82a08c71..7210a1de 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -11,6 +11,7 @@ from flask import render_template, request from wqflask import search_results from wqflask.show_trait import show_trait +from wqflask.show_trait import export_trait_data from wqflask.correlation import CorrelationPage from wqflask.dataSharing import SharingInfo, SharingInfoPage @@ -26,6 +27,11 @@ def index_page(): return render_template("index_page.html") +@app.route("/new") +def new_index_page(): + print("Sending index_page") + return render_template("new_index_page.html") + @app.route("/data_sharing") def data_sharing_page(): print("In data_sharing") @@ -81,6 +87,14 @@ def show_trait_page(): print("show_trait template_vars:", pf(template_vars.__dict__)) return render_template("show_trait.html", **template_vars.__dict__) +@app.route("/export_trait_data", methods=('POST',)) +def export_sample_table(): + """CSV file consisting of the sample data from the trait data and analysis page""" + print("In export_sample_table") + print("request.args:", request.args) + print("request.form:", request.form) + template_vars = export_trait_data.export_sample_table(request.form) + @app.route("/corr_compute", methods=('POST',)) def corr_compute_page(): -- cgit 1.4.1