Mercurial > repos > fubar > differential_count_models
comparison rgedgeR/rgToolFactory.py @ 19:372ce0323554 draft
Uploaded
author | fubar |
---|---|
date | Sat, 27 Jul 2013 20:55:31 -0400 |
parents | cd586457aced |
children | 42c28d9fc836 |
comparison
equal
deleted
inserted
replaced
18:1ba6b7c6f4df | 19:372ce0323554 |
---|---|
130 tscript = open(self.sfile,'w') # use self.sfile as script source for Popen | 130 tscript = open(self.sfile,'w') # use self.sfile as script source for Popen |
131 tscript.write(self.script) | 131 tscript.write(self.script) |
132 tscript.close() | 132 tscript.close() |
133 self.indentedScript = '\n'.join([' %s' % x for x in s]) # for restructured text in help | 133 self.indentedScript = '\n'.join([' %s' % x for x in s]) # for restructured text in help |
134 self.escapedScript = '\n'.join([html_escape(x) for x in s]) | 134 self.escapedScript = '\n'.join([html_escape(x) for x in s]) |
135 if opts.output_dir: # may not want these complexities | 135 self.elog = os.path.join(self.opts.output_dir,"%s_error.log" % self.toolname) |
136 if opts.output_dir: # may not want these complexities | |
136 self.tlog = os.path.join(self.opts.output_dir,"%s_runner.log" % self.toolname) | 137 self.tlog = os.path.join(self.opts.output_dir,"%s_runner.log" % self.toolname) |
137 art = '%s.%s' % (self.toolname,opts.interpreter) | 138 art = '%s.%s' % (self.toolname,opts.interpreter) |
138 artpath = os.path.join(self.opts.output_dir,art) # need full path | 139 artpath = os.path.join(self.opts.output_dir,art) # need full path |
139 artifact = open(artpath,'w') # use self.sfile as script source for Popen | 140 artifact = open(artpath,'w') # use self.sfile as script source for Popen |
140 artifact.write(self.script) | 141 artifact.write(self.script) |
513 """ | 514 """ |
514 if self.treatbashSpecial and self.opts.interpreter in ['bash','sh']: | 515 if self.treatbashSpecial and self.opts.interpreter in ['bash','sh']: |
515 retval = self.runBash() | 516 retval = self.runBash() |
516 else: | 517 else: |
517 if self.opts.output_dir: | 518 if self.opts.output_dir: |
519 ste = open(self.elog,'w') | |
518 sto = open(self.tlog,'w') | 520 sto = open(self.tlog,'w') |
519 sto.write('## Toolfactory generated command line = %s\n' % ' '.join(self.cl)) | 521 sto.write('## Toolfactory generated command line = %s\n' % ' '.join(self.cl)) |
520 sto.flush() | 522 sto.flush() |
521 p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=sto,stdin=subprocess.PIPE,cwd=self.opts.output_dir) | 523 p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=elog,stdin=subprocess.PIPE,cwd=self.opts.output_dir) |
522 else: | 524 else: |
523 p = subprocess.Popen(self.cl,shell=False,stdin=subprocess.PIPE) | 525 p = subprocess.Popen(self.cl,shell=False,stdin=subprocess.PIPE) |
524 p.stdin.write(self.script) | 526 p.stdin.write(self.script) |
525 p.stdin.close() | 527 p.stdin.close() |
526 retval = p.wait() | 528 retval = p.wait() |
527 if self.opts.output_dir: | 529 if self.opts.output_dir: |
528 sto.close() | 530 sto.close() |
531 ste.close() | |
532 err = open(self.elog,'r').readlines() | |
533 if retval <> 0 and err: # problem | |
534 print >> sys.stderr,err | |
529 if self.opts.make_HTML: | 535 if self.opts.make_HTML: |
530 self.makeHtml() | 536 self.makeHtml() |
531 return retval | 537 return retval |
532 | 538 |
533 def runBash(self): | 539 def runBash(self): |