Пример #1
0
 def _run(self, config, temp):
     try:
         CommandNode._run(self, config, temp)
     except NodeError, error:
         if self._command.join() == [1, None]:
             with open(fileutils.reroot_path(temp, "template.stdout")) as handle:
                 lines = handle.readlines()
             if lines and ("Giving up." in lines[-1]):
                 error = NodeError("%s\n\n%s" % (error, lines[-1]))
         raise error
Пример #2
0
    def _run(self, config, temp):
        with gzip.open(self._in_vcf) as handle:
            with open(os.path.join(temp, "heterozygous_snps.bed"), "w") as bed:
                for line in handle:
                    if line.startswith("#"):
                        continue

                    fields = line.split("\t", 5)
                    if "," in fields[4]:
                        pos = int(fields[1])
                        bed.write("%s\t%i\t%i\n" % (fields[0], pos - 1, pos))

        CommandNode._run(self, config, temp)
Пример #3
0
    def _run(self, config, temp):
        with gzip.open(self._in_vcf) as handle:
            with open(os.path.join(temp, "heterozygous_snps.bed"), "w") as bed:
                for line in handle:
                    if line.startswith("#"):
                        continue

                    fields = line.split("\t", 5)
                    if "," in fields[4]:
                        pos = int(fields[1])
                        bed.write("%s\t%i\t%i\n" % (fields[0], pos - 1, pos))

        CommandNode._run(self, config, temp)
Пример #4
0
 def _run(self, config, temp):
     try:
         CommandNode._run(self, config, temp)
     except NodeError, error:
         err_message = "DNA damage levels are too low"
         if self._command.join() == [1]:
             fpath = os.path.join(temp, "pipe_mapDamage.stdout")
             with open(fpath) as handle:
                 for line in handle:
                     if err_message in line:
                         line = line.strip().replace("Warning:", "ERROR:")
                         error = NodeError("%s\n\n%s" % (error, line))
                         break
         raise error
Пример #5
0
 def _run(self, config, temp):
     try:
         CommandNode._run(self, config, temp)
     except NodeError, error:
         err_message = "DNA damage levels are too low"
         if self._command.join() == [1]:
             fpath = os.path.join(temp, "pipe_mapDamage.stdout")
             with open(fpath) as handle:
                 for line in handle:
                     if err_message in line:
                         line = line.strip().replace("Warning:", "ERROR:")
                         error = NodeError("%s\n\n%s" % (error, line))
                         break
         raise error
Пример #6
0
    def _run(self, config, temp):
        try:
            CommandNode._run(self, config, temp)
        except NodeError, error:
            # Allow failures due to low coverage
            with open(fileutils.reroot_path(temp, "template.stdout")) as handle:
                codeml = handle.read()
                if "sequences do not have any resolved nucleotides. Giving up." not in codeml:
                    raise error

            with open(fileutils.reroot_path(temp, self._output_prefix + ".codeml"), "a") as handle:
                handle.write("\nWARNING: No resolved nucleotides found, could not process gene.\n")

            import sys
            sys.stderr.write("WARNING: No resolved nucleotides in " + self._output_prefix + "\n")
Пример #7
0
    def _run(self, config, temp):
        try:
            CommandNode._run(self, config, temp)
        except NodeError, error:
            # Allow failures due to low coverage
            with open(fileutils.reroot_path(temp,
                                            "template.stdout")) as handle:
                codeml = handle.read()
                if "sequences do not have any resolved nucleotides. Giving up." not in codeml:
                    raise error

            with open(
                    fileutils.reroot_path(temp,
                                          self._output_prefix + ".codeml"),
                    "a") as handle:
                handle.write(
                    "\nWARNING: No resolved nucleotides found, could not process gene.\n"
                )

            import sys
            sys.stderr.write("WARNING: No resolved nucleotides in " +
                             self._output_prefix + "\n")
Пример #8
0
def test_commandnode_run__call_order():
    cmd_mock = _build_cmd_mock()
    cmd_mock.should_receive("run").with_args("xTMPx").ordered.once
    cmd_mock.should_receive("join").with_args().and_return((0,)).ordered.once
    node = CommandNode(cmd_mock)
    node._run(None, "xTMPx")
Пример #9
0
def test_commandnode_run__call_order():
    cmd_mock = _build_cmd_mock()
    cmd_mock.should_receive("run").with_args("xTMPx").ordered.once
    cmd_mock.should_receive("join").with_args().and_return((0, )).ordered.once
    node = CommandNode(cmd_mock)
    node._run(None, "xTMPx")