aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-10-29 16:04:19 -0500
committerGitHub2020-10-29 16:04:19 -0500
commitad716823091959a5332173a0fd2a040c969d2712 (patch)
tree4da40a000d14aaed63d3bba7b4ae28fed530a09c
parent6e6911b466c2727b16a190d8b714f55d7842d7e2 (diff)
parent00f7aed2f2da165314bacf33b8fb16d00fc8ec26 (diff)
downloadgenenetwork2-ad716823091959a5332173a0fd2a040c969d2712.tar.gz
Merge pull request #473 from zsloan/reaper_bootstrap_fix
Reaper bootstrap fix
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 65eba7e3..7e43f6bd 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -342,7 +342,7 @@ class DisplayMappingResults(object):
if 'reaper_version' in list(start_vars.keys()) and self.mapping_method == "reaper":
self.reaper_version = start_vars['reaper_version']
if 'output_files' in start_vars:
- self.output_files = ",".join(start_vars['output_files'])
+ self.output_files = ",".join([(the_file if the_file is not None else "") for the_file in start_vars['output_files']])
self.categorical_vars = ""
self.perm_strata = ""
@@ -684,7 +684,7 @@ class DisplayMappingResults(object):
plotXScale = self.drawGraphBackground(canvas, gifmap, offset=newoffset, zoom= zoom, startMb=startMb, endMb = endMb)
#draw bootstap
- if self.bootChecked and not self.multipleInterval and not self.manhattan_plot:
+ if self.bootChecked and not self.multipleInterval:
self.drawBootStrapResult(canvas, self.nboot, drawAreaHeight, plotXScale, offset=newoffset, zoom= zoom, startMb=startMb, endMb = endMb)
# Draw clickable region and gene band if selected
@@ -731,31 +731,34 @@ class DisplayMappingResults(object):
#break bootstrap result into groups
BootCoord = []
i = 0
+ previous_chr = None
+ previous_chr_as_int = 0
startX = xLeftOffset
+ BootChrCoord = []
if self.selectedChr == -1: #ZS: If viewing full genome/all chromosomes
- for j, _chr in enumerate(self.genotype):
- BootCoord.append( [])
- for _locus in _chr:
+ for i, result in enumerate(self.qtlresults):
+ if result['chr'] != previous_chr:
+ previous_chr = result['chr']
+ previous_chr_as_int += 1
+ if previous_chr_as_int != 1:
+ BootCoord.append(BootChrCoord)
+ BootChrCoord = []
+ startX += (self.ChrLengthDistList[previous_chr_as_int - 2] + self.GraphInterval)*plotXScale
+ if self.plotScale == 'physic':
+ Xc = startX + (result['Mb']-self.startMb)*plotXScale
+ else:
+ Xc = startX + (result['cM']-self.qtlresults[0]['cM'])*plotXScale
+ BootChrCoord.append([Xc, self.bootResult[i]])
+ else:
+ for i, result in enumerate(self.qtlresults):
+ if str(result['chr']) == str(self.ChrList[self.selectedChr][0]):
if self.plotScale == 'physic':
- Xc = startX + (_locus.Mb-self.startMb)*plotXScale
+ Xc = startX + (result['Mb']-self.startMb)*plotXScale
else:
- Xc = startX + (_locus.cM-_chr[0].cM)*plotXScale
- BootCoord[-1].append([Xc, self.bootResult[i]])
- i += 1
- startX += (self.ChrLengthDistList[j] + self.GraphInterval)*plotXScale
- else:
- for j, _chr in enumerate(self.genotype):
- if _chr.name == self.ChrList[self.selectedChr][0]:
- BootCoord.append( [])
- for _locus in _chr:
- if _chr.name == self.ChrList[self.selectedChr][0]:
- if self.plotScale == 'physic':
- Xc = startX + (_locus.Mb-startMb)*plotXScale
- else:
- Xc = startX + (_locus.cM-_chr[0].cM)*plotXScale
- BootCoord[-1].append([Xc, self.bootResult[i]])
- i += 1
+ Xc = startX + (result['cM']-self.qtlresults[0]['cM'])*plotXScale
+ BootChrCoord.append([Xc, self.bootResult[i]])
+ BootCoord = [BootChrCoord]
#reduce bootResult
if self.selectedChr > -1:
@@ -1715,9 +1718,6 @@ class DisplayMappingResults(object):
for pixel in range(xLeftOffset, xLeftOffset + plotWidth, pixelStep):
calBase = self.kONE_MILLION*(startMb + (endMb-startMb)*(pixel-xLeftOffset-0.0)/plotWidth)
- if pixel == (xLeftOffset + pixelStep*2):
- logger.debug("CALBASE:", calBase)
- logger.debug("FLANKING:", flankingWidthInBases)
xBrowse1 = pixel
xBrowse2 = min(xLeftOffset + plotWidth, (pixel + pixelStep - 1))