def write_la4ice_done_script(self, output_dir): """ Write cmd to self.la4ice_done_script, the cmd creates a sentinel file indicating all la4ice jobs compeleted. The sentinel file that will be written is output/LA4ICE.DONE. """ cmd = "touch {out}".format(out=op.join(output_dir, "LA4ICE.DONE")) write_cmd_to_script(cmd=cmd, script=self.la4ice_done_script)
def write_daligner_done_script(self, output_dir): """ Write cmd to self.daligner_done_script, the cmd creates a sentinel file indicating all daligner jobs completed. The sentinel file that will be written is output_dir/DALIGNER.DONE. """ cmd = "touch {out}".format(out=op.join(output_dir, "DALIGNER.DONE")) write_cmd_to_script(cmd=cmd, script=self.daligner_done_script)
def sanity_check_sge(sge_opts, scriptDir, testDirName="gcon_test_dir"): """Sanity check if sge can work.""" scriptDir = realpath(scriptDir) testDir = op.join(scriptDir, testDirName) if not op.exists(scriptDir): os.makedirs(scriptDir) if not op.exists(testDir): os.makedirs(testDir) testSh = op.join(scriptDir, 'test.sh') consensusFa = op.join(testDir, "g_consensus.fasta") testInFa = op.join(testDir, "gcon_in.fasta") if op.exists(testInFa): os.remove(testInFa) shutil.copy(GCON_IN_FA, testInFa) assert op.exists(testInFa) cmd = " ".join([ gcon_py, real_upath(testInFa), "{testDir}/g_consensus".format(testDir=real_upath(testDir)), "c1" ]) write_cmd_to_script(cmd=cmd, script=testSh) assert op.exists(testSh) cmd = sge_opts.qsub_cmd(script=real_upath(testSh), num_threads=1, wait_before_exit=True) logging.debug("Submitting cmd: " + cmd) backticks(cmd) if not filecmp.cmp(consensusFa, GCON_OUT_FA): errMsg = "Trouble running qsub or output is not as " + \ "expected ({0} and {1} must agree). Abort!".format( consensusFa, GCON_OUT_FA) logging.error(errMsg) return False else: shutil.rmtree(testDir) logging.info("sge and gcon check passed.") return True
def sanity_check_sge(sge_opts, scriptDir, testDirName="gcon_test_dir"): """Sanity check if sge can work.""" scriptDir = realpath(scriptDir) testDir = op.join(scriptDir, testDirName) if not op.exists(scriptDir): os.makedirs(scriptDir) if not op.exists(testDir): os.makedirs(testDir) testSh = op.join(scriptDir, 'test.sh') consensusFa = op.join(testDir, "g_consensus.fasta") testInFa = op.join(testDir, "gcon_in.fasta") if op.exists(testInFa): os.remove(testInFa) shutil.copy(GCON_IN_FA, testInFa) assert op.exists(testInFa) cmd = " ".join([gcon_py, real_upath(testInFa), "{testDir}/g_consensus".format(testDir=real_upath(testDir)), "c1"]) write_cmd_to_script(cmd=cmd, script=testSh) assert op.exists(testSh) cmd = sge_opts.qsub_cmd(script=real_upath(testSh), num_threads=1, wait_before_exit=True) logging.debug("Submitting cmd: " + cmd) backticks(cmd) if not filecmp.cmp(consensusFa, GCON_OUT_FA): errMsg = "Trouble running qsub or output is not as " + \ "expected ({0} and {1} must agree). Abort!".format( consensusFa, GCON_OUT_FA) logging.error(errMsg) return False else: shutil.rmtree(testDir) logging.info("sge and gcon check passed.") return True