Example #1
0
    def test_wait_for_file(self):
        """wait_for_file should go to sleep if file is not present."""

        # wait_for_file has a debug/test mode, in which it raises an exception
        # instead of going to sleep
        # should not raise anything on valid file
        try:
            wait_for_file("/tmp/denoiser_utils_dummy.tmp", test_mode=True)
        except RuntimeWarning:
            self.fail("wait_for_file fails on valid file")

        # but should raise on file not present
        self.assertRaises(RuntimeWarning, wait_for_file, "/foo/bar/baz", test_mode=True)
Example #2
0
   def test_wait_for_file(self):
      """wait_for_file should go to sleep if file is not present."""
      
      #wait_for_file has a debug/test mode, in which it raises an exception
      # instead of going to sleep
      # should not raise anything on valid file
      try:
         wait_for_file("/tmp/denoiser_utils_dummy.tmp", test_mode=True)
      except RuntimeWarning:
         self.fail("wait_for_file fails on valid file")

      #but should raise on file not present
      self.assertRaises(RuntimeWarning, wait_for_file, "/foo/bar/baz",
                        test_mode=True)
Example #3
0
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)
Example #4
0
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)