aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2019-04-18 13:39:09 -0500
committerzsloan2019-04-18 13:39:09 -0500
commit64fdffd07eaf51cbd4268d0cfafefea74938d731 (patch)
tree229c59aa61c0dc1f074471f58214b901ccaff56e /wqflask
parentac941bb49a524a263acc6be96183d57b51cd3954 (diff)
downloadgenenetwork2-64fdffd07eaf51cbd4268d0cfafefea74938d731.tar.gz
Fixed issue that caused removed strains to still appear in the haplotype analyst track
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py44
-rw-r--r--wqflask/wqflask/marker_regression/run_mapping.py38
-rw-r--r--wqflask/wqflask/templates/mapping_results.html1
-rw-r--r--wqflask/wqflask/views.py1
4 files changed, 44 insertions, 40 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 1ce0e725..f4d5ca66 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -235,7 +235,7 @@ class DisplayMappingResults(object):
self.selectedChr = int(start_vars['selected_chr'])
- self.strainlist = self.dataset.group.samplelist
+ self.strainlist = start_vars['samples']
self.genotype = self.dataset.group.read_genotype_file()
if self.mapping_method == "reaper" and self.manhattan_plot != True:
self.genotype = self.genotype.addinterval()
@@ -343,20 +343,19 @@ class DisplayMappingResults(object):
## BEGIN HaplotypeAnalyst
## count the amount of individuals to be plotted, and increase self.graphHeight
if self.haplotypeAnalystChecked and self.selectedChr > -1:
- #thisTrait = self.traitList[0]
- thisTrait = self.this_trait
- _strains, _vals, _vars, _aliases = thisTrait.export_informative()
- smd=[]
- for ii, _val in enumerate(_vals):
- temp = GeneralObject(name=_strains[ii], value=_val)
- smd.append(temp)
- samplelist = list(self.genotype.prgy)
- for j,_geno in enumerate (self.genotype[0][1].genotype):
- for item in smd:
- if item.name == samplelist[j]:
- self.NR_INDIVIDUALS = self.NR_INDIVIDUALS + 1
+ thisTrait = self.this_trait
+ _strains, _vals, _vars, _aliases = thisTrait.export_informative()
+ smd=[]
+ for ii, _val in enumerate(_vals):
+ temp = GeneralObject(name=_strains[ii], value=_val)
+ smd.append(temp)
+ samplelist = list(self.genotype.prgy)
+ for j,_geno in enumerate (self.genotype[0][1].genotype):
+ for item in smd:
+ if item.name == samplelist[j]:
+ self.NR_INDIVIDUALS = self.NR_INDIVIDUALS + 1
# default:
- self.graphHeight = self.graphHeight + 2 * (self.NR_INDIVIDUALS+10) * self.EACH_GENE_HEIGHT
+ self.graphHeight = self.graphHeight + 2 * (self.NR_INDIVIDUALS+10) * self.EACH_GENE_HEIGHT
## END HaplotypeAnalyst
################################################################
@@ -1159,13 +1158,8 @@ class DisplayMappingResults(object):
if self.plotScale != 'physic' or self.selectedChr == -1 or not self.geneCol:
return
- clickableRegionLabelFont=pid.Font(ttf="verdana", size=9, bold=0)
-
xLeftOffset, xRightOffset, yTopOffset, yBottomOffset = offset
plotWidth = canvas.size[0] - xLeftOffset - xRightOffset
- plotHeight = canvas.size[1] - yTopOffset - yBottomOffset
- yZero = canvas.size[1] - yBottomOffset
- fontZoom = zoom
yPaddingTop = yTopOffset
@@ -1174,7 +1168,7 @@ class DisplayMappingResults(object):
smd=[]
for ii, _val in enumerate(_vals):
- if _strains[ii] in self.dataset.group.samplelist:
+ if _strains[ii] in self.samples:
temp = GeneralObject(name=_strains[ii], value=_val)
smd.append(temp)
@@ -1188,11 +1182,11 @@ class DisplayMappingResults(object):
plotRight = xRightOffset
#### find out PlotRight
- for i, _chr in enumerate(self.genotype):
+ for _chr in self.genotype:
if _chr.name == self.ChrList[self.selectedChr][0]:
- for j, _locus in enumerate(_chr):
- txStart = _chr[j].Mb
- txEnd = _chr[j].Mb
+ for i, _locus in enumerate(_chr):
+ txStart = _chr[i].Mb
+ txEnd = _chr[i].Mb
geneStartPix = xLeftOffset + plotXScale*(float(txStart) - startMb) - 0
geneEndPix = xLeftOffset + plotXScale*(float(txEnd) - startMb) - 0
@@ -1204,7 +1198,7 @@ class DisplayMappingResults(object):
drawit = 0;
if drawit == 1:
- if _chr[j].name != " - " :
+ if _chr[i].name != " - " :
plotRight = geneEndPix + 4
#### end find out PlotRight
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py
index a0466c0f..4770b14b 100644
--- a/wqflask/wqflask/marker_regression/run_mapping.py
+++ b/wqflask/wqflask/marker_regression/run_mapping.py
@@ -56,27 +56,35 @@ class RunMapping(object):
self.json_data = {}
self.json_data['lodnames'] = ['lod.hk']
- self.samples = [] # Want only ones with values
- self.vals = []
-
all_samples_ordered = self.dataset.group.all_samples_ordered()
primary_sample_names = list(all_samples_ordered)
- for sample in self.dataset.group.samplelist:
- # sample is actually the name of an individual
- in_trait_data = False
- for item in self.this_trait.data:
- if self.this_trait.data[item].name == sample:
- value = start_vars['value:' + self.this_trait.data[item].name]
- self.samples.append(self.this_trait.data[item].name)
- self.vals.append(value)
- in_trait_data = True
- break
- if not in_trait_data:
+ self.vals = []
+ if 'samples' in start_vars:
+ self.samples = start_vars['samples'].split(",")
+ for sample in self.samples:
value = start_vars.get('value:' + sample)
if value:
- self.samples.append(sample)
self.vals.append(value)
+ else:
+ self.samples = []
+
+ for sample in self.dataset.group.samplelist:
+ # sample is actually the name of an individual
+ in_trait_data = False
+ for item in self.this_trait.data:
+ if self.this_trait.data[item].name == sample:
+ value = start_vars['value:' + self.this_trait.data[item].name]
+ if value != "x":
+ self.samples.append(self.this_trait.data[item].name)
+ self.vals.append(value)
+ in_trait_data = True
+ break
+ if not in_trait_data:
+ value = start_vars.get('value:' + sample)
+ if value:
+ self.samples.append(sample)
+ self.vals.append(value)
#ZS: Check if genotypes exist in the DB in order to create links for markers
if "geno_db_exists" in start_vars:
diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html
index f31c5fe5..ba4d4d7c 100644
--- a/wqflask/wqflask/templates/mapping_results.html
+++ b/wqflask/wqflask/templates/mapping_results.html
@@ -22,6 +22,7 @@
{% endif %}
<input type="hidden" name="results_path" value="{{ mapping_results_path }}">
<input type="hidden" name="method" value="{{ mapping_method }}">
+ <input type="hidden" name="samples" value="{{ samples|join(",") }}">
{% for sample in samples %}
<input type="hidden" name="value:{{ sample }}" value="{{ vals[loop.index - 1] }}">
{% endfor %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index d0c75a5b..109e30cc 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -585,6 +585,7 @@ def mapping_results_page():
'dataset',
'group',
'species',
+ 'samples',
'vals',
'first_run',
'gwa_filename',