# HG changeset patch
# User mvdbeek
# Date 1421252356 -3600
# Node ID de4889098f45b7660a3a869e14a00c33e5a90aad
# Parent 477eac6c4ceaaba3b73bdf10de444c62c3a3944a
Allow whitespace in gene name and fix missing creation of output section.
diff -r 477eac6c4cea -r de4889098f45 DockerToolFactory.py
--- a/DockerToolFactory.py Wed Dec 03 01:47:58 2014 +0100
+++ b/DockerToolFactory.py Wed Jan 14 17:19:16 2015 +0100
@@ -154,24 +154,25 @@
self.image_tag = image_tag
os.chdir(abspath(opts.output_dir))
self.thumbformat = 'png'
- self.toolname = re.sub('[^a-zA-Z0-9_]+', '', opts.tool_name) # a sanitizer now does this but..
+ self.toolname_sanitized = re.sub('[^a-zA-Z0-9_]+', '_', opts.tool_name) # a sanitizer now does this but..
+ self.toolname = opts.tool_name
self.toolid = self.toolname
self.myname = sys.argv[0] # get our name because we write ourselves out as a tool later
self.pyfile = self.myname # crude but efficient - the cruft won't hurt much
- self.xmlfile = '%s.xml' % self.toolname
+ self.xmlfile = '%s.xml' % self.toolname_sanitized
s = open(self.opts.script_path,'r').readlines()
s = [x.rstrip() for x in s] # remove pesky dos line endings if needed
self.script = '\n'.join(s)
- fhandle,self.sfile = tempfile.mkstemp(prefix=self.toolname,suffix=".%s" % (opts.interpreter))
+ fhandle,self.sfile = tempfile.mkstemp(prefix=self.toolname_sanitized,suffix=".%s" % (opts.interpreter))
tscript = open(self.sfile,'w') # use self.sfile as script source for Popen
tscript.write(self.script)
tscript.close()
self.indentedScript = '\n'.join([' %s' % html_escape(x) for x in s]) # for restructured text in help
self.escapedScript = '\n'.join([html_escape(x) for x in s])
- self.elog = os.path.join(self.opts.output_dir,"%s_error.log" % self.toolname)
+ self.elog = os.path.join(self.opts.output_dir,"%s_error.log" % self.toolname_sanitized)
if opts.output_dir: # may not want these complexities
- self.tlog = os.path.join(self.opts.output_dir,"%s_runner.log" % self.toolname)
- art = '%s.%s' % (self.toolname,opts.interpreter)
+ self.tlog = os.path.join(self.opts.output_dir,"%s_runner.log" % self.toolname_sanitized)
+ art = '%s.%s' % (self.toolname_sanitized,opts.interpreter)
artpath = os.path.join(self.opts.output_dir,art) # need full path
artifact = open(artpath,'w') # use self.sfile as script source for Popen
artifact.write(self.script)
@@ -187,7 +188,7 @@
for input in opts.input_tab:
a(input)
if opts.output_tab == 'None': #If tool generates only HTML, set output name to toolname
- a(str(self.toolname)+'.out')
+ a(str(self.toolname_sanitized)+'.out')
a(opts.output_tab)
for param in opts.additional_parameters:
param, value=param.split(',')
@@ -196,9 +197,9 @@
#print self.cl
self.outFormats = opts.output_format
self.inputFormats = [formats for formats in opts.input_formats]
- self.test1Input = '%s_test1_input.xls' % self.toolname
- self.test1Output = '%s_test1_output.xls' % self.toolname
- self.test1HTML = '%s_test1_output.html' % self.toolname
+ self.test1Input = '%s_test1_input.xls' % self.toolname_sanitized
+ self.test1Output = '%s_test1_output.xls' % self.toolname_sanitized
+ self.test1HTML = '%s_test1_output.html' % self.toolname_sanitized
def makeXML(self):
"""
@@ -274,10 +275,10 @@
%(help)s
-""" # needs a dict with toolname, toolid, interpreter, scriptname, command, inputs as a multi line string ready to write, outputs ditto, help ditto
+""" # needs a dict with toolname, toolname_sanitized, toolid, interpreter, scriptname, command, inputs as a multi line string ready to write, outputs ditto, help ditto
newCommand="""
- %(toolname)s.py --script_path "$runMe" --interpreter "%(interpreter)s"
+ %(toolname_sanitized)s.py --script_path "$runMe" --interpreter "%(interpreter)s"
--tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s """
# may NOT be an input or htmlout - appended later
tooltestsTabOnly = """
@@ -355,6 +356,7 @@
xdict['inputs'] = ''
# I find setting the job name not very logical. can be changed in workflows anyway. xdict['inputs'] += ' \n' % self.toolname
xdict['toolname'] = self.toolname
+ xdict['toolname_sanitized'] = self.toolname_sanitized
xdict['toolid'] = self.toolid
xdict['interpreter'] = self.opts.interpreter
xdict['scriptname'] = self.sfile
@@ -364,7 +366,7 @@
else:
xdict['command_outputs'] += ' --output_dir "./"'
#print self.opts.output_tab
- if not self.opts.output_tab:
+ if self.opts.output_tab!="None":
xdict['command_outputs'] += ' --output_tab "$tab_file"'
xdict['outputs'] += ' \n' % self.outFormats
xdict['command'] = newCommand % xdict
@@ -380,13 +382,13 @@
def makeTooltar(self):
"""
a tool is a gz tarball with eg
- /toolname/tool.xml /toolname/tool.py /toolname/test-data/test1_in.foo ...
+ /toolname_sanitized/tool.xml /toolname_sanitized/tool.py /toolname_sanitized/test-data/test1_in.foo ...
"""
retval = self.run()
if retval:
print >> sys.stderr,'## Run failed. Cannot build yet. Please fix and retry'
sys.exit(1)
- tdir = self.toolname
+ tdir = self.toolname_sanitized
os.mkdir(tdir)
self.makeXML()
if self.opts.make_HTML:
@@ -412,7 +414,7 @@
shutil.copyfile(self.opts.output_html,os.path.join(testdir,self.test1HTML))
if self.opts.output_dir:
shutil.copyfile(self.tlog,os.path.join(testdir,'test1_out.log'))
- outpif = '%s.py' % self.toolname # new name
+ outpif = '%s.py' % self.toolname_sanitized # new name
outpiname = os.path.join(tdir,outpif) # path for the tool tarball
pyin = os.path.basename(self.pyfile) # our name - we rewrite ourselves (TM)
notes = ['# %s - a self annotated version of %s generated by running %s\n' % (outpiname,pyin,pyin),]
@@ -430,9 +432,9 @@
xtname = os.path.join(tdir,self.xmlfile)
if not os.path.exists(xtname):
shutil.copyfile(self.xmlfile,xtname)
- tarpath = "%s.gz" % self.toolname
+ tarpath = "%s.gz" % self.toolname_sanitized
tar = tarfile.open(tarpath, "w:gz")
- tar.add(tdir,arcname=self.toolname)
+ tar.add(tdir,arcname=self.toolname_sanitized)
tar.close()
shutil.copyfile(tarpath,self.opts.new_tool)
shutil.rmtree(tdir)
diff -r 477eac6c4cea -r de4889098f45 DockerToolFactory.xml
--- a/DockerToolFactory.xml Wed Dec 03 01:47:58 2014 +0100
+++ b/DockerToolFactory.xml Wed Jan 14 17:19:16 2015 +0100
@@ -1,4 +1,4 @@
-
+
Makes scripts into tools using Docker
ghostscript
@@ -75,7 +75,7 @@
-
+
diff -r 477eac6c4cea -r de4889098f45 Dockerfile
--- a/Dockerfile Wed Dec 03 01:47:58 2014 +0100
+++ b/Dockerfile Wed Jan 14 17:19:16 2015 +0100
@@ -27,11 +27,679 @@
RUN Rscript -e 'source("http://bioconductor.org/biocLite.R"); biocLite(c("DESeq", "DESeq2", "edgeR", "EDASeq"))'
RUN Rscript -e 'install.packages(c("latticeExtra", "ggplot2", "reshape", "gridExtra"), dependencies=TRUE, repos="http://cran.us.r-project.org")'
+RUN apt-get install bc
+RUN easy_install intermine
#add galaxy user (could be any username).
#1001 will be replaced by the actual user id of the system user
#executing the galaxy tool, so that file write operations are possible.
-RUN adduser galaxy -u 1001
+RUN adduser galaxy -u 1002
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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