def test_submit_jobs(self): """submit_jobs executes commands on the cluster""" submit_jobs([self.command], prefix="test_job") # Try and wait ten times, could be made nicer with alarm() for i in range(10): if exists(self.tmp_result_file): observed_text = "".join(list(open(self.tmp_result_file))) self.assertEqual(observed_text, "hello\n") return else: sleep(10) # if we get here we failed self.fail("The test job apparently never finished.\n" + "check the jobs error log and check the queue status\n.")
def preprocess_on_cluster(sff_fps, log_fp, fasta_fp=None, out_fp="/tmp/", squeeze=False, verbose=False, primer=STANDARD_BACTERIAL_PRIMER): """Call preprocess via cluster_jobs_script on the cluster. sff_fps: List of paths to flowgram files. log_fp: path to log file fasta_fp: Path to fasta file, formatted as from split_libraries.py. This files is used to filter the flowgrams in sff_fps. Only reads in fasta_fp are pulled from sff_fps. out_fp: path to output directory verbose: a binary verbose flag squeeze: a flag that controls if sequences are squeezed before phase I. Squeezing means consecutive identical nucs are collapsed to one. primer: The primer sequences of the amplification process. This seq will be removed from all reads during the preprocessing """ qiime_config = load_qiime_config() python_bin = qiime_config['python_exe_fp'] cmd = "%s %s/denoiser_preprocess.py -i %s -l %s -o %s" %\ (python_bin, get_qiime_scripts_dir(), ",".join(sff_fps), log_fp, out_fp) if (fasta_fp): cmd += " -f %s" % fasta_fp if (squeeze): cmd += " -s" if verbose: cmd += " -v" if primer: cmd += " -p %s" % primer submit_jobs([cmd], "pp_" + make_tmp_name(6)) wait_for_file(out_fp + "/prefix_mapping.txt", 10)
def preprocess_on_cluster(sff_fps, log_fp, fasta_fp=None, out_fp="/tmp/", squeeze=False, verbose=False, primer=STANDARD_BACTERIAL_PRIMER): """Call preprocess via cluster_jobs_script on the cluster. sff_fps: List of paths to flowgram files. log_fp: path to log file fasta_fp: Path to fasta file, formatted as from split_libraries.py. This files is used to filter the flowgrams in sff_fps. Only reads in fasta_fp are pulled from sff_fps. out_fp: path to output directory verbose: a binary verbose flag squeeze: a flag that controls if sequences are squeezed before phase I. Squeezing means consecutive identical nucs are collapsed to one. primer: The primer sequences of the amplification process. This seq will be removed from all reads during the preprocessing """ qiime_config = load_qiime_config() python_bin = qiime_config['python_exe_fp'] cmd = "%s %s/denoiser_preprocess.py -i %s -l %s -o %s" %\ (python_bin, get_qiime_scripts_dir(), ",".join(sff_fps), log_fp, out_fp) if (fasta_fp): cmd += " -f %s" % fasta_fp if(squeeze): cmd += " -s" if verbose: cmd += " -v" if primer: cmd += " -p %s" % primer submit_jobs([cmd], "pp_" + make_tmp_name(6)) wait_for_file(out_fp + "/prefix_mapping.txt", 10)