.. _`bio/cooltools/expected_trans`: COOLTOOLS EXPECTED_TRANS ======================== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/cooltools/expected_trans?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/cooltools/expected_trans Calculate trans expected 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_expected_trans: input: cooler="CN.mm9.1000kb.mcool", ## Multiresolution cooler file view="mm9_view.txt", ## File with the region names and coordinates output: "{sample}_{resolution,[0-9]+}.trans.expected.tsv", params: ## Add optional parameters extra="", threads: 4 log: "logs/{sample}_{resolution}_trans_expected.log", wrapper: "v3.0.1/bio/cooltools/expected_trans" 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) * (optional) view, a bed-style file with region coordinates and names to use for analysis **Output:** * A .tsv file with mean interaction frequency between chromosomes. 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}" extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=False, 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 expected-trans" " {snakemake.input.cooler}::resolutions/{resolution} " " {view} " " -p {snakemake.threads} " " {extra} " " -o {snakemake.output}) {log}" ) .. |nl| raw:: html