.. _`bio/cooltools/genome/binnify`: COOLTOOLS GENOME_BINNIFY ======================== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/cooltools/genome/binnify?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/cooltools/genome/binnify Split chromosomes into equal sized bins **URL**: https://github.com/open2c/cooltools Example ------- This wrapper can be used in the following way: .. code-block:: python rule cooltools_genome_binnify: input: chromsizes="hg38_chromsizes.txt", ## Chromsizes file output: "hg38_1000000_bins.bed", params: binsize=1000000, threads: 1 log: "logs/binnify.log", wrapper: "v3.0.1/bio/cooltools/genome/binnify" 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.5.4`` Input/Output ------------ **Input:** * a chromsizes file **Output:** * A .bed file with bin coordinates. Can have a {binsize} wildcard that specifies the resolution for the analysis, then it doesn't need to be specified as a parameter. Params ------ * ``binsize``: size of bins in bp. 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 binsize = snakemake.params.get("binsize", snakemake.wildcards.get("binsize", 0)) if not binsize: raise ValueError("Please specify binsize either as a wildcard or as a parameter") extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=False, stderr=True) shell( "(cooltools genome binnify" " {snakemake.input.chromsizes} {binsize} " " {extra} " " > {snakemake.output}) {log}" ) .. |nl| raw:: html