本文整理汇总了Python中pypeline.atomiccmd.builder.AtomicCmdBuilder类的典型用法代码示例。如果您正苦于以下问题:Python AtomicCmdBuilder类的具体用法?Python AtomicCmdBuilder怎么用?Python AtomicCmdBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AtomicCmdBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_builder__set_kwargs__after_finalize
def test_builder__set_kwargs__after_finalize():
expected = {"IN_PATH" : "/a/b/"}
builder = AtomicCmdBuilder("echo")
builder.set_kwargs(IN_PATH = "/a/b/")
builder.finalize()
assert_raises(AtomicCmdBuilderError, builder.set_kwargs, OUT_PATH = "/dst/file")
assert_equal(builder.kwargs, expected)
示例2: _bowtie2_template
def _bowtie2_template(call, prefix, iotype = "IN", **kwargs):
params = AtomicCmdBuilder(call, **kwargs)
for postfix in ("1.bt2", "2.bt2", "3.bt2", "4.bt2", "rev.1.bt2", "rev.2.bt2"):
key = "%s_PREFIX_%s" % (iotype, postfix.upper())
params.set_kwargs(**{key : (prefix + "." + postfix)})
return params
示例3: _do_test_builder__pop_option
def _do_test_builder__pop_option(setter):
builder = AtomicCmdBuilder("find")
setter(builder, "-empty", fixed = False)
setter(builder, "-size", "1", fixed = False)
setter(builder, "-name", "*.txt", fixed = False)
builder.pop_option("-size")
assert_equal(builder.call, ["find", "-empty", "-name", "*.txt"])
示例4: _get_common_parameters
def _get_common_parameters(version):
global _DEPRECATION_WARNING_PRINTED
if version == VERSION_14:
version_check = _VERSION_14_CHECK
elif version == VERSION_15:
version_check = _VERSION_15_CHECK
else:
raise CmdError("Unknown version: %s" % version)
cmd = AtomicCmdBuilder("AdapterRemoval",
CHECK_VERSION=version_check)
# Trim Ns at read ends
cmd.set_option("--trimns", fixed=False)
# Trim low quality scores
cmd.set_option("--trimqualities", fixed=False)
try:
if not _DEPRECATION_WARNING_PRINTED and version_check.version < (2, 0):
import pypeline.ui as ui
ui.print_warn("\nWARNING: AdapterRemoval v1.5.x is deprecated;")
ui.print_warn(" Upgrading to 2.1.x is strongly adviced!\n")
ui.print_warn(" Download the newest version of AdapterRemoval at ")
ui.print_warn(" https://github.com/MikkelSchubert/adapterremoval\n")
_DEPRECATION_WARNING_PRINTED = True
except versions.VersionRequirementError:
pass
return cmd
示例5: customize
def customize(cls, input_file, output_file, algorithm = "auto", dependencies = ()):
command = AtomicCmdBuilder(_PRESETS[algorithm.lower()])
command.add_value("%(IN_FASTA)s")
command.set_kwargs(IN_FASTA = input_file,
OUT_STDOUT = output_file,
CHECK_VERSION = MAFFT_VERSION)
return {"command" : command,
"dependencies" : dependencies}
示例6: customize
def customize(cls, infile, intervals, outfile, dependencies = ()):
params = AtomicCmdBuilder(["bam_sample_regions"],
IN_PILEUP = infile,
IN_INTERVALS = intervals,
OUT_STDOUT = outfile)
params.set_option("--genotype", "%(IN_PILEUP)s")
params.set_option("--intervals", "%(IN_INTERVALS)s")
return {"command" : params}
示例7: test_builder__add_multiple_values
def test_builder__add_multiple_values():
values = ("file_a", "file_b")
expected = {"IN_FILE_01": "file_a", "IN_FILE_02": "file_b"}
builder = AtomicCmdBuilder("ls")
kwargs = builder.add_multiple_values(values)
assert_equal(kwargs, expected)
assert_equal(builder.kwargs, expected)
assert_equal(builder.call, ["ls", "%(IN_FILE_01)s", "%(IN_FILE_02)s"])
示例8: test_builder__add_multiple_values_with_template
def test_builder__add_multiple_values_with_template():
values = ("file_a", "file_b")
expected = {"OUT_BAM_1": "file_a", "OUT_BAM_2": "file_b"}
builder = AtomicCmdBuilder("ls")
kwargs = builder.add_multiple_values(values, template="OUT_BAM_%i")
assert_equal(kwargs, expected)
assert_equal(builder.kwargs, expected)
assert_equal(builder.call, ["ls", "%(OUT_BAM_1)s", "%(OUT_BAM_2)s"])
示例9: test_builder__add_multiple_options_with_sep
def test_builder__add_multiple_options_with_sep():
values = ("file_a", "file_b")
expected = {"IN_FILE_01": "file_a", "IN_FILE_02": "file_b"}
builder = AtomicCmdBuilder("ls")
kwargs = builder.add_multiple_options("-i", values, sep="=")
assert_equal(kwargs, expected)
assert_equal(builder.kwargs, expected)
assert_equal(builder.call, ["ls", "-i=%(IN_FILE_01)s", "-i=%(IN_FILE_02)s"])
示例10: test_builder__add_multiple_options_with_template_fixed
def test_builder__add_multiple_options_with_template_fixed():
values = ("file_a", "file_b")
expected = {"IN_FILE_01": "file_a", "IN_FILE_02": "file_b"}
builder = AtomicCmdBuilder("ls")
kwargs = builder.add_multiple_options("-i", values)
assert_equal(kwargs, expected)
assert_equal(builder.kwargs, expected)
assert_raises(AtomicCmdBuilderError,
builder.add_multiple_options, "-i", values)
示例11: test_builder__add_multiple_options_multiple_times
def test_builder__add_multiple_options_multiple_times():
expected = {"IN_FILE_01": "file_a", "IN_FILE_02": "file_b"}
builder = AtomicCmdBuilder("ls")
kwargs = builder.add_multiple_options("-i", ("file_a",))
assert_equal(kwargs, {"IN_FILE_01": "file_a"})
kwargs = builder.add_multiple_options("-i", ("file_b",))
assert_equal(kwargs, {"IN_FILE_02": "file_b"})
assert_equal(builder.kwargs, expected)
assert_equal(builder.call, ["ls", "-i", "%(IN_FILE_01)s", "-i", "%(IN_FILE_02)s"])
示例12: _get_bwa_template
def _get_bwa_template(call, prefix, iotype = "IN", **kwargs):
extensions = ["amb", "ann", "bwt", "pac", "sa"]
try:
if BWA_VERSION.version < (0, 6, 0):
extensions.extend(("rbwt", "rpac", "rsa"))
except versions.VersionRequirementError:
pass # Ignored here, handled elsewhere
params = AtomicCmdBuilder(call, **kwargs)
for postfix in extensions:
key = "%s_PREFIX_%s" % (iotype, postfix.upper())
params.set_kwargs(**{key : (prefix + "." + postfix)})
return params
示例13: _get_common_parameters
def _get_common_parameters(version):
if version == VERSION_14:
version_check = _VERSION_14_CHECK
elif version == VERSION_15:
version_check = _VERSION_15_CHECK
else:
raise CmdError("Unknown version: %s" % version)
cmd = AtomicCmdBuilder("AdapterRemoval",
CHECK_VERSION=version_check)
# Trim Ns at read ends
cmd.set_option("--trimns", fixed=False)
# Trim low quality scores
cmd.set_option("--trimqualities", fixed=False)
return cmd
示例14: test_builder__finalize__calls_atomiccmd
def test_builder__finalize__calls_atomiccmd():
was_called = []
class _AtomicCmdMock:
def __init__(self, *args, **kwargs):
assert_equal(args, (["echo", "-out", "%(OUT_FILE)s", "%(IN_FILE)s"],))
assert_equal(kwargs, {"IN_FILE" : "/in/file", "OUT_FILE" : "/out/file", "set_cwd" : True})
was_called.append(True)
with Monkeypatch("pypeline.atomiccmd.builder.AtomicCmd", _AtomicCmdMock):
builder = AtomicCmdBuilder("echo", set_cwd = True)
builder.add_option("-out", "%(OUT_FILE)s")
builder.add_value("%(IN_FILE)s")
builder.set_kwargs(OUT_FILE = "/out/file",
IN_FILE = "/in/file")
builder.finalize()
assert was_called
示例15: customize
def customize(cls, input_alignment, output_tree, dependencies = ()):
"""
Arguments:
input_alignment -- An alignment file in a format readable by RAxML.
output_tree -- Filename for the output newick tree."""
command = AtomicCmdBuilder("parsimonator", set_cwd = True)
command.set_option("-s", "%(TEMP_OUT_ALN)s")
command.set_option("-n", "output")
# Random seed for the stepwise addition process
command.set_option("-p", int(random.random() * 2**31 - 1), fixed = False)
command.set_kwargs(# Auto-delete: Symlinks
TEMP_OUT_ALN = os.path.basename(input_alignment),
# Input files, are not used directly (see below)
IN_ALIGNMENT = input_alignment,
# Final output file, are not created directly
OUT_TREE = output_tree)
return {"command" : command}