.. _`bio/cooltools/pileup`: COOLTOOLS PILEUP ================ .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/cooltools/pileup?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/cooltools/pileup Pileup features for a resolution in an .mcool file **URL**: https://github.com/open2c/cooltools Example ------- This wrapper can be used in the following way: .. code-block:: python rule cooltools_pileup: input: cooler="CN.mm9.1000kb.mcool", ## Multiresolution cooler file features="CN.mm9.toy_features.bed", ## Feature file expected="CN.mm9.toy_expected.tsv", ## Expected file view="CN.mm9.toy_regions.bed", ## File with the region names and coordinates output: "CN_{resolution,[0-9]+}.pileup.npz", params: ## Add optional parameters features_format="bed", ## Format of the features file extra="--aggregate mean", ## Add extra parameters threads: 4 log: "logs/CN_{resolution}_pileup.log", wrapper: "v3.0.1/bio/cooltools/pileup" Note that input, output and log file paths can be chosen freely. When running with .. code-block:: bash snakemake --use-conda the software dependencies will be automatically deployed into an isolated environment before execution. Software dependencies --------------------- * ``cooltools=0.6.1`` Input/Output ------------ **Input:** * a multiresolution cooler file (.mcool) * a file with features to pileup * (optional) file with expected * (optional) view, a bed-style file with region coordinates and names to use for analysis **Output:** * A file (.npz or .h5) with piled up snippets. Can have a {resolution} wildcard that specifies the resolution for the analysis, then it doesn't need to be specified as a parameter. Params ------ * ``resolution``: Optional, can be instead specified as a wildcard in the output * ``extra``: Any additional arguments to pass Authors ------- * Ilya Flyamer Code ---- .. code-block:: python __author__ = "Ilya Flyamer" __copyright__ = "Copyright 2022, Ilya Flyamer" __email__ = "flyamer@gmail.com" __license__ = "MIT" from snakemake.shell import shell ## Extract arguments view = snakemake.input.get("view", "") if view: view = f"--view {view}" expected = snakemake.input.get("expected", "") if expected: expected = f"--expected {expected}" extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) resolution = snakemake.params.get( "resolution", snakemake.wildcards.get("resolution", 0) ) if not resolution: raise ValueError("Please specify resolution either as a wildcard or as a parameter") shell( "(cooltools pileup" " {snakemake.input.cooler}::resolutions/{resolution}" " {snakemake.input.features}" " {expected}" " --features-format {snakemake.params.features_format}" " {view}" " -p {snakemake.threads}" " {extra}" " -o {snakemake.output}) {log}" ) .. |nl| raw:: html