本文整理汇总了Python中pypeline.common.fileutils.reroot_path函数的典型用法代码示例。如果您正苦于以下问题:Python reroot_path函数的具体用法?Python reroot_path怎么用?Python reroot_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reroot_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _run
def _run(self, _config, temp):
table = {}
for filename in self.input_files:
coverage.read_table(table, filename)
coverage.write_table(table, reroot_path(temp, self._output_file))
move_file(reroot_path(temp, self._output_file), self._output_file)
开发者ID:UMNPonyClub,项目名称:paleomix,代码行数:7,代码来源:paleomix.py
示例2: _run
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")
开发者ID:schae234,项目名称:pypeline,代码行数:15,代码来源:paml.py
示例3: _teardown
def _teardown(self, config, temp):
for postfix in ("ALIGNMENT", "PARTITION"):
filenames = [self._kwargs["TEMP_IN_" + postfix],
self._kwargs["TEMP_IN_" + postfix] + ".reduced",
self._kwargs["OUT_" + postfix]]
for (source, destination) in zip(filenames, filenames[1:]):
source = fileutils.reroot_path(temp, source)
destination = fileutils.reroot_path(temp, destination)
if not os.path.exists(destination):
fileutils.copy_file(source, destination)
os.remove(source)
CommandNode._teardown(self, config, temp)
开发者ID:CarlesV,项目名称:paleomix,代码行数:15,代码来源:raxml.py
示例4: _check_output_files
def _check_output_files(cls, output_files):
"""Checks dict of output files to nodes for cases where
multiple nodes create the same output file.
The directory component of paths are realized in order to
detect cases where nodes create the same file, but via
different paths (e.g. due to relative/absolute paths, or
due to use of symbolic links). Since output files are
replaced, not modified in place, it is not nessesary to
compare files themselves."""
dirpath_cache, real_output_files = {}, {}
for (filename, nodes) in output_files.iteritems():
dirpath = os.path.dirname(filename)
if dirpath not in dirpath_cache:
dirpath_cache[dirpath] = os.path.realpath(dirpath)
real_output_file = reroot_path(dirpath_cache[dirpath], filename)
real_output_files.setdefault(real_output_file, []).extend(nodes)
for (filename, nodes) in real_output_files.iteritems():
if (len(nodes) > 1):
nodes = _summarize_nodes(nodes)
yield "Multiple nodes create the same (clobber) output-file:" \
"\n\tFilename: %s\n\tNodes: %s" \
% (filename, "\n\t ".join(nodes))
开发者ID:UMNPonyClub,项目名称:paleomix,代码行数:25,代码来源:nodegraph.py
示例5: _teardown
def _teardown(self, config, temp):
# Validate output from MAFFT
output_file = reroot_path(temp, self._output_file)
try:
MSA.from_file(output_file)
except MSAError, error:
raise NodeError("Invalid MSA produced by MAFFT:\n%s" % (error,))
开发者ID:CarlesV,项目名称:paleomix,代码行数:7,代码来源:mafft.py
示例6: _setup
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)
开发者ID:CarlesV,项目名称:paleomix,代码行数:7,代码来源:samtools.py
示例7: _teardown
def _teardown(self, config, temp):
os.remove(os.path.join(temp, "RAxML_info.output"))
source = os.path.join(temp, "RAxML_parsimonyTree.output.0")
destination = fileutils.reroot_path(temp, self._output_tree)
fileutils.move_file(source, destination)
CommandNode._teardown(self, config, temp)
开发者ID:health1987,项目名称:paleomix,代码行数:8,代码来源:examl.py
示例8: _run
def _run(self, _config, temp):
alignment = MSA.from_file(self._input_file)
for (to_filter, groups) in self._filter_by.iteritems():
alignment = alignment.filter_singletons(to_filter, groups)
temp_filename = fileutils.reroot_path(temp, self._output_file)
with open(temp_filename, "w") as handle:
alignment.to_file(handle)
fileutils.move_file(temp_filename, self._output_file)
开发者ID:beeso018,项目名称:paleomix,代码行数:9,代码来源:sequences.py
示例9: _run
def _run(self, _config, temp):
msas = []
for filename in sorted(self._infiles):
split_by = self._infiles[filename].get("partition_by", self._part_by)
for (key, msa) in sorted(split_msa(read_msa(filename), split_by).items()):
for excluded_group in self._excluded:
msa.pop(excluded_group)
msas.append(("%s_%s" % (self._infiles[filename]["name"], key), msa))
msa = join_msa(*(msa for (_, msa) in msas))
with open(reroot_path(temp, self._out_prefix + ".phy"), "w") as output:
output.write(interleaved_phy(msa, add_flag = self._add_flag))
with open(reroot_path(temp, self._out_prefix + ".partitions"), "w") as output:
end = 0
for (name, msa) in msas:
length = len(msa.itervalues().next())
output.write("DNA, %s = %i-%i\n" % (name, end + 1, end + length))
end += length
开发者ID:schae234,项目名称:pypeline,代码行数:19,代码来源:formats.py
示例10: _run
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
开发者ID:CarlesV,项目名称:paleomix,代码行数:10,代码来源:paml.py
示例11: _run
def _run(self, config, temp):
region_names = self._create_tables(config, temp)
table = {}
for (key, (filename, handle)) in self._tables.iteritems():
handle.close()
self._read_table(key, table, filename)
temp_filename = reroot_path(temp, self._output_file)
self._write_table(table, temp_filename, region_names)
开发者ID:schae234,项目名称:pypeline,代码行数:10,代码来源:depthhist.py
示例12: _run
def _run(self, _config, temp):
# Read and check that MSAs share groups
msas = [MSA.from_file(filename) for filename in sorted(self.input_files)]
MSA.validate(*msas)
blocks = []
for msa in msas:
blocks.append(sequential_phy(msa, add_flag = self._add_flag))
with open(reroot_path(temp, self._out_phy), "w") as output:
output.write("\n\n".join(blocks))
开发者ID:CarlesV,项目名称:paleomix,代码行数:11,代码来源:formats.py
示例13: __init__
def __init__(self, description, destination, source_nodes):
source_nodes = safe_coerce_to_tuple(source_nodes)
input_files = []
for source_node in source_nodes:
input_files.extend(source_node.output_files)
output_files = [reroot_path(destination, fpath) for fpath in input_files]
self._files = zip(input_files, output_files)
Node.__init__(self,
description = "<Copy %s output to %r>" % (description, destination),
input_files = input_files,
output_files = output_files,
dependencies = source_nodes)
开发者ID:CarlesV,项目名称:paleomix,代码行数:15,代码来源:misc.py
示例14: __init__
def __init__(self, input_files, destination, filter_by, dependencies=()):
subnodes = []
filter_by = dict(filter_by)
for (filename, node) in input_files.iteritems():
output_filename = fileutils.reroot_path(destination, filename)
subnodes.append(FilterSingletonsNode(input_file=filename,
output_file=output_filename,
filter_by=filter_by,
dependencies=node))
MetaNode.__init__(self,
description="<FilterSingleton: %i files -> '%s'>"
% (len(subnodes), destination),
subnodes=subnodes,
dependencies=dependencies)
开发者ID:UMNPonyClub,项目名称:paleomix,代码行数:15,代码来源:sequences.py
示例15: _run
def _run(self, _config, temp):
alignment = msa.read_msa(self._input_file)
for (to_filter, groups) in self._filter_by.iteritems():
sequences = [alignment[group] for group in groups]
sequence = list(alignment[to_filter])
for (index, nts) in enumerate(zip(*sequences)):
nt = sequence[index]
if (nt not in "Nn-") and (nts.count(nt) == 1):
sequence[index] = 'n'
alignment[to_filter] = "".join(sequence)
temp_filename = fileutils.reroot_path(temp, self._output_file)
msa.write_msa(alignment, temp_filename)
fileutils.move_file(temp_filename, self._output_file)
开发者ID:schae234,项目名称:pypeline,代码行数:16,代码来源:sequences.py
示例16: _run
def _run(self, _config, temp):
if self._seed is not None:
rng = random.Random(self._seed)
partitions = _read_partitions(self._input_part)
header, names, sequences = _read_sequences(self._input_phy)
bootstraps = self._bootstrap_sequences(sequences, partitions, rng)
temp_fpath = reroot_path(temp, self._output_phy)
with open(temp_fpath, "w") as output_phy:
output_phy.write(header)
for (name, fragments) in zip(names, bootstraps):
output_phy.write(name)
output_phy.write(" ")
for sequence in fragments:
output_phy.write(sequence)
output_phy.write("\n")
move_file(temp_fpath, self._output_phy)
开发者ID:CarlesV,项目名称:paleomix,代码行数:19,代码来源:phylip.py
示例17: _teardown
def _teardown(self, config, temp):
temp_filename = reroot_path(temp, self._output_file)
move_file(temp_filename, self._output_file)
for filename in self._pipes.itervalues():
os.remove(filename)
for (filename, _) in self._tables.itervalues():
os.remove(filename)
intervals = os.path.join(temp, "intervals.bed")
if os.path.exists(intervals):
os.remove(intervals)
for proc in self._procs.get("cat", ()):
proc.commit(temp)
if not self._print_stats:
os.remove(os.path.join(temp, "pipe_coverage_%i.stdout" % id(self)))
开发者ID:schae234,项目名称:pypeline,代码行数:19,代码来源:depthhist.py
示例18: _run
def _run(self, config, temp):
rois = self._stat_areas_of_interest(self._prefixes)
genomes = self._stat_prefixes(self._prefixes)
with open(reroot_path(temp, self._output_file), "w") as table:
table.write("# Command:\n")
table.write("# %s\n" % (" ".join(sys.argv)))
table.write("#\n")
table.write("# Directory:\n")
table.write("# %s\n" % (os.getcwd()))
table.write("#\n")
table.write("# Makefile:\n")
table.write("# Filename: %s\n" % (self._makefile["Filename"],))
table.write("# SHA1Sum: %s\n" % (self._makefile["Hash"],))
table.write("# MTime: %s\n" % (self._makefile["MTime"],))
table.write("#\n")
self._write_genomes(table, genomes)
table.write("#\n")
self._write_areas_of_interest(table, rois)
table.write("#\n#\n")
for roi in rois.itervalues():
genomes[roi["Label"]] = {"Size": roi["Size"]}
self._write_tables(table, genomes)
开发者ID:UMNPonyClub,项目名称:paleomix,代码行数:23,代码来源:summary.py
示例19: _teardown
def _teardown(self, _config, temp):
for destination in sorted(self._outfiles):
source = fileutils.reroot_path(temp, destination)
fileutils.move_file(source, destination)
开发者ID:beeso018,项目名称:paleomix,代码行数:4,代码来源:sequences.py
示例20: _setup
def _setup(self, _config, temp):
os.symlink(self._in_reference, reroot_path(temp, self._in_reference))
开发者ID:UMNPonyClub,项目名称:paleomix,代码行数:2,代码来源:picard.py
注:本文中的pypeline.common.fileutils.reroot_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论