From 8c67741cc0aacd519e793b81649ff872708c9539 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 27 Mar 2019 16:18:25 -0500 Subject: Changed gen_select_dataset.py to be able to show multiple datasets under the Phenotype type (for example the GI Tract Metabolome data) Fixed issue where full description was given for some unpublished traits Fixed code related to editing certain pages (like news) with CKEditor, but it still won't work until the CKEditor library is included in GUIX or something --- wqflask/maintenance/gen_select_dataset.py | 36 +-- wqflask/wqflask/docs.py | 11 + wqflask/wqflask/gsearch.py | 2 +- wqflask/wqflask/static/new/images/edit.gif | Bin 0 -> 157 bytes .../new/javascript/dataset_menu_structure.json | 286 ++++++++------------- wqflask/wqflask/templates/docedit.html | 6 +- wqflask/wqflask/templates/docs.html | 2 +- wqflask/wqflask/templates/news.html | 2 +- wqflask/wqflask/views.py | 17 +- 9 files changed, 161 insertions(+), 201 deletions(-) create mode 100644 wqflask/wqflask/static/new/images/edit.gif diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py index 4ad921a2..48849c8d 100644 --- a/wqflask/maintenance/gen_select_dataset.py +++ b/wqflask/maintenance/gen_select_dataset.py @@ -200,26 +200,31 @@ def get_datasets(types): def build_datasets(species, group, type_name): """Gets dataset names from database""" dataset_text = dataset_value = None + datasets = [] if type_name == "Phenotypes": - print("GROUP:", group) - Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where + Cursor.execute("""select InfoFiles.GN_AccesionId, PublishFreeze.Name, PublishFreeze.FullName from InfoFiles, PublishFreeze, InbredSet where InbredSet.Name = '%s' and PublishFreeze.InbredSetId = InbredSet.Id and - InfoFiles.InfoPageName = PublishFreeze.Name and - PublishFreeze.public > 0 and - PublishFreeze.confidentiality < 1 order by - PublishFreeze.CreateTime desc""" % group) + InfoFiles.InfoPageName = PublishFreeze.Name order by + PublishFreeze.CreateTime asc""" % group) - results = Cursor.fetchone() + results = Cursor.fetchall() if results != None: - dataset_id = str(results[0]) + for result in results: + print(result) + dataset_id = str(result[0]) + dataset_value = str(result[1]) + if group == 'MDP': + dataset_text = "Mouse Phenome Database" + else: + #dataset_text = "%s Phenotypes" % group + dataset_text = str(result[2]) + datasets.append((dataset_id, dataset_value, dataset_text)) else: dataset_id = "None" - dataset_value = "%sPublish" % group - if group == 'MDP': - dataset_text = "Mouse Phenome Database" - else: + dataset_value = "%sPublish" % group dataset_text = "%s Phenotypes" % group + datasets.append((dataset_id, dataset_value, dataset_text)) elif type_name == "Genotypes": Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, GenoFreeze, InbredSet where @@ -237,10 +242,9 @@ def build_datasets(species, group, type_name): dataset_id = "None" dataset_value = "%sGeno" % group dataset_text = "%s Genotypes" % group + datasets.append((dataset_id, dataset_value, dataset_text)) - if dataset_value: - return [(dataset_id, dataset_value, dataset_text)] - else: + else: # for mRNA expression/ProbeSet Cursor.execute("""select ProbeSetFreeze.Id, ProbeSetFreeze.Name, ProbeSetFreeze.FullName from ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue, Species where Species.Name = '%s' and Species.Id = InbredSet.SpeciesId and @@ -258,7 +262,7 @@ def build_datasets(species, group, type_name): this_dataset_info.append(str(info)) datasets.append(this_dataset_info) - return datasets + return datasets def main(): diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index a8363a1f..9777f170 100644 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -2,6 +2,9 @@ from __future__ import absolute_import, print_function, division from flask import g +from utility.logger import getLogger +logger = getLogger(__name__) + class Docs(object): def __init__(self, entry): @@ -14,3 +17,11 @@ class Docs(object): self.entry = entry self.title = result[0] self.content = result[1] + +def update_text(start_vars): + content = start_vars['ckcontent'] + content = content.replace('%', '%%').replace('"', '\\"').replace("'", "\\'") + + sql = "UPDATE Docs SET content='{0}' WHERE entry='{1}';".format(content, start_vars['entry_type']) + + g.db.execute(sql) \ No newline at end of file diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 357f989d..2a643d19 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -142,7 +142,7 @@ class GSearch(object): this_trait['hmac'] = user_manager.data_hmac('{}:{}'.format(line[5], line[3])) this_trait['species'] = line[0] this_trait['group'] = line[1] - if line[8] != None: + if line[9] != None: this_trait['description'] = line[6] else: this_trait['description'] = line[5] diff --git a/wqflask/wqflask/static/new/images/edit.gif b/wqflask/wqflask/static/new/images/edit.gif new file mode 100644 index 00000000..45b314ee Binary files /dev/null and b/wqflask/wqflask/static/new/images/edit.gif differ diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 7d00d509..55858b5a 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -23,7 +23,7 @@ [ "642", "BayXShaPublish", - "BayXSha Phenotypes" + "BayXSha Published Phenotypes" ] ] }, @@ -39,7 +39,7 @@ [ "623", "ColXBurPublish", - "ColXBur Phenotypes" + "ColXBur Published Phenotypes" ] ] }, @@ -55,7 +55,7 @@ [ "640", "ColXCviPublish", - "ColXCvi Phenotypes" + "ColXCvi Published Phenotypes" ] ] } @@ -131,7 +131,7 @@ [ "608", "SXMPublish", - "SXM Phenotypes" + "Barley SMP Published Phenotypes" ] ] } @@ -215,7 +215,7 @@ [ "None", "AD-cases-controls-MyersPublish", - "AD-cases-controls-Myers Phenotypes" + "AD-cases-controls-Myers Published Phenotypes" ] ] }, @@ -238,7 +238,7 @@ [ "None", "Aging-Brain-UCIPublish", - "Aging-Brain-UCI Phenotypes" + "Aging-Brain-UCI Published Phenotypes" ] ], "Postcentral Gyrus mRNA": [ @@ -298,7 +298,7 @@ [ "634", "CANDLEPublish", - "CANDLE Phenotypes" + "CANDLE Published Phenotypes" ] ] }, @@ -1335,7 +1335,7 @@ [ "None", "HCPPublish", - "HCP Phenotypes" + "HCP Private Phenotypes" ] ] }, @@ -1346,22 +1346,22 @@ "HLC_0311", "GSE9588 Human Liver Normal (Mar11) Both Sexes" ], - [ - "383", - "HLCM_0311", - "GSE9588 Human Liver Normal (Mar11) Males" - ], [ "384", "HLCF_0311", "GSE9588 Human Liver Normal (Mar11) Females" + ], + [ + "383", + "HLCM_0311", + "GSE9588 Human Liver Normal (Mar11) Males" ] ], "Phenotypes": [ [ "635", "HLCPublish", - "HLC Phenotypes" + "HLC Published Phenotypes" ] ] }, @@ -1436,13 +1436,6 @@ "Human Orbital Prefrontal Cortex Affy Hu-Exon 1.0 ST (Jul11) Quantile" ] ], - "Phenotypes": [ - [ - "None", - "HSBPublish", - "HSB Phenotypes" - ] - ], "Posterior Inferior Parietal Cortex mRNA": [ [ "338", @@ -1500,23 +1493,8 @@ ] ] }, - "Islets-Gerling": { - "Phenotypes": [ - [ - "None", - "Islets-GerlingPublish", - "Islets-Gerling Phenotypes" - ] - ] - }, + "Islets-Gerling": {}, "TIGEM-Retina-RNA-Seq": { - "Phenotypes": [ - [ - "None", - "TIGEM-Retina-RNA-SeqPublish", - "TIGEM-Retina-RNA-Seq Phenotypes" - ] - ], "Retina mRNA": [ [ "802", @@ -1562,7 +1540,7 @@ [ "655", "AIL-LGSM-F34-APublish", - "AIL-LGSM-F34-A Phenotypes" + "AIL F34-A Phenotypes" ] ] }, @@ -1571,7 +1549,7 @@ [ "654", "AIL-LGSM-F34-F39-43-GBSPublish", - "AIL-LGSM-F34-F39-43-GBS Phenotypes" + "AIL F34-F39-43-GBS Phenotypes" ] ] }, @@ -1580,7 +1558,7 @@ [ "656", "AIL-LGSM-F34-GBSPublish", - "AIL-LGSM-F34-GBS Phenotypes" + "AIL F34-GBS Phenotypes" ] ] }, @@ -1589,7 +1567,7 @@ [ "657", "AIL-LGSM-F39-43-GBSPublish", - "AIL-LGSM-F39-43-GBS Phenotypes" + "AIL F39-43-GBS Phenotypes" ] ] }, @@ -1669,7 +1647,7 @@ [ "629", "AXBXAPublish", - "AXBXA Phenotypes" + "AXB/BXA Published Phenotypes" ] ] }, @@ -1697,21 +1675,18 @@ [ "603", "B6BTBRF2Publish", - "B6BTBRF2 Phenotypes" - ] - ] - }, - "B6D2": { - "Phenotypes": [ - [ - "None", - "B6D2Publish", - "B6D2 Phenotypes" + "B6BTBRF2 Published Phenotypes" ] ] }, + "B6D2": {}, "B6D2F2": { "Brain mRNA": [ + [ + "77", + "BRF2_M_0805_R", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" + ], [ "76", "BRF2_M_0805_M", @@ -1722,11 +1697,6 @@ "BRF2_M_0805_P", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" ], - [ - "77", - "BRF2_M_0805_R", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" - ], [ "33", "BRF2_M_0304_P", @@ -1763,7 +1733,7 @@ [ "None", "B6D2F2-PSUPublish", - "B6D2F2-PSU Phenotypes" + "B6D2F2 PSU Phenotypes" ] ] }, @@ -1818,6 +1788,11 @@ ] ], "Striatum mRNA": [ + [ + "85", + "SA_M2_0905_P", + "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) PDNN" + ], [ "84", "SA_M2_0905_R", @@ -1827,26 +1802,21 @@ "83", "SA_M2_0905_M", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) MAS5" - ], - [ - "85", - "SA_M2_0905_P", - "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) PDNN" ] ] }, "BHF2": { "Adipose mRNA": [ - [ - "196", - "UCLA_BHF2_ADIPOSE_MALE", - "UCLA BHF2 Adipose Male mlratio" - ], [ "197", "UCLA_BHF2_ADIPOSE_FEMALE", "UCLA BHF2 Adipose Female mlratio" ], + [ + "196", + "UCLA_BHF2_ADIPOSE_MALE", + "UCLA BHF2 Adipose Male mlratio" + ], [ "165", "UCLA_BHF2_ADIPOSE_0605", @@ -1854,16 +1824,16 @@ ] ], "Brain mRNA": [ - [ - "198", - "UCLA_BHF2_BRAIN_MALE", - "UCLA BHF2 Brain Male mlratio" - ], [ "199", "UCLA_BHF2_BRAIN_FEMALE", "UCLA BHF2 Brain Female mlratio" ], + [ + "198", + "UCLA_BHF2_BRAIN_MALE", + "UCLA BHF2 Brain Male mlratio" + ], [ "166", "UCLA_BHF2_BRAIN_0605", @@ -1878,28 +1848,21 @@ ] ], "Liver mRNA": [ - [ - "200", - "UCLA_BHF2_LIVER_MALE", - "UCLA BHF2 Liver Male mlratio" - ], [ "201", "UCLA_BHF2_LIVER_FEMALE", "UCLA BHF2 Liver Female mlratio" ], + [ + "200", + "UCLA_BHF2_LIVER_MALE", + "UCLA BHF2 Liver Male mlratio" + ], [ "167", "UCLA_BHF2_LIVER_0605", "UCLA BHF2 Liver (June05) mlratio" ] - ], - "Phenotypes": [ - [ - "None", - "BHF2Publish", - "BHF2 Phenotypes" - ] ] }, "BHHBF2": { @@ -2081,16 +2044,16 @@ ] ], "Brain mRNA": [ - [ - "590", - "UTHSC_BXD_WB_RNASeqtrim1_1112", - "UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Trimmed 1.0" - ], [ "164", "UTHSC_BXD_WB_RNASeq1112", "UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Untrimmed" ], + [ + "590", + "UTHSC_BXD_WB_RNASeqtrim1_1112", + "UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Trimmed 1.0" + ], [ "394", "UTHSC_BXD_WB_RNASeqEx1112", @@ -2121,6 +2084,11 @@ "BR_U_1105_P", "UTHSC Brain mRNA U74Av2 (Nov05) PDNN" ], + [ + "81", + "BR_U_0805_P", + "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" + ], [ "80", "BR_U_0805_M", @@ -2131,11 +2099,6 @@ "BR_U_0805_R", "UTHSC Brain mRNA U74Av2 (Aug05) RMA" ], - [ - "81", - "BR_U_0805_P", - "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" - ], [ "42", "CB_M_0204_P", @@ -2232,6 +2195,11 @@ "Eye_M2_0908_R_ND", "Eye M430v2 WT Gpnmb (Sep08) RMA" ], + [ + "279", + "Eye_M2_0908_R_WT", + "Eye M430v2 WT Tyrp1 (Sep08) RMA" + ], [ "278", "Eye_M2_0908_R_MT", @@ -2242,11 +2210,6 @@ "Eye_M2_0908_WTWT", "Eye M430v2 WT WT (Sep08) RMA" ], - [ - "279", - "Eye_M2_0908_R_WT", - "Eye M430v2 WT Tyrp1 (Sep08) RMA" - ], [ "400", "DBA2J-ONH-1212", @@ -2530,16 +2493,16 @@ ] ], "Kidney mRNA": [ - [ - "240", - "MA_M2M_0706_R", - "Mouse kidney M430v2 Male (Aug06) RMA" - ], [ "239", "MA_M2F_0706_R", "Mouse kidney M430v2 Female (Aug06) RMA" ], + [ + "240", + "MA_M2M_0706_R", + "Mouse kidney M430v2 Male (Aug06) RMA" + ], [ "118", "MA_M2_0806_R", @@ -2691,11 +2654,6 @@ "EPFLMouseLiverHFDRMA0413", "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], - [ - "849", - "EPFLMouseLiverCDEx0413", - "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" - ], [ "848", "EPFLMouseLiverHFCEx0413", @@ -2706,6 +2664,11 @@ "EPFLMouseLiverCDRMA0413", "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], + [ + "849", + "EPFLMouseLiverCDEx0413", + "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" + ], [ "433", "EPFLMouseLiverBothExRMA0413", @@ -2859,15 +2822,15 @@ "HQFNeoc_0208_RankInv", "HQF BXD Neocortex ILM6v1.1 (Feb08) RankInv" ], - [ - "274", - "DevNeocortex_ILM6.2P3RInv_1110", - "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" - ], [ "275", "DevNeocortex_ILM6.2P14RInv_1110", "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv" + ], + [ + "274", + "DevNeocortex_ILM6.2P3RInv_1110", + "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" ] ], "Nucleus Accumbens mRNA": [ @@ -2881,7 +2844,12 @@ [ "602", "BXDPublish", - "BXD Phenotypes" + "BXD Published Phenotypes" + ], + [ + "658", + "GITrMetPublish", + "GI Tract Metagenome Phenotypes" ] ], "Pituitary Gland mRNA": [ @@ -3094,6 +3062,11 @@ ] ], "Ventral Tegmental Area mRNA": [ + [ + "230", + "VCUEtvsSal_0609_R", + "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA" + ], [ "229", "VCUEtOH_0609_R", @@ -3103,11 +3076,6 @@ "228", "VCUSal_0609_R", "VCU BXD VTA Sal M430 2.0 (Jun09) RMA" - ], - [ - "230", - "VCUEtvsSal_0609_R", - "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA" ] ] }, @@ -3139,7 +3107,7 @@ [ "None", "BXD-HarvestedPublish", - "BXD-Harvested Phenotypes" + "BXD-NIA-Longevity Phenotypes" ] ] }, @@ -3167,13 +3135,6 @@ "LV_G_0106_F", "UNC Agilent G4121A Liver LOWESS Stanford (Jan06) Females" ] - ], - "Phenotypes": [ - [ - "None", - "BXD300Publish", - "BXD300 Phenotypes" - ] ] }, "BXH": { @@ -3219,7 +3180,7 @@ [ "627", "BXHPublish", - "BXH Phenotypes" + "BXH Published Phenotypes" ] ] }, @@ -3235,7 +3196,7 @@ [ "620", "C57BL-6JxC57BL-6NJF2Publish", - "C57BL-6JxC57BL-6NJF2 Phenotypes" + "C57BL/6JxC57BL/6NJ F2 CROSS Phenotypes" ] ] }, @@ -3301,13 +3262,6 @@ "INIA_LCMB_1215", "INIA LCM (11 Regions) BASELINE RNA-seq Transcript Level (Dec15)" ] - ], - "Phenotypes": [ - [ - "None", - "CIE-INIAPublish", - "CIE-INIA Phenotypes" - ] ] }, "CIE-RMA": { @@ -3329,24 +3283,9 @@ "INIA_UTHSC_Mid_AffyMTA1_Ex_May17", "INIA-UTHSC Midbrain CIE Affy MTA 1.0 Exon Level (Apr17) RMA" ] - ], - "Phenotypes": [ - [ - "None", - "CIE-RMAPublish", - "CIE-RMA Phenotypes" - ] - ] - }, - "CMS": { - "Phenotypes": [ - [ - "None", - "CMSPublish", - "CMS Phenotypes" - ] ] }, + "CMS": {}, "CTB6F2": { "Adipose mRNA": [ [ @@ -3427,7 +3366,7 @@ [ "630", "CTB6F2Publish", - "CTB6F2 Phenotypes" + "CastB6/B6Cast F2 UCLA Published Phenotypes" ] ] }, @@ -3469,7 +3408,7 @@ [ "628", "CXBPublish", - "CXB Phenotypes" + "CXB Published Phenotypes" ] ], "Spleen mRNA": [ @@ -3523,7 +3462,7 @@ [ "624", "HSPublish", - "HS Phenotypes" + "Heterogeneous Stock Phenotypes" ] ] }, @@ -3545,6 +3484,11 @@ ] ], "Hippocampus mRNA": [ + [ + "213", + "Illum_LXS_Hipp_NOS_1008", + "Hippocampus Illumina NOS (Oct08) RankInv beta" + ], [ "219", "Illum_LXS_Hipp_NON_1008", @@ -3565,11 +3509,6 @@ "Illum_LXS_Hipp_RSS_1008", "Hippocampus Illumina RSS (Oct08) RankInv beta" ], - [ - "213", - "Illum_LXS_Hipp_NOS_1008", - "Hippocampus Illumina NOS (Oct08) RankInv beta" - ], [ "143", "Illum_LXS_Hipp_loess0807", @@ -3610,7 +3549,7 @@ [ "606", "LXSPublish", - "LXS Phenotypes" + "LXS Published Phenotypes" ] ], "Prefrontal Cortex mRNA": [ @@ -3633,7 +3572,7 @@ [ "645", "Linsenbardt-BoehmPublish", - "Linsenbardt-Boehm Phenotypes" + "Linsenbardt-Boehm Published Phenotypes" ] ] }, @@ -3725,18 +3664,11 @@ [ "607", "NZBXFVB-N2Publish", - "NZBXFVB-N2 Phenotypes" + "NZBXFVB-N2 Published Phenotypes" ] ] }, "Retina-RGC-Rheaume": { - "Phenotypes": [ - [ - "None", - "Retina-RGC-RheaumePublish", - "Retina-RGC-Rheaume Phenotypes" - ] - ], "Retina Single-cell RNA-Seq": [ [ "865", @@ -3811,7 +3743,7 @@ [ "652", "HSNIH-PalmerPublish", - "HSNIH-Palmer Phenotypes" + "HSNIH Phenotypes" ] ], "Prelimbic Cortex mRNA": [ @@ -3827,7 +3759,7 @@ [ "None", "HSNIH-RGSMCPublish", - "HSNIH-RGSMC Phenotypes" + "HSNIH Published Phenotypes" ] ] }, @@ -3907,7 +3839,7 @@ [ "632", "HXBBXHPublish", - "HXBBXH Phenotypes" + "HXB/BXH Published Phenotypes" ] ] }, @@ -3943,7 +3875,7 @@ [ "616", "J12XJ58F2Publish", - "J12XJ58F2 Phenotypes" + "J12XJ58F2 Published Phenotypes" ] ] } @@ -3954,7 +3886,7 @@ [ "621", "LXPPublish", - "LXP Phenotypes" + "LXP Published Phenotypes" ] ] } diff --git a/wqflask/wqflask/templates/docedit.html b/wqflask/wqflask/templates/docedit.html index 1a9e8ca8..8c3d5e7c 100644 --- a/wqflask/wqflask/templates/docedit.html +++ b/wqflask/wqflask/templates/docedit.html @@ -5,11 +5,13 @@ {% block content %}

Edit: {{title}}

-
+ + + - +