本文整理汇总了Python中paleomix.node.CommandNode.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python CommandNode.__init__方法的具体用法?Python CommandNode.__init__怎么用?Python CommandNode.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paleomix.node.CommandNode
的用法示例。
在下文中一共展示了CommandNode.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, config, reference, intervals, infiles, outfile,
dependencies=()):
self._basename = os.path.basename(outfile)
infiles = safe_coerce_to_tuple(infiles)
jar_file = os.path.join(config.jar_root, "GenomeAnalysisTK.jar")
command = AtomicJavaCmdBuilder(jar_file,
jre_options=config.jre_options)
command.set_option("-T", "IndelRealigner")
command.set_option("-R", "%(IN_REFERENCE)s")
command.set_option("-targetIntervals", "%(IN_INTERVALS)s")
command.set_option("-o", "%(OUT_BAMFILE)s")
command.set_option("--bam_compression", 0)
command.set_option("--disable_bam_indexing")
_set_input_files(command, infiles)
command.set_kwargs(IN_REFERENCE=reference,
IN_REF_DICT=fileutils.swap_ext(reference, ".dict"),
IN_INTERVALS=intervals,
OUT_BAMFILE=outfile,
CHECK_GATK=_get_gatk_version_check(config))
calmd = AtomicCmd(["samtools", "calmd", "-b",
"%(TEMP_IN_BAM)s", "%(IN_REF)s"],
TEMP_IN_BAM=self._basename,
IN_REF=reference,
TEMP_OUT_STDOUT=self._basename + ".calmd",
CHECK_VERSION=SAMTOOLS_VERSION)
description = "<GATK Indel Realigner (aligning): %s -> %r>" \
% (describe_files(infiles), outfile)
CommandNode.__init__(self,
description=description,
command=ParallelCmds([command.finalize(), calmd]),
dependencies=dependencies)
示例2: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, output_prefix, tfam, tped,
indep_filter=None, indep_parameters=None,
plink_parameters=None,
dependencies=()):
temp_prefix = os.path.basename(output_prefix)
plink_cmd = ["plink", "--make-bed", "--noweb",
"--tped", "%(IN_TPED)s",
"--tfam", "%(IN_TFAM)s",
"--out", "%(TEMP_OUT_PREFIX)s"]
plink_cmd.extend(self._parse_parameters(plink_parameters))
command = AtomicCmd(plink_cmd,
IN_TPED=tped,
IN_TFAM=tfam,
TEMP_OUT_PREFIX=temp_prefix,
OUT_BED=output_prefix + ".bed",
OUT_BIM=output_prefix + ".bim",
OUT_FAM=output_prefix + ".fam",
OUT_LOG=output_prefix + ".log",
TEMP_OUT_NOSEX=temp_prefix + ".nosex",
TEMP_OUT_NOF=temp_prefix + ".nof",
CHECK_VERSION=PLINK_VERSION,
set_cwd=True)
CommandNode.__init__(self,
description="<BuildBEDFiles -> '%s.*'>"
% (output_prefix,),
command=command,
dependencies=dependencies)
示例3: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, infile, outfile, genome, from_start=0, from_end=0,
strand_relative=False, dependencies=()):
if type(from_start) != type(from_end):
raise ValueError("Parameters 'from_start' and 'from_end' should "
"be of same type!")
call = ["bedtools", "slop",
"-i", "%(IN_FILE)s",
"-g", "%(IN_GENOME)s",
"-l", str(from_start),
"-r", str(from_end)]
if strand_relative:
call.append("-s")
if type(from_start) is float:
call.append("-pct")
command = AtomicCmd(call,
IN_FILE=infile,
IN_GENOME=genome,
OUT_STDOUT=outfile,
CHECK_VERSION=BEDTOOLS_VERSION)
description = "<SlopBed: '%s' -> '%s'>" % (infile, outfile)
CommandNode.__init__(self,
description=description,
command=command,
dependencies=dependencies)
示例4: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, samples, treefile, bootstraps, output_prefix,
dependencies=()):
rscript = rtools.rscript("zonkey", "tinytree.r")
cmd = AtomicCmd(("Rscript", rscript,
"%(TEMP_OUT_FILE)s",
"%(IN_SAMPLES)s",
"%(TEMP_OUT_PREFIX)s"),
AUX_RSCRIPT=rscript,
IN_SAMPLES=samples,
IN_FILE=treefile,
IN_BOOTSTRAPS=bootstraps,
TEMP_OUT_FILE="rerooted.newick",
TEMP_OUT_PREFIX=os.path.basename(output_prefix),
OUT_TREE_PDF=output_prefix + ".pdf",
OUT_TREE_PNG=output_prefix + ".png",
CHECK_RSCRIPT=RSCRIPT_VERSION,
CHECK_RSCRIPT_APE=rtools.requirement("ape"),
CHECK_RSCRIPT_GGPLOT2=rtools.requirement("ggplot2"),
CHECK_RSCRIPT_GRID=rtools.requirement("grid"))
self._treefile = treefile
self._bootstraps = bootstraps
CommandNode.__init__(self,
description="<DrawPhylogeny -> '%s.*'>"
% (output_prefix,),
command=cmd,
dependencies=dependencies)
示例5: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, infile, index_format='.bai', dependencies=()):
basename = os.path.basename(infile)
if index_format == '.bai':
samtools_version = SAMTOOLS_VERSION
samtools_call = ["samtools", "index", "%(TEMP_IN_BAM)s"]
elif index_format == '.csi':
samtools_version = SAMTOOLS_VERSION_1x
samtools_call = ["samtools", "index", "-c", "%(TEMP_IN_BAM)s"]
else:
raise ValueError("Unknown format type %r; expected .bai or .csi"
% (index_format,))
cmd_link = AtomicCmd(["ln", "-s", "%(IN_BAM)s", "%(TEMP_OUT_BAM)s"],
IN_BAM=infile,
TEMP_OUT_BAM=basename,
set_cwd=True)
cmd_index = AtomicCmd(samtools_call,
TEMP_IN_BAM=basename,
CHECK_SAM=samtools_version)
cmd_rename = AtomicCmd(["mv", "%(TEMP_IN_BAM)s", "%(OUT_BAM)s"],
TEMP_IN_BAM=basename + index_format,
OUT_BAM=swap_ext(infile, index_format))
commands = SequentialCmds((cmd_link, cmd_index, cmd_rename))
CommandNode.__init__(self,
description="<BAMIndex (%s): '%s'>"
% (index_format[1:].upper(), infile),
command=commands,
dependencies=dependencies)
示例6: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, config, input_bams, command, index_format=None,
description=None, threads=1, dependencies=()):
self._input_bams = safe_coerce_to_tuple(input_bams)
self._index_format = index_format
if not self._input_bams:
raise ValueError("No input BAM files specified!")
elif len(self._input_bams) > 1 and index_format:
raise ValueError("BAM index cannot be required for > 1 file")
elif index_format not in (None, ".bai", ".csi"):
raise ValueError("Unknown index format %r" % (index_format,))
if len(self._input_bams) > 1:
merge = picard_command(config, "MergeSamFiles")
merge.set_option("SO", "coordinate", sep="=")
merge.set_option("COMPRESSION_LEVEL", 0, sep="=")
merge.set_option("OUTPUT", "%(TEMP_OUT_BAM)s", sep="=")
# Validation is mostly left to manual ValidateSamFile runs; this
# is because .csi indexed BAM records can have "invalid" bins.
merge.set_option("VALIDATION_STRINGENCY", "LENIENT", sep="=")
merge.add_multiple_options("I", input_bams, sep="=")
merge.set_kwargs(TEMP_OUT_BAM=self.PIPE_FILE)
command = ParallelCmds([merge.finalize(), command])
CommandNode.__init__(self,
command=command,
description=description,
threads=threads,
dependencies=dependencies)
示例7: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, parameters):
self._kwargs = parameters.command.kwargs
CommandNode.__init__(self,
command = parameters.command.finalize(),
description = "<RAxMLReduce: '%s' -> '%s'>" \
% (parameters.input_alignment, parameters.output_alignment),
dependencies = parameters.dependencies)
示例8: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, control_file, sequence_file, trees_file, output_tar,
exclude_groups=(), dependencies=()):
self._exclude_groups = safe_coerce_to_frozenset(exclude_groups)
self._control_file = control_file
self._sequence_file = sequence_file
self._trees_file = trees_file
paml_cmd = AtomicCmd(["codeml", "template.ctl"],
IN_CONTROL_FILE = control_file,
IN_SEQUENCE_FILE = sequence_file,
IN_TREES_FILE = trees_file,
TEMP_OUT_CTL = "template.ctl",
TEMP_OUT_SEQS = "template.seqs",
TEMP_OUT_TREES = "template.trees",
TEMP_OUT_STDOUT = "template.stdout",
TEMP_OUT_STDERR = "template.stderr",
TEMP_OUT_4FOLD = "4fold.nuc",
IN_STDIN = "/dev/null", # Prevent promts from blocking
set_cwd = True,
**CodemlNode._get_codeml_files("TEMP_OUT_CODEML"))
tar_pairs = CodemlNode._get_codeml_files("TEMP_IN_CODEML")
tar_files = ["%%(%s)s" % (key,) for key in tar_pairs]
tar_cmd = AtomicCmd(["tar", "cvzf", "%(OUT_FILE)s"] + tar_files,
OUT_FILE = output_tar,
set_cwd = True,
**tar_pairs)
CommandNode.__init__(self,
description = "<CodemlNode: %r -> %r>" % (sequence_file, output_tar),
command = SequentialCmds([paml_cmd, tar_cmd]),
dependencies = dependencies)
示例9: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, parameters):
command = parameters.command.finalize()
description = "<BWA Index '%s' -> '%s.*'>" % (parameters.input_file,
parameters.prefix)
CommandNode.__init__(self,
command=command,
description=description,
dependencies=parameters.dependencies)
示例10: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, parameters):
self._directory = parameters.directory
description = "<mapDamage (model): %r>" % (parameters.directory,)
CommandNode.__init__(self,
command=parameters.command.finalize(),
description=description,
dependencies=parameters.dependencies)
示例11: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, parameters):
self._symlinks = [os.path.abspath(parameters.input_alignment)]
self._output_tree = os.path.basename(parameters.output_tree)
CommandNode.__init__(self,
command = parameters.command.finalize(),
description = "<Parsimonator: '%s' -> '%s'>" \
% (parameters.input_alignment, parameters.output_tree),
dependencies = parameters.dependencies)
示例12: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, output_prefix, tfam, tped,
indep_filter=None, indep_parameters=None,
plink_parameters=None,
dependencies=()):
assert indep_filter in ('indep',
'indep-pairphase',
'indep-pairwise'), indep_filter
assert len(indep_parameters) == 3, indep_parameters
parameters = self._parse_parameters(plink_parameters)
plink_cmd = ["plink", "--noweb",
"--tped", "%(IN_TPED)s",
"--tfam", "%(IN_TFAM)s",
"--out", "%(TEMP_OUT_PREFIX)s",
'--' + indep_filter]
plink_cmd.extend(indep_parameters)
plink_cmd.extend(parameters)
cmd_indep = AtomicCmd(plink_cmd,
IN_TFAM=tfam,
IN_TPED=tped,
TEMP_OUT_PREFIX="indep",
TEMP_OUT_LOG="indep.log",
TEMP_OUT_NOSEX="indep.nosex",
TEMP_OUT_PRUNE_IN="indep.prune.in",
TEMP_OUT_PRUNE_OUT="indep.prune.out",
set_cwd=True)
basename = os.path.basename(output_prefix)
cmd_filter = AtomicCmd(["plink", "--noweb", "--make-bed",
"--tped", "%(IN_TPED)s",
"--tfam", "%(IN_TFAM)s",
"--extract", "%(TEMP_IN_PRUNE)s",
"--out", "%(TEMP_OUT_PREFIX)s"] +
parameters,
IN_TFAM=tfam,
IN_TPED=tped,
TEMP_OUT_PREFIX=basename,
TEMP_IN_PRUNE="indep.prune.in",
TEMP_OUT_NOSEX=basename + ".nosex",
TEMP_OUT_LOG=basename + ".log",
OUT_LOG=output_prefix + ".log",
OUT_BED=output_prefix + ".bed",
OUT_BIM=output_prefix + ".bim",
OUT_FAM=output_prefix + ".fam",
set_cwd=True)
CommandNode.__init__(self,
description="<BuildFilteredBEDFiles -> '%s.*'>"
% (output_prefix,),
command=SequentialCmds((cmd_indep, cmd_filter)),
dependencies=dependencies)
示例13: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, parameters):
self._output_file = parameters.output_file
description = "<MAFFTNode (%s): '%s' -> '%s'>" \
% (parameters.algorithm,
parameters.input_file,
parameters.output_file)
CommandNode.__init__(self,
command = parameters.command.finalize(),
description = description,
dependencies = parameters.dependencies)
示例14: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, input_file, destination, dependencies=()):
md5_cmd = AtomicCmd(("md5sum", "%(IN_FILE)s"),
IN_FILE=input_file,
OUT_STDOUT=destination)
description = "<MD5Sum %s -> %s>" \
% (input_file, destination)
CommandNode.__init__(self,
description=description,
command=md5_cmd,
dependencies=dependencies)
示例15: __init__
# 需要导入模块: from paleomix.node import CommandNode [as 别名]
# 或者: from paleomix.node.CommandNode import __init__ [as 别名]
def __init__(self, infile, dependencies=()):
self._infile = infile
cmd_faidx = AtomicCmd(["samtools", "faidx", "%(TEMP_IN_FASTA)s"],
TEMP_IN_FASTA=os.path.basename(infile),
IN_FASTA=infile,
OUT_TBI=infile + ".fai",
CHECK_SAM=SAMTOOLS_VERSION)
CommandNode.__init__(self,
description="<FastaIndex: '%s'>" % (infile,),
command=cmd_faidx,
dependencies=dependencies)