def __init__(self, samples, prefix, output_prefix, dependencies=()): abs_prefix = os.path.abspath(prefix) script = rtools.rscript("zonkey", "pca.r") call = [ "Rscript", script, abs_prefix, "%(IN_SAMPLES)s", "%(TEMP_OUT_PREFIX)s" ] cmd = AtomicCmd(call, AUX_SCRIPT=script, IN_FILE_EVAL=prefix + ".eval", IN_FILE_EVEC=prefix + ".evec", IN_SAMPLES=samples, TEMP_OUT_PREFIX=os.path.basename(output_prefix), OUT_PDF=output_prefix + ".pdf", OUT_PNG=output_prefix + ".png", CHECK_R=RSCRIPT_VERSION, CHECK_R_GGPLOT2=rtools.requirement("ggplot2"), CHECK_R_LABELS=rtools.requirement("ggrepel"), set_cwd=True) CommandNode.__init__(self, description="<PlotPCA -> '%s.*'>" % (output_prefix, ), command=cmd, dependencies=dependencies)
def __init__(self, input_file, output_prefix, order, samples, dependencies=()): self._samples = samples self._order = tuple(order) + ("Sample", ) script = rtools.rscript("zonkey", "admixture.r") cmd = AtomicCmd(("Rscript", script, "%(IN_FILE)s", "%(TEMP_OUT_NAMES)s", "%(TEMP_OUT_PREFIX)s"), AUX_RSCRIPT=script, IN_FILE=input_file, IN_SAMPLES=samples, OUT_PDF=output_prefix + ".pdf", OUT_PNG=output_prefix + ".png", TEMP_OUT_NAMES="samples.txt", TEMP_OUT_PREFIX=os.path.basename(output_prefix), CHECK_R=RSCRIPT_VERSION, CHECK_R_GGPLOT2=rtools.requirement("ggplot2"), CHECK_R_RESHAPE2=rtools.requirement("reshape2"), set_cwd=True) CommandNode.__init__(self, description="<AdmixturePlot -> '%s.*'>" % (output_prefix, ), command=cmd, dependencies=dependencies)
def __init__(self, samples, prefix, output_prefix, dependencies=()): abs_prefix = os.path.abspath(prefix) script = rtools.rscript("zonkey", "pca.r") call = ["Rscript", script, abs_prefix, "%(IN_SAMPLES)s", "%(TEMP_OUT_PREFIX)s"] cmd = AtomicCmd(call, AUX_SCRIPT=script, IN_FILE_EVAL=prefix + ".eval", IN_FILE_EVEC=prefix + ".evec", IN_SAMPLES=samples, TEMP_OUT_PREFIX=os.path.basename(output_prefix), OUT_PDF=output_prefix + ".pdf", OUT_PNG=output_prefix + ".png", CHECK_R=RSCRIPT_VERSION, CHECK_R_GGPLOT2=rtools.requirement("ggplot2"), CHECK_R_LABELS=rtools.requirement("directlabels"), set_cwd=True) CommandNode.__init__(self, description="<PlotPCA -> '%s.*'>" % (output_prefix,), command=cmd, dependencies=dependencies)
def __init__(self, input_file, output_prefix, order, samples, dependencies=()): self._samples = samples self._order = tuple(order) + ("Sample",) script = rtools.rscript("zonkey", "admixture.r") cmd = AtomicCmd(("Rscript", script, "%(IN_FILE)s", "%(TEMP_OUT_NAMES)s", "%(TEMP_OUT_PREFIX)s"), AUX_RSCRIPT=script, IN_FILE=input_file, IN_SAMPLES=samples, OUT_PDF=output_prefix + ".pdf", OUT_PNG=output_prefix + ".png", TEMP_OUT_NAMES="samples.txt", TEMP_OUT_PREFIX=os.path.basename(output_prefix), CHECK_R=RSCRIPT_VERSION, CHECK_R_GGPLOT2=rtools.requirement("ggplot2"), CHECK_R_RESHAPE2=rtools.requirement("reshape2"), set_cwd=True) CommandNode.__init__(self, description="<AdmixturePlot -> '%s.*'>" % (output_prefix,), command=cmd, dependencies=dependencies)
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)
def __init__(self, contigs, mapping, input_file, output_prefix, dependencies=()): self._contigs = contigs self._mapping = dict(zip(mapping.values(), mapping)) self._input_file = input_file script = rtools.rscript("zonkey", "coverage.r") cmd = AtomicCmd( ("Rscript", script, "%(TEMP_OUT_TABLE)s", "%(TEMP_OUT_PREFIX)s"), AUX_RSCRIPT=script, IN_FILE=input_file, TEMP_OUT_TABLE="contigs.table", OUT_PDF=output_prefix + ".pdf", OUT_PNG=output_prefix + ".png", TEMP_OUT_PREFIX=os.path.basename(output_prefix), CHECK_R=RSCRIPT_VERSION, CHECK_R_GGPLOT2=rtools.requirement("ggplot2"), set_cwd=True, ) CommandNode.__init__( self, description="<CoveragePlot -> '%s.*'>" % (output_prefix, ), command=cmd, dependencies=dependencies, )
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)
def _plot_command(cls, input_prefix, *args, **kwargs): script = rtools.rscript("zonkey", "treemix.r") return AtomicCmd(("Rscript", script) + args, AUX_RSCRIPT=script, IN_FILE_COV=input_prefix + ".cov.gz", IN_FILE_COVSE=input_prefix + ".covse.gz", IN_FILE_EDGES=input_prefix + ".edges.gz", IN_FILE_MODELCOV=input_prefix + ".modelcov.gz", IN_FILE_VERTICES=input_prefix + ".vertices.gz", CHECK_R=RSCRIPT_VERSION, CHECK_R_BREW=rtools.requirement("RColorBrewer"), set_cwd=True, **kwargs)
def __init__(self, contigs, input_file, output_prefix, dependencies=()): self._contigs = contigs self._input_file = input_file script = rtools.rscript("zonkey", "coverage.r") cmd = AtomicCmd(("Rscript", script, "%(TEMP_OUT_TABLE)s", "%(TEMP_OUT_PREFIX)s"), AUX_RSCRIPT=script, IN_FILE=input_file, TEMP_OUT_TABLE="contigs.table", OUT_PDF=output_prefix + ".pdf", OUT_PNG=output_prefix + ".png", TEMP_OUT_PREFIX=os.path.basename(output_prefix), CHECK_R=RSCRIPT_VERSION, CHECK_R_GGPLOT2=rtools.requirement("ggplot2"), set_cwd=True) CommandNode.__init__(self, description="<CoveragePlot -> '%s.*'>" % (output_prefix,), command=cmd, dependencies=dependencies)