From 9a1e7270bc9c2130a4cb9405f2de24053dea6582 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Wed, 11 Aug 2021 20:26:45 +0000
Subject: Sort by attribute ID instead of name in
initialize_show_trait_tables.js when defining attribute columns
---
wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
index 6ca92fb6..49311f87 100644
--- a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
+++ b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
@@ -93,7 +93,7 @@ build_columns = function() {
);
}
- attr_keys = Object.keys(js_data.attributes).sort((a, b) => (js_data.attributes[a].name.toLowerCase() > js_data.attributes[b].name.toLowerCase()) ? 1 : -1)
+ attr_keys = Object.keys(js_data.attributes).sort((a, b) => (js_data.attributes[a].id > js_data.attributes[b].id) ? 1 : -1)
for (i = 0; i < attr_keys.length; i++){
column_list.push(
{
@@ -101,7 +101,7 @@ build_columns = function() {
'type': "natural",
'data': null,
'render': function(data, type, row, meta) {
- attr_name = Object.keys(data.extra_attributes).sort()[meta.col - data.first_attr_col]
+ attr_name = Object.keys(data.extra_attributes).sort((a, b) => (parseInt(a) > parseInt(b)) ? 1 : -1)[meta.col - data.first_attr_col]
if (attr_name != null && attr_name != undefined){
if (Array.isArray(data.extra_attributes[attr_name])){
--
cgit v1.2.3
From 67bab7f9cd12ceb7ea0b0ac4b0b98c24935f3ab5 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Wed, 11 Aug 2021 20:28:35 +0000
Subject: Fixed issue that caused case attribute columns to become unaligned if
some strains didn't have values for all case attributes + changed ordering to
use attribute ID instead of name
---
wqflask/wqflask/show_trait/SampleList.py | 44 ++++++++++++++++++--------------
1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py
index 92cea550..e4bbe5b9 100644
--- a/wqflask/wqflask/show_trait/SampleList.py
+++ b/wqflask/wqflask/show_trait/SampleList.py
@@ -32,7 +32,7 @@ class SampleList:
for counter, sample_name in enumerate(sample_names, 1):
sample_name = sample_name.replace("_2nd_", "")
- # ZS: self.this_trait will be a list if it is a Temp trait
+ # self.this_trait will be a list if it is a Temp trait
if isinstance(self.this_trait, list):
sample = webqtlCaseData.webqtlCaseData(name=sample_name)
if counter <= len(self.this_trait):
@@ -47,7 +47,7 @@ class SampleList:
name=sample_name,
value=float(self.this_trait[counter - 1]))
else:
- # ZS - If there's no value for the sample/strain,
+ # If there's no value for the sample/strain,
# create the sample object (so samples with no value
# are still displayed in the table)
try:
@@ -63,29 +63,29 @@ class SampleList:
sample.this_id = str(counter)
- # ZS: For extra attribute columns; currently only used by
+ # For extra attribute columns; currently only used by
# several datasets
if self.sample_attribute_values:
sample.extra_attributes = self.sample_attribute_values.get(
sample_name, {})
- # ZS: Add a url so RRID case attributes can be displayed as links
- if 'rrid' in sample.extra_attributes:
+ # Add a url so RRID case attributes can be displayed as links
+ if '36' in sample.extra_attributes:
if self.dataset.group.species == "mouse":
- if len(sample.extra_attributes['rrid'].split(":")) > 1:
- the_rrid = sample.extra_attributes['rrid'].split(":")[
+ if len(sample.extra_attributes['36'].split(":")) > 1:
+ the_rrid = sample.extra_attributes['36'].split(":")[
1]
- sample.extra_attributes['rrid'] = [
- sample.extra_attributes['rrid']]
- sample.extra_attributes['rrid'].append(
+ sample.extra_attributes['36'] = [
+ sample.extra_attributes['36']]
+ sample.extra_attributes['36'].append(
webqtlConfig.RRID_MOUSE_URL % the_rrid)
elif self.dataset.group.species == "rat":
- if len(str(sample.extra_attributes['rrid'])):
- the_rrid = sample.extra_attributes['rrid'].split("_")[
+ if len(str(sample.extra_attributes['36'])):
+ the_rrid = sample.extra_attributes['36'].split("_")[
1]
- sample.extra_attributes['rrid'] = [
- sample.extra_attributes['rrid']]
- sample.extra_attributes['rrid'].append(
+ sample.extra_attributes['36'] = [
+ sample.extra_attributes['36']]
+ sample.extra_attributes['36'].append(
webqtlConfig.RRID_RAT_URL % the_rrid)
self.sample_list.append(sample)
@@ -128,12 +128,13 @@ class SampleList:
FROM CaseAttribute, CaseAttributeXRefNew
WHERE CaseAttributeXRefNew.CaseAttributeId = CaseAttribute.Id
AND CaseAttributeXRefNew.InbredSetId = %s
- ORDER BY lower(CaseAttribute.Name)''', (str(self.dataset.group.id),))
+ ORDER BY CaseAttribute.Id''', (str(self.dataset.group.id),))
self.attributes = {}
for attr, values in itertools.groupby(results.fetchall(), lambda row: (row.Id, row.Name)):
key, name = attr
self.attributes[key] = Bunch()
+ self.attributes[key].id = key
self.attributes[key].name = name
self.attributes[key].distinct_values = [
item.Value for item in values]
@@ -168,10 +169,13 @@ class SampleList:
for sample_name, items in itertools.groupby(results.fetchall(), lambda row: row.SampleName):
attribute_values = {}
+ # Make a list of attr IDs without values (that have values for other samples)
+ valueless_attr_ids = [self.attributes[key].id for key in self.attributes.keys()]
for item in items:
+ valueless_attr_ids.remove(item.Id)
attribute_value = item.Value
- # ZS: If it's an int, turn it into one for sorting
+ # If it's an int, turn it into one for sorting
# (for example, 101 would be lower than 80 if
# they're strings instead of ints)
try:
@@ -179,8 +183,10 @@ class SampleList:
except ValueError:
pass
- attribute_values[self.attributes[item.Id].name.lower(
- )] = attribute_value
+ attribute_values[str(item.Id)] = attribute_value
+ for attr_id in valueless_attr_ids:
+ attribute_values[str(attr_id)] = ""
+
self.sample_attribute_values[sample_name] = attribute_values
def get_first_attr_col(self):
--
cgit v1.2.3
From eecaad2dac6efa885540287a7ef5a273c6d18be2 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 21:55:26 +0000
Subject: Get case attribute descriptions from DB and display them as mouseover
titles in the sample table headers for the trait page
---
wqflask/wqflask/show_trait/SampleList.py | 7 ++++---
.../wqflask/static/new/javascript/initialize_show_trait_tables.js | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py
index e4bbe5b9..ae30aa59 100644
--- a/wqflask/wqflask/show_trait/SampleList.py
+++ b/wqflask/wqflask/show_trait/SampleList.py
@@ -124,18 +124,19 @@ class SampleList:
# Get attribute names and distinct values for each attribute
results = g.db.execute('''
- SELECT DISTINCT CaseAttribute.Id, CaseAttribute.Name, CaseAttributeXRefNew.Value
+ SELECT DISTINCT CaseAttribute.Id, CaseAttribute.Name, CaseAttribute.Description, CaseAttributeXRefNew.Value
FROM CaseAttribute, CaseAttributeXRefNew
WHERE CaseAttributeXRefNew.CaseAttributeId = CaseAttribute.Id
AND CaseAttributeXRefNew.InbredSetId = %s
ORDER BY CaseAttribute.Id''', (str(self.dataset.group.id),))
self.attributes = {}
- for attr, values in itertools.groupby(results.fetchall(), lambda row: (row.Id, row.Name)):
- key, name = attr
+ for attr, values in itertools.groupby(results.fetchall(), lambda row: (row.Id, row.Name, row.Description)):
+ key, name, description = attr
self.attributes[key] = Bunch()
self.attributes[key].id = key
self.attributes[key].name = name
+ self.attributes[key].description = description
self.attributes[key].distinct_values = [
item.Value for item in values]
self.attributes[key].distinct_values = natural_sort(
diff --git a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
index 49311f87..4de1b0ac 100644
--- a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
+++ b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
@@ -97,7 +97,7 @@ build_columns = function() {
for (i = 0; i < attr_keys.length; i++){
column_list.push(
{
- 'title': "
" + js_data.attributes[attr_keys[i]].name + "
",
+ 'title': "
" + js_data.attributes[attr_keys[i]].name + "
",
'type': "natural",
'data': null,
'render': function(data, type, row, meta) {
--
cgit v1.2.3
From f4fbb6d53419a19c6ee67977d18605cdcbb09c0e Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 22:35:53 +0000
Subject: add function for reading in JSON file that lists sample lists unique
to each study within a group (in this case only BXD Longevity for now)
---
wqflask/base/data_set.py | 9 +++++++++
wqflask/wqflask/show_trait/show_trait.py | 1 +
2 files changed, 10 insertions(+)
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 4cb82665..b8f2f9fb 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -398,6 +398,15 @@ class DatasetGroup:
if maternal and paternal:
self.parlist = [maternal, paternal]
+ def get_study_samplelists(self):
+ study_sample_file = "%s/study_sample_lists/%s.json" % (webqtlConfig.GENODIR, self.name)
+ try:
+ f = open(study_sample_file)
+ except:
+ return None
+ study_samples = json.load(f)
+ return study_samples
+
def get_genofiles(self):
jsonfile = "%s/%s.json" % (webqtlConfig.GENODIR, self.name)
try:
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index c07430dd..d3356bc3 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -192,6 +192,7 @@ class ShowTrait:
[self.dataset.species.chromosomes.chromosomes[this_chr].name, i])
self.genofiles = self.dataset.group.get_genofiles()
+ self.study_samplelists = self.dataset.group.get_study_samplelists()
# ZS: No need to grab scales from .geno file unless it's using
# a mapping method that reads .geno files
--
cgit v1.2.3
From 308860f05b87e5fc3899230b7312be9543e6c299 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 23:16:02 +0000
Subject: Add option to filter samples by study to template
---
.../templates/show_trait_transform_and_filter.html | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/wqflask/wqflask/templates/show_trait_transform_and_filter.html b/wqflask/wqflask/templates/show_trait_transform_and_filter.html
index 20f78b48..56c3c30e 100644
--- a/wqflask/wqflask/templates/show_trait_transform_and_filter.html
+++ b/wqflask/wqflask/templates/show_trait_transform_and_filter.html
@@ -45,6 +45,25 @@
{% endif %}
+ {% if study_samplelists|length > 0 %}
+
+
+
+
+
+
+ {% endif %}
{% if (numerical_var_list|length > 0) or js_data.se_exists %}
--
cgit v1.2.3
From 98683bd5cc809aa03e0bd58a67733498b4f56a9d Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 23:17:04 +0000
Subject: Fix the way the study_sample_lists path is set and checked
---
wqflask/base/data_set.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index b8f2f9fb..1042e1bd 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -399,7 +399,7 @@ class DatasetGroup:
self.parlist = [maternal, paternal]
def get_study_samplelists(self):
- study_sample_file = "%s/study_sample_lists/%s.json" % (webqtlConfig.GENODIR, self.name)
+ study_sample_file = locate_ignore_error(self.name + ".json", 'study_sample_lists')
try:
f = open(study_sample_file)
except:
--
cgit v1.2.3
From 810b2ace0a9cb2511cf0ef6f0c01f70a0ce11915 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 23:19:38 +0000
Subject: Return empty list instead of None in get_study_samplelists
---
wqflask/base/data_set.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 1042e1bd..0ea61faa 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -403,7 +403,7 @@ class DatasetGroup:
try:
f = open(study_sample_file)
except:
- return None
+ return []
study_samples = json.load(f)
return study_samples
--
cgit v1.2.3
From 11d5e9ffbf48c6a2fa7a59f10a9d7fe44cee0c23 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 23:20:28 +0000
Subject: Get list of study titles to use for the dropdown menu and store the
full list of study samplelists as a hddn input (don't like this, but no easy
alternative right now)
---
wqflask/wqflask/show_trait/show_trait.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index d3356bc3..bc97d417 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -192,7 +192,8 @@ class ShowTrait:
[self.dataset.species.chromosomes.chromosomes[this_chr].name, i])
self.genofiles = self.dataset.group.get_genofiles()
- self.study_samplelists = self.dataset.group.get_study_samplelists()
+ study_samplelist_json = self.dataset.group.get_study_samplelists()
+ self.study_samplelists = [study["title"] for study in study_samplelist_json]
# ZS: No need to grab scales from .geno file unless it's using
# a mapping method that reads .geno files
@@ -281,6 +282,7 @@ class ShowTrait:
hddn['selected_chr'] = -1
hddn['mapping_display_all'] = True
hddn['suggestive'] = 0
+ hddn['study_samplelists'] = json.dumps(study_samplelist_json)
hddn['num_perm'] = 0
hddn['categorical_vars'] = ""
if categorical_var_list:
--
cgit v1.2.3
From 88c9f4f9bd2adca23052fc3f5c5b965accf6722d Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 23:20:52 +0000
Subject: Add JS for filtering sample table rows by study samplelist
---
wqflask/wqflask/static/new/javascript/show_trait.js | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 77ef1720..3957175b 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -713,10 +713,24 @@ block_by_index = function() {
for (_k = 0, _len1 = index_list.length; _k < _len1; _k++) {
index = index_list[_k];
val_nodes[index - 1].childNodes[0].value = "x";
-
}
};
+filter_by_study = function() {
+ let this_study = $('#filter_study').val();
+ let block_group = $('#filter_study_group').val();
+ let study_sample_data = JSON.parse($('input[name=study_samplelists]').val())
+ let filter_samples = study_sample_data[parseInt(this_study)]['samples']
+ let sample_nodes = table_api.column(2).nodes().to$();
+ let val_nodes = table_api.column(3).nodes().to$();
+ for (i = 0; i < sample_nodes.length; i++) {
+ this_sample = sample_nodes[i].childNodes[0].innerText;
+ if (!filter_samples.includes(this_sample)){
+ val_nodes[i].childNodes[0].value = "x";
+ }
+ }
+}
+
filter_by_value = function() {
let filter_logic = $('#filter_logic').val();
let filter_column = $('#filter_column').val();
@@ -1690,6 +1704,11 @@ $('#block_by_index').click(function(){
edit_data_change();
});
+$('#filter_by_study').click(function(){
+ filter_by_study();
+ edit_data_change();
+})
+
$('#filter_by_value').click(function(){
filter_by_value();
edit_data_change();
--
cgit v1.2.3
From 9ae4c8d0370137c3a698d57566305d815929d4ce Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 23:28:08 +0000
Subject: Fixed issue where 1 was added to the loop.index instead of subtracted
+ only show the sample group selection if there are more than one sample
groups
---
wqflask/wqflask/templates/show_trait_transform_and_filter.html | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/wqflask/wqflask/templates/show_trait_transform_and_filter.html b/wqflask/wqflask/templates/show_trait_transform_and_filter.html
index 56c3c30e..064fd3e5 100644
--- a/wqflask/wqflask/templates/show_trait_transform_and_filter.html
+++ b/wqflask/wqflask/templates/show_trait_transform_and_filter.html
@@ -50,9 +50,10 @@
+ {% if sample_groups|length != 1 %}
+ {% endif %}
{% endif %}
--
cgit v1.2.3
From 6acafff1b22089916b8323afb872e2ebed37943a Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 12 Aug 2021 23:28:49 +0000
Subject: Account for user selecting one of the two sample groups if more than
one exist
---
wqflask/wqflask/static/new/javascript/show_trait.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 3957175b..845ed907 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -718,9 +718,19 @@ block_by_index = function() {
filter_by_study = function() {
let this_study = $('#filter_study').val();
- let block_group = $('#filter_study_group').val();
+
let study_sample_data = JSON.parse($('input[name=study_samplelists]').val())
let filter_samples = study_sample_data[parseInt(this_study)]['samples']
+
+ if ($('#filter_study_group').length){
+ let block_group = $('#filter_study_group').val();
+ if (block_group === "other") {
+ table_api = $('#samples_other').DataTable();
+ } else {
+ table_api = $('#samples_primary').DataTable();
+ }
+ }
+
let sample_nodes = table_api.column(2).nodes().to$();
let val_nodes = table_api.column(3).nodes().to$();
for (i = 0; i < sample_nodes.length; i++) {
--
cgit v1.2.3
From e2ee1c489f0eb59c3efbf81d42f43a1f74cd1adb Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Fri, 6 Aug 2021 15:31:30 +0300
Subject: wqflask: show_trait:: Remove debug comment
---
wqflask/wqflask/show_trait/show_trait.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index c07430dd..b640ec27 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -520,6 +520,9 @@ class ShowTrait:
sample_group_type='primary',
header="%s Only" % (self.dataset.group.name))
self.sample_groups = (primary_samples,)
+ print("\nttttttttttttttttttttttttttttttttttttttttttttt\n")
+ print(self.sample_groups)
+ print("\nttttttttttttttttttttttttttttttttttttttttttttt\n")
self.primary_sample_names = primary_sample_names
self.dataset.group.allsamples = all_samples_ordered
--
cgit v1.2.3
From 579ae94b08f0b1cef00350b54dadc12869ad70de Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Fri, 6 Aug 2021 16:15:17 +0300
Subject: base: data_set: Remove unnecessary comments and logging statements
---
wqflask/base/data_set.py | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 4cb82665..edc22540 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -277,7 +277,6 @@ class Markers:
filtered_markers = []
for marker in self.markers:
if marker['name'] in p_values:
- # logger.debug("marker {} IS in p_values".format(i))
marker['p_value'] = p_values[marker['name']]
if math.isnan(marker['p_value']) or (marker['p_value'] <= 0):
marker['lod_score'] = 0
@@ -298,7 +297,6 @@ class HumanMarkers(Markers):
self.markers = []
for line in marker_data_fh:
splat = line.strip().split()
- # logger.debug("splat:", splat)
if len(specified_markers) > 0:
if splat[1] in specified_markers:
marker = {}
@@ -737,7 +735,6 @@ class DataSet:
and Strain.SpeciesId=Species.Id
and Species.name = '{}'
""".format(create_in_clause(self.samplelist), *mescape(self.group.species))
- logger.sql(query)
results = dict(g.db.execute(query).fetchall())
sample_ids = [results[item] for item in self.samplelist]
@@ -908,7 +905,6 @@ class PhenotypeDataSet(DataSet):
Geno.Name = '%s' and
Geno.SpeciesId = Species.Id
""" % (species, this_trait.locus)
- logger.sql(query)
result = g.db.execute(query).fetchone()
if result:
@@ -938,7 +934,6 @@ class PhenotypeDataSet(DataSet):
Order BY
Strain.Name
"""
- logger.sql(query)
results = g.db.execute(query, (trait, self.id)).fetchall()
return results
@@ -1005,7 +1000,6 @@ class GenotypeDataSet(DataSet):
Order BY
Strain.Name
"""
- logger.sql(query)
results = g.db.execute(query,
(webqtlDatabaseFunction.retrieve_species_id(self.group.name),
trait, self.name)).fetchall()
@@ -1126,8 +1120,6 @@ class MrnaAssayDataSet(DataSet):
ProbeSet.Name = '%s'
""" % (escape(str(this_trait.dataset.id)),
escape(this_trait.name)))
-
- logger.sql(query)
result = g.db.execute(query).fetchone()
mean = result[0] if result else 0
@@ -1147,7 +1139,6 @@ class MrnaAssayDataSet(DataSet):
Geno.Name = '{}' and
Geno.SpeciesId = Species.Id
""".format(species, this_trait.locus)
- logger.sql(query)
result = g.db.execute(query).fetchone()
if result:
@@ -1179,7 +1170,6 @@ class MrnaAssayDataSet(DataSet):
Order BY
Strain.Name
""" % (escape(trait), escape(self.name))
- logger.sql(query)
results = g.db.execute(query).fetchall()
return results
@@ -1190,7 +1180,6 @@ class MrnaAssayDataSet(DataSet):
where ProbeSetXRef.ProbeSetFreezeId = %s and
ProbeSetXRef.ProbeSetId=ProbeSet.Id;
""" % (column_name, escape(str(self.id)))
- logger.sql(query)
results = g.db.execute(query).fetchall()
return dict(results)
@@ -1224,7 +1213,6 @@ def geno_mrna_confidentiality(ob):
query = '''SELECT Id, Name, FullName, confidentiality,
AuthorisedUsers FROM %s WHERE Name = "%s"''' % (dataset_table, ob.name)
- logger.sql(query)
result = g.db.execute(query)
(dataset_id,
--
cgit v1.2.3
From 7f2a1f9d1b91b9d0d24da56afcfe26197a434af3 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Mon, 16 Aug 2021 11:13:40 +0300
Subject: Add "Description" column to CaseAttribute
See: eecaad2d
---
scripts/add_missing_columns.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/add_missing_columns.sh b/scripts/add_missing_columns.sh
index 70d5fdeb..611e2dd6 100644
--- a/scripts/add_missing_columns.sh
+++ b/scripts/add_missing_columns.sh
@@ -13,6 +13,9 @@
ALTER TABLE PublishXRef
ADD mean double AFTER DataId;
+ ALTER TABLE CaseAttribute
+ ADD Description varchar(255) AFTER Name;
+
-- This takes some time
ALTER TABLE ProbeSet
ADD UniProtID varchar(20) AFTER ProteinName;
--
cgit v1.2.3
From 2071107566d89a12fe27fdcc94dd16b7b8680f83 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Mon, 16 Aug 2021 11:38:05 +0300
Subject: wqflask: views: Remove commented out code blocks
---
wqflask/wqflask/views.py | 28 ----------------------------
1 file changed, 28 deletions(-)
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 44560427..08e895cb 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -365,20 +365,6 @@ def wcgna_setup():
return render_template("wgcna_setup.html", **request.form)
-# @app.route("/wgcna_results", methods=('POST',))
-# def wcgna_results():
-# logger.info("In wgcna, request.form is:", request.form)
-# logger.info(request.url)
-# # Start R, load the package and pointers and create the analysis
-# wgcna = wgcna_analysis.WGCNA()
-# # Start the analysis, a wgcnaA object should be a separate long running thread
-# wgcnaA = wgcna.run_analysis(request.form)
-# # After the analysis is finished store the result
-# result = wgcna.process_results(wgcnaA)
-# # Display them using the template
-# return render_template("wgcna_results.html", **result)
-
-
@app.route("/ctl_setup", methods=('POST',))
def ctl_setup():
# We are going to get additional user input for the analysis
@@ -388,20 +374,6 @@ def ctl_setup():
return render_template("ctl_setup.html", **request.form)
-# @app.route("/ctl_results", methods=('POST',))
-# def ctl_results():
-# logger.info("In ctl, request.form is:", request.form)
-# logger.info(request.url)
-# # Start R, load the package and pointers and create the analysis
-# ctl = ctl_analysis.CTL()
-# # Start the analysis, a ctlA object should be a separate long running thread
-# ctlA = ctl.run_analysis(request.form)
-# # After the analysis is finished store the result
-# result = ctl.process_results(ctlA)
-# # Display them using the template
-# return render_template("ctl_results.html", **result)
-
-
@app.route("/intro")
def intro():
doc = Docs("intro", request.args)
--
cgit v1.2.3
From 923d849d640e3048422e3cdfa6ce24716cfa7904 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Mon, 16 Aug 2021 18:54:16 +0300
Subject: wqflask: views: Use "inbredset_id" in the "Edit Trait" URL
---
wqflask/wqflask/views.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 08e895cb..3f0ab93f 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -408,9 +408,9 @@ def submit_trait_form():
version=GN_VERSION)
-@app.route("/trait//edit/phenotype-id/")
+@app.route("/trait//edit/inbredset-id/")
@admin_login_required
-def edit_phenotype(name, phenotype_id):
+def edit_phenotype(name, inbredset_id):
conn = MySQLdb.Connect(db=current_app.config.get("DB_NAME"),
user=current_app.config.get("DB_USER"),
passwd=current_app.config.get("DB_PASS"),
@@ -419,7 +419,7 @@ def edit_phenotype(name, phenotype_id):
conn=conn,
table="PublishXRef",
where=PublishXRef(id_=name,
- phenotype_id=phenotype_id))
+ inbred_set_id=inbredset_id))
phenotype_ = fetchone(
conn=conn,
table="Phenotype",
--
cgit v1.2.3
From 82a7ccf6d2e5e18dcbd83f8070fd88ddc34ad419 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Mon, 16 Aug 2021 19:00:34 +0300
Subject: Update URL for editing published trait
---
wqflask/wqflask/templates/show_trait_details.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index bb30c54c..53e16aa0 100644
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -236,7 +236,7 @@
{% if admin_status == "owner" or admin_status == "edit-admins" or admin_status == "edit-access" %}
{% if this_trait.dataset.type == 'Publish' %}
-
+
{% endif %}
{% if this_trait.dataset.type == 'ProbeSet' %}
--
cgit v1.2.3
From 83af88a4bbf9d8a67f4d11c3546ba64f09efb6d2 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Tue, 17 Aug 2021 09:15:04 +0300
Subject: wqflask: wsgi: Remove it
* wqflask/wsgi.py: Delete file. Not used anywhere.
---
wqflask/wsgi.py | 4 ----
1 file changed, 4 deletions(-)
delete mode 100644 wqflask/wsgi.py
diff --git a/wqflask/wsgi.py b/wqflask/wsgi.py
deleted file mode 100644
index 755da333..00000000
--- a/wqflask/wsgi.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from run_gunicorn import app as application # expect application as a name
-
-if __name__ == "__main__":
- application.run()
--
cgit v1.2.3
From b0610024e7cb5dec73742fd461cd662881869214 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Tue, 17 Aug 2021 09:15:47 +0300
Subject: wqflask: views: Re-enable admin access in edit probeset
---
wqflask/wqflask/views.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 3f0ab93f..7095c392 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -466,7 +466,7 @@ def edit_phenotype(name, inbredset_id):
@app.route("/trait/edit/probeset-name/")
-# @admin_login_required
+@admin_login_required
def edit_probeset(dataset_name):
conn = MySQLdb.Connect(db=current_app.config.get("DB_NAME"),
user=current_app.config.get("DB_USER"),
--
cgit v1.2.3
From d89a13ef9f3f4da47432eb3555df3ada7bbfbb8b Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Tue, 17 Aug 2021 12:41:24 +0300
Subject: wqflask: runserver: Add DebugToolbar when running in DEBUG mode
---
wqflask/runserver.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/wqflask/runserver.py b/wqflask/runserver.py
index df957bd9..8198b921 100644
--- a/wqflask/runserver.py
+++ b/wqflask/runserver.py
@@ -23,6 +23,9 @@ app_config()
werkzeug_logger = logging.getLogger('werkzeug')
if WEBSERVER_MODE == 'DEBUG':
+ from flask_debugtoolbar import DebugToolbarExtension
+ app.debug = True
+ toolbar = DebugToolbarExtension(app)
app.run(host='0.0.0.0',
port=SERVER_PORT,
debug=True,
--
cgit v1.2.3
From b70bf1250bc93a47c3e3e32d4d2f4a116121d11f Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Tue, 17 Aug 2021 12:43:50 +0300
Subject: wqflask:.DS_Store: Delete it
---
wqflask/.DS_Store | Bin 6148 -> 0 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 wqflask/.DS_Store
diff --git a/wqflask/.DS_Store b/wqflask/.DS_Store
deleted file mode 100644
index d992942f..00000000
Binary files a/wqflask/.DS_Store and /dev/null differ
--
cgit v1.2.3
From 94f278b68817fb22d363fdfd1b416f9c674c3226 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Wed, 18 Aug 2021 09:42:48 +0300
Subject: Revert "wqflask: wsgi: Remove it"
This reverts commit 83af88a4bbf9d8a67f4d11c3546ba64f09efb6d2.
---
wqflask/wsgi.py | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 wqflask/wsgi.py
diff --git a/wqflask/wsgi.py b/wqflask/wsgi.py
new file mode 100644
index 00000000..755da333
--- /dev/null
+++ b/wqflask/wsgi.py
@@ -0,0 +1,4 @@
+from run_gunicorn import app as application # expect application as a name
+
+if __name__ == "__main__":
+ application.run()
--
cgit v1.2.3
From f5f1b3e64db18dbdde39860f1f86a4bf408e3dd6 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Mon, 16 Aug 2021 19:50:24 +0000
Subject: Replace textarea with multiple select element for displaying mapping
covariates
---
wqflask/wqflask/templates/show_trait_mapping_tools.html | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index 3dd44c85..3f0557aa 100755
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -77,7 +77,9 @@
-
+
{% endif %}
@@ -320,7 +322,9 @@
-
+
{% endif %}
--
cgit v1.2.3
From eb7863b540bda56f3e0a769440ebc16c675d4adb Mon Sep 17 00:00:00 2001
From: zsloan
Date: Mon, 16 Aug 2021 19:51:07 +0000
Subject: Update get_covariates_from_collection.js to properly interact with
the select element instead of the previous textarea
---
.../javascript/get_covariates_from_collection.js | 55 +++++++++++++++-------
1 file changed, 39 insertions(+), 16 deletions(-)
diff --git a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
index 3e414034..62590aaf 100644
--- a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
+++ b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
@@ -65,10 +65,8 @@ if ( ! $.fn.DataTable.isDataTable( '#collection_table' ) ) {
collection_click = function() {
var this_collection_url;
- console.log("Clicking on:", $(this));
this_collection_url = $(this).find('.collection_name').prop("href");
this_collection_url += "&json";
- console.log("this_collection_url", this_collection_url);
collection_list = $("#collections_holder").html();
return $.ajax({
dataType: "json",
@@ -79,32 +77,57 @@ collection_click = function() {
submit_click = function() {
var covariates_string = "";
- var covariates_display_string = "";
+ var covariates_as_set = new Set();
+ $(".selected-covariates:first option").each(function() {
+ if ($(this).val() != ""){
+ covariates_as_set.add($(this).val() + "," + $(this).text());
+ }
+ });
$('#collections_holder').find('input[type=checkbox]:checked').each(function() {
var this_dataset, this_trait;
this_trait = $(this).parents('tr').find('.trait').text();
this_trait_display = $(this).parents('tr').find('.trait').data("display_name");
this_description = $(this).parents('tr').find('.description').text();
- console.log("this_trait is:", this_trait_display);
this_dataset = $(this).parents('tr').find('.dataset').data("dataset");
- console.log("this_dataset is:", this_dataset);
- covariates_string += this_trait + ":" + this_dataset + ","
- //this_covariate_display_string = this_trait + ": " + this_description
this_covariate_display_string = this_trait_display
if (this_covariate_display_string.length > 50) {
this_covariate_display_string = this_covariate_display_string.substring(0, 45) + "..."
}
- covariates_display_string += this_covariate_display_string + "\n"
+ covariates_as_set.add(this_trait + ":" + this_dataset + "," + this_covariate_display_string)
+ });
+
+ covariates_as_list = Array.from(covariates_as_set)
+
+ // Removed the starting "No covariates selected" option before adding options for each covariate
+ if (covariates_as_list.length > 0){
+ $(".selected-covariates option[value='']").each(function() {
+ $(this).remove();
+ });
+ }
+
+ $(".selected-covariates option").each(function() {
+ $(this).remove();
});
- // Trim the last newline from display_string
- covariates_display_string = covariates_display_string.replace(/\n$/, "")
- // Trim the last comma
- covariates_string = covariates_string.substring(0, covariates_string.length - 1)
- //covariates_display_string = covariates_display_string.substring(0, covariates_display_string.length - 2)
+ covariate_list_for_form = []
+ $.each(covariates_as_list, function (index, value) {
+ option_value = value.split(",")[0]
+ option_text = value.split(",")[1]
+ $(".selected-covariates").append($("", {
+ value: option_value,
+ text: option_text
+ }))
+ covariate_list_for_form.push(option_value)
+ });
- $("input[name=covariates]").val(covariates_string)
- $(".selected-covariates").val(covariates_display_string)
+ $("input[name=covariates]").val(covariate_list_for_form.join(","));
+
+ cofactor_count = $(".selected-covariates:first option").length;
+ if (cofactor_count > 10){
+ $(".selected-covariates").attr("size", 10);
+ } else {
+ $(".selected-covariates").attr("size", cofactor_count);
+ }
return $.colorbox.close();
};
@@ -223,4 +246,4 @@ back_to_collections = function() {
$(".collection_line").on("click", collection_click);
$("#submit").on("click", submit_click);
$(".trait").on("click", trait_click);
-$("#back_to_collections").on("click", back_to_collections);
\ No newline at end of file
+$("#back_to_collections").on("click", back_to_collections);
--
cgit v1.2.3
From 0b6da486c0480dfe15486de34260ea462b168e39 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Mon, 16 Aug 2021 19:51:53 +0000
Subject: Update show_trait.js to make removing covariates work with the new
select element; individual covariates can now be removed
---
.../wqflask/static/new/javascript/show_trait.js | 39 ++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 845ed907..bacafca6 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -98,9 +98,44 @@ sample_group_types = js_data.sample_group_types;
$(".select_covariates").click(function () {
open_covariate_selection();
});
+
$(".remove_covariates").click(function () {
- $("input[name=covariates]").val("")
- $(".selected-covariates").val("")
+ $(".selected-covariates option:selected").each(function() {
+ this_val = $(this).val();
+ $(".selected-covariates option").each(function(){
+ if ($(this).val() == this_val){
+ $(this).remove();
+ }
+ })
+ cofactor_count = $(".selected-covariates:first option").length
+ if (cofactor_count > 2 && cofactor_count < 11){
+ $(".selected-covariates").each(function() {
+ $(this).attr("size", $(".selected-covariates:first option").length)
+ });
+ } else if (cofactor_count > 10) {
+ $(".selected-covariates").each(function() {
+ $(this).attr("size", 10)
+ });
+ } else {
+ $(".selected-covariates").each(function() {
+ $(this).attr("size", 2)
+ });
+ }
+ if (cofactor_count == 0){
+ $(".selected-covariates").each(function() {
+ $(this).append($("", {
+ value: "",
+ text: "No covariates selected"
+ }))
+ })
+ }
+ });
+
+ covariates_list = [];
+ $(".selected-covariates:first option").each(function() {
+ covariates_list.push($(this).val());
+ })
+ $("input[name=covariates]").val(covariates_list.join(","))
});
open_trait_selection = function() {
--
cgit v1.2.3
From caf2c395f3aa2dc62236128a0db9f3243170db94 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Tue, 17 Aug 2021 03:06:01 +0000
Subject: Add Removal All button that removes all currently added covariates
---
wqflask/wqflask/static/new/javascript/show_trait.js | 7 +++++++
wqflask/wqflask/templates/show_trait_mapping_tools.html | 2 ++
2 files changed, 9 insertions(+)
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index bacafca6..81c52ff6 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -138,6 +138,13 @@ $(".remove_covariates").click(function () {
$("input[name=covariates]").val(covariates_list.join(","))
});
+$(".remove_all_covariates").click(function() {
+ $(".selected-covariates option").each(function() {
+ $(this).remove();
+ });
+ $("input[name=covariates]").val("");
+})
+
open_trait_selection = function() {
return $('#collections_holder').load('/collections/list?color_by_trait #collections_list', (function(_this) {
return function() {
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index 3f0557aa..cc472914 100755
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -76,6 +76,7 @@