本文整理汇总了Python中paleomix.node.CommandNode._setup方法的典型用法代码示例。如果您正苦于以下问题:Python CommandNode._setup方法的具体用法?Python CommandNode._setup怎么用?Python CommandNode._setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paleomix.node.CommandNode
的用法示例。
在下文中一共展示了CommandNode._setup方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
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)
示例2: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
def _setup(self, config, temp):
CommandNode._setup(self, config, temp)
input_files = [
self._input_file,
fileutils.swap_ext(self._input_file, ".bim"),
fileutils.swap_ext(self._input_file, ".fam"),
]
for filename in input_files:
basename = os.path.basename(filename)
os.symlink(os.path.abspath(filename), os.path.join(temp, basename))
if self._supervised:
fam_filename = fileutils.swap_ext(self._input_file, ".fam")
pop_filename = fileutils.swap_ext(fam_filename, ".pop")
pop_filename = fileutils.reroot_path(temp, pop_filename)
key = "Group(%i)" % (self._k_groups,)
with open(fam_filename) as fam_handle:
with open(pop_filename, "w") as pop_handle:
for line in fam_handle:
sample, _ = line.split(None, 1)
group = self._samples.get(sample, {}).get(key, "-")
pop_handle.write("%s\n" % (group,))
示例3: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
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))
示例4: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
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 not cache.are_files_outdated(self.input_files, checkpoints):
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)
示例5: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
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)
示例6: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
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)
if self._bam_input.indexed:
src_fname = os.path.join(os.getcwd(), swap_ext(src_fname, ".bai"))
os.symlink(src_fname, dst_fname + ".bai")
示例7: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
def _setup(self, config, temp):
CommandNode._setup(self, config, temp)
pipe_fname = os.path.join(temp, self.PIPE_FILE)
if len(self._input_bams) > 1:
os.mkfifo(pipe_fname)
else:
source_fname = os.path.abspath(self._input_bams[0])
os.symlink(source_fname, pipe_fname)
if self._index_format:
os.symlink(swap_ext(source_fname, self._index_format),
swap_ext(pipe_fname, self._index_format))
示例8: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
def _setup(self, config, temp):
with open(self._bootstraps) as handle:
bootstraps = [Newick.from_string(line.strip())
for line in handle]
with open(self._treefile) as handle:
tree = Newick.from_string(handle.read().strip())
tree = tree.reroot_on_midpoint()
tree = tree.add_support(bootstraps, "{Percentage:.0f}")
with open(os.path.join(temp, "rerooted.newick"), "w") as handle:
handle.write("{}\n".format(tree))
CommandNode._setup(self, config, temp)
示例9: _do_test_commandnode_setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
def _do_test_commandnode_setup(kwargs):
cmd_mock = _build_cmd_mock(**kwargs)
node = CommandNode(cmd_mock)
node._setup(None, None)
示例10: _setup
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import _setup [as 别名]
def _setup(self, config, temp):
CommandNode._setup(self, config, temp)
os.mkfifo(os.path.join(temp, self._basename))