# HG changeset patch --
Bitbucket.org
# Project galaxy-dist
# URL
http://bitbucket.org/galaxy/galaxy-dist/overview
# User fubar: ross Lazarus at gmail period com
# Date 1283257544 14400
# Node ID 65edd8e2a3a8872252d9008ad2fe9dee7cbd5856
# Parent 7cc9329fd895049827d1bf5436f6aa11bf9d30ed
Fix for pdfnup blathering to stdout causing buildbot to barf
Small adjustment to file size delta for rgManQQ
--- a/tools/rgenetics/rgManQQ.xml
+++ b/tools/rgenetics/rgManQQ.xml
@@ -44,9 +44,9 @@
<param name='grey' value='0' /><output name='out_html'
file='rgtestouts/rgManQQ/rgManQQtest1.html' ftype='html'
lines_diff='30'><extra_files type="file"
name='Allelep_manhattan.png'
value='rgtestouts/rgManQQ/Allelep_manhattan.png' compare="sim_size"
- delta = "4000"/>
+ delta = "10000"/><extra_files type="file"
name='Allelep_qqplot.png' value='rgtestouts/rgManQQ/Allelep_qqplot.png'
compare="sim_size"
- delta = "4000" />
+ delta = "10000" /><extra_files type="file"
name='rgManQQtest1.R' value='rgtestouts/rgManQQ/rgManQQtest1.R'
compare="diff" lines_diff="160"/></output></test>
--- a/tools/rgenetics/rgManQQ.py
+++ b/tools/rgenetics/rgManQQ.py
@@ -52,6 +52,7 @@ manhattan = function(chrom=NULL,offset=N
lastbase=0
chrlist = unique(d$CHR)
nchr = length(chrlist) # may be any number?
+ if (nchr < 2) {
for (x in c(1:nchr)) {
i = chrlist[x] # need the chrom number - may not == index
if (x == 1) { # first time
@@ -62,8 +63,16 @@ manhattan = function(chrom=NULL,offset=N
d[d$CHR==i, ]$pos=d[d$CHR==i, ]$BP+lastbase
}
ticks=c(ticks, d[d$CHR==i, ]$pos[floor(length(d[d$CHR==i,
]$pos)/2)+1])
- }
- ticklim=c(min(d$pos),max(d$pos))
+ ticklim=c(min(d$pos),max(d$pos))
+ }
+ } else { # nchr >= 2
+ last = max(offset)
+ first = min(offset)
+ ticks = first
+ t = (last-first)/9 # units per tick
+ for (x in c(1:9)) ticks = c(ticks,round(x*t))
+ ticklim = c(first,last)
+ } # else
if (grey)
{mycols=rep(c("gray10","gray60"),max(d$CHR))
} else {
mycols=rep(coloursTouse,max(d$CHR))
--- a/tools/rgenetics/rgQC.py
+++ b/tools/rgenetics/rgQC.py
@@ -270,6 +270,8 @@ def makePlots(markers=[],subjects=[],new
rpy.r.dev_off()
+ fdsto,stofile = tempfile.mkstemp()
+ sto = open(stofile,'w')
import rpy # delay to avoid rpy stdout chatter replacing galaxy file blurb
mog = 'mogrify'
pdfnup = 'pdfnup'
@@ -368,7 +370,7 @@ def makePlots(markers=[],subjects=[],new
expl = 'All %s QC Plots joined into a single pdf' % basename
vcl = '%s %s --outfile %s ' % (pdfjoin,filestojoin, fullafname)
# make single page pdf
- x=subprocess.Popen(vcl,shell=True,cwd=newfpath)
+ x=subprocess.Popen(vcl,shell=True,cwd=newfpath,stderr=sto,stdout=sto)
retval = x.wait()
row = [expl,afname,fullafname]
html.insert(0,row) # last rather than second
@@ -377,15 +379,17 @@ def makePlots(markers=[],subjects=[],new
expl = 'All %s QC Plots %d by %d to a page' % (basename,nup,nup)
vcl = '%s %s --nup %dx%d --frame true --outfile %s' %
(pdfnup,afname,nup,nup,fullnfname)
# make thumbnail images
- x=subprocess.Popen(vcl,shell=True,cwd=newfpath)
+ x=subprocess.Popen(vcl,shell=True,cwd=newfpath,stderr=sto,stdout=sto)
retval = x.wait()
row = [expl,nfname,fullnfname]
html.insert(1,row) # this goes second
vcl = '%s -format jpg -resize %s %s' % (mog, mogresize,
os.path.join(newfpath,'*.pdf'))
# make thumbnail images
- x=subprocess.Popen(vcl,shell=True,cwd=newfpath)
+ x=subprocess.Popen(vcl,shell=True,cwd=newfpath,stderr=sto,stdout=sto)
retval = x.wait()
- return html # elements for an ordered list of urls or whatever..
+ sto.close()
+ cruft = open(stofile,'r').readlines()
+ return html,cruft # elements for an ordered list of urls or whatever..
def
RmakePlots(markers=[],subjects=[],newfpath='.',basename='test',nbreaks='100',nup=3,height=8,width=10,rexe=''):
@@ -1282,7 +1286,7 @@ if __name__ == "__main__":
s = '## starting plotpage, newfpath=%s,m=%s,s=%s/n' %
(newfpath,markers[:2],subjects[:2])
alogf.write(s)
print s
- plotpage = makePlots(markers=markers,subjects=subjects,newfpath=newfpath,
+ plotpage,cruft = makePlots(markers=markers,subjects=subjects,newfpath=newfpath,
basename=basename,nbreaks=nbreaks,height=10,width=8,rgbin=rgbin)
#plotpage =
RmakePlots(markers=markers,subjects=subjects,newfpath=newfpath,basename=basename,nbreaks=nbreaks,rexe=rexe)
@@ -1343,6 +1347,8 @@ if __name__ == "__main__":
lf.write('\n'.join(html))
lf.write('<h4>QC run log contents</h4>')
lf.write('<pre>%s</pre>' % (''.join(llog))) # plink logs
+ if len(cruft) > 0:
+ lf.write('<h2>Blather from pdfnup
follows:</h2><pre>%s</pre>' % (''.join(cruft))) # pdfnup
lf.write('%s\n<hr>\n' % galhtmlpostfix)
lf.close()