Ejemplo n.º 1
0
    def _setup(self, config, temp):
        CommandNode._setup(self, config, temp)

        # The temp folder may contain old files:
        # Remove old pipes to prevent failure at _teardown
        for pipe_fname in glob.glob(os.path.join(temp, "pipe*")):
            fileutils.try_remove(pipe_fname)
        # ExaML refuses to overwrite old info files
        fileutils.try_remove(os.path.join(temp, "ExaML_info.Pypeline"))

        # Resume from last checkpoint, if one such was generated
        checkpoints = glob.glob(
            os.path.join(temp, "ExaML_binaryCheckpoint.Pypeline_*"))
        if not checkpoints:
            return

        cache = FileStatusCache()
        if cache.files_up_to_date(checkpoints, self.input_files):
            checkpoints.sort(key=lambda fname: int(fname.rsplit("_", 1)[-1]))

            # FIXME: Less hacky solution to modifying AtomicCmds needed
            self._command._command.append("-R")
            self._command._command.append(checkpoints[-1])
        else:
            for fpath in checkpoints:
                fileutils.try_remove(fpath)
Ejemplo n.º 2
0
    def _setup(self, config, temp):
        CommandNode._setup(self, config, temp)

        # The temp folder may contain old files:
        # Remove old pipes to prevent failure at _teardown
        for pipe_fname in glob.glob(os.path.join(temp, "pipe*")):
            fileutils.try_remove(pipe_fname)
        # ExaML refuses to overwrite old info files
        fileutils.try_remove(os.path.join(temp, "ExaML_info.Pypeline"))

        # Resume from last checkpoint, if one such was generated
        checkpoints = glob.glob(os.path.join(temp,
                                "ExaML_binaryCheckpoint.Pypeline_*"))
        if not checkpoints:
            return

        cache = FileStatusCache()
        if cache.files_up_to_date(checkpoints, self.input_files):
            checkpoints.sort(key=lambda fname: int(fname.rsplit("_", 1)[-1]))

            # FIXME: Less hacky solution to modifying AtomicCmds needed
            self._command._command.append("-R")
            self._command._command.append(checkpoints[-1])
        else:
            for fpath in checkpoints:
                fileutils.try_remove(fpath)
Ejemplo n.º 3
0
 def _setup(self, config, temp):
     CommandNode._setup(self, config, temp)
     for fname in ("3pGtoA_freq.txt", "5pCtoT_freq.txt", "dnacomp.txt",
                   "misincorporation.txt"):
         relpath = os.path.join(self._directory, fname)
         abspath = os.path.abspath(relpath)
         os.symlink(abspath, os.path.join(temp, fname))
Ejemplo n.º 4
0
    def _setup(self, config, temp):
        """See CommandNode._setup."""
        infile = os.path.abspath(self._infile)
        outfile = reroot_path(temp, self._infile)
        os.symlink(infile, outfile)

        CommandNode._setup(self, config, temp)
Ejemplo n.º 5
0
    def _setup(self, config, temp):
        if self._check_fastqs:
            check_fastq_files(self.input_files, self._quality_offset)

        os.mkfifo(os.path.join(temp, self._basename + ".discarded"))
        os.mkfifo(os.path.join(temp, self._basename + ".pair1.truncated"))
        os.mkfifo(os.path.join(temp, self._basename + ".pair2.truncated"))
        os.mkfifo(os.path.join(temp, "uncompressed_input_1"))
        os.mkfifo(os.path.join(temp, "uncompressed_input_2"))

        if self._version == VERSION_15:
            if self._collapse:
                os.mkfifo(os.path.join(temp, self._basename + ".collapsed"))
                os.mkfifo(
                    os.path.join(temp,
                                 self._basename + ".collapsed.truncated"))
            os.mkfifo(
                os.path.join(temp, self._basename + ".singleton.truncated"))
        else:
            os.mkfifo(
                os.path.join(temp,
                             self._basename + ".singleton.aln.truncated"))
            os.mkfifo(
                os.path.join(temp,
                             self._basename + ".singleton.unaln.truncated"))

        CommandNode._setup(self, config, temp)
Ejemplo n.º 6
0
 def _setup(self, config, temp):
     CommandNode._setup(self, config, temp)
     for fname in ("3pGtoA_freq.txt", "5pCtoT_freq.txt", "dnacomp.txt",
                   "misincorporation.txt"):
         relpath = os.path.join(self._directory, fname)
         abspath = os.path.abspath(relpath)
         os.symlink(abspath, os.path.join(temp, fname))
Ejemplo n.º 7
0
    def _setup(self, config, temp):
        for key in ("IN_ALIGNMENT", "IN_PARTITION"):
            source = os.path.abspath(self._kwargs[key])
            destination = os.path.join(temp, self._kwargs["TEMP_" + key])

            os.symlink(source, destination)

        CommandNode._setup(self, config, temp)
Ejemplo n.º 8
0
    def _setup(self, config, temp):
        for key in ("IN_ALIGNMENT", "IN_PARTITION"):
            source = self._kwargs[key]
            destination = os.path.join(temp, self._kwargs["TEMP_" + key])

            fileutils.copy_file(source, destination)

        CommandNode._setup(self, config, temp)
Ejemplo n.º 9
0
    def _setup(self, config, temp):
        for key in ("IN_ALIGNMENT", "IN_PARTITION"):
            source      = self._kwargs[key]
            destination = os.path.join(temp, self._kwargs["TEMP_" + key])

            fileutils.copy_file(source, destination)

        CommandNode._setup(self, config, temp)
Ejemplo n.º 10
0
    def _setup(self, config, temp):
        check_fastq_files(self.input_files, self._quality_offset)

        os.mkfifo(os.path.join(temp, self._basename + ".truncated"))
        os.mkfifo(os.path.join(temp, self._basename + ".discarded"))
        os.mkfifo(os.path.join(temp, "uncompressed_input"))

        CommandNode._setup(self, config, temp)
Ejemplo n.º 11
0
    def _setup(self, config, temp):
        check_fastq_files(self.input_files, self._quality_offset)

        os.mkfifo(os.path.join(temp, self._basename + ".truncated"))
        os.mkfifo(os.path.join(temp, self._basename + ".discarded"))
        os.mkfifo(os.path.join(temp, "uncompressed_input"))

        CommandNode._setup(self, config, temp)
Ejemplo n.º 12
0
    def _setup(self, config, temp):
        for key in ("IN_ALIGNMENT", "IN_PARTITION"):
            source      = os.path.abspath(self._kwargs[key])
            destination = os.path.join(temp, self._kwargs["TEMP_" + key])

            os.symlink(source, destination)

        CommandNode._setup(self, config, temp)
Ejemplo n.º 13
0
    def _setup(self, config, temp):
        CommandNode._setup(self, config, temp)

        # Required to avoid the creation of files outside the temp folder
        for filename in self._symlinks:
            source = os.path.abspath(filename)
            destination = os.path.join(temp, os.path.basename(filename))

            os.symlink(source, destination)
Ejemplo n.º 14
0
    def _setup(self, config, temp):
        CommandNode._setup(self, config, temp)

        # Required to avoid the creation of files outside the temp folder
        for filename in self._symlinks:
            source      = os.path.abspath(filename)
            destination = os.path.join(temp, os.path.basename(filename))

            os.symlink(source, destination)
Ejemplo n.º 15
0
    def _setup(self, config, temp_root):
        CommandNode._setup(self, config, temp_root)
        dst_fname = os.path.join(temp_root, self._bam_input.pipe)
        if len(self._bam_input.files) > 1:
            os.mkfifo(dst_fname)
        else:
            src_fname, = self._bam_input.files
            os.symlink(os.path.join(os.getcwd(), src_fname), dst_fname)

            src_fname = os.path.join(os.getcwd(), swap_ext(src_fname, ".bai"))
            os.symlink(src_fname, dst_fname + ".bai")
Ejemplo n.º 16
0
    def _setup(self, config, temp_root):
        CommandNode._setup(self, config, temp_root)
        dst_fname = os.path.join(temp_root, self._bam_input.pipe)
        if len(self._bam_input.files) > 1:
            os.mkfifo(dst_fname)
        else:
            src_fname, = self._bam_input.files
            os.symlink(os.path.join(os.getcwd(), src_fname), dst_fname)

            src_fname = os.path.join(os.getcwd(), swap_ext(src_fname, ".bai"))
            os.symlink(src_fname, dst_fname + ".bai")
Ejemplo n.º 17
0
    def _setup(self, config, temp):
        os.mkfifo(os.path.join(temp, self._basename + ".discarded"))
        os.mkfifo(os.path.join(temp, self._basename + ".pair1.truncated"))
        os.mkfifo(os.path.join(temp, self._basename + ".pair2.truncated"))
        os.mkfifo(os.path.join(temp, "uncompressed_input_1"))
        os.mkfifo(os.path.join(temp, "uncompressed_input_2"))

        if self._version == VERSION_15:
            os.mkfifo(os.path.join(temp, self._basename + ".collapsed"))
            os.mkfifo(os.path.join(temp, self._basename + ".collapsed.truncated"))
            os.mkfifo(os.path.join(temp, self._basename + ".singleton.truncated"))
        else:
            os.mkfifo(os.path.join(temp, self._basename + ".singleton.aln.truncated"))
            os.mkfifo(os.path.join(temp, self._basename + ".singleton.unaln.truncated"))

        CommandNode._setup(self, config, temp)
Ejemplo n.º 18
0
 def _do_test_commandnode_setup(kwargs):
     cmd_mock = _build_cmd_mock(**kwargs)
     node = CommandNode(cmd_mock)
     node._setup(None, None)
Ejemplo n.º 19
0
 def _setup(self, config, temp):
     CommandNode._setup(self, config, temp)
     os.mkfifo(os.path.join(temp, self._basename))
Ejemplo n.º 20
0
 def _setup(self, config, temp):
     CommandNode._setup(self, config, temp)
     os.mkfifo(os.path.join(temp, self._basename))
Ejemplo n.º 21
0
 def _setup(self, config, temp):
     os.symlink(os.path.abspath(self._input_alignment),
                os.path.join(temp, "RAxML_alignment"))
     os.symlink(os.path.abspath(self._input_partitions),
                os.path.join(temp, "RAxML_partitions"))
     CommandNode._setup(self, config, temp)
Ejemplo n.º 22
0
    def _setup(self, config, temp):
        os.mkfifo(os.path.join(temp, self._basename + ".truncated"))
        os.mkfifo(os.path.join(temp, self._basename + ".discarded"))
        os.mkfifo(os.path.join(temp, "uncompressed_input"))

        CommandNode._setup(self, config, temp)
Ejemplo n.º 23
0
    def _setup(self, config, temp):
        os.mkfifo(os.path.join(temp, self._basename + ".truncated"))
        os.mkfifo(os.path.join(temp, self._basename + ".discarded"))
        os.mkfifo(os.path.join(temp, "uncompressed_input"))

        CommandNode._setup(self, config, temp)
Ejemplo n.º 24
0
 def _do_test_commandnode_setup(kwargs):
     cmd_mock = _build_cmd_mock(**kwargs)
     node = CommandNode(cmd_mock)
     node._setup(None, None)
Ejemplo n.º 25
0
 def _setup(self, config, temp):
     os.symlink(os.path.abspath(self._input_alignment),  os.path.join(temp, "RAxML_alignment"))
     os.symlink(os.path.abspath(self._input_partitions), os.path.join(temp, "RAxML_partitions"))
     CommandNode._setup(self, config, temp)