.. _`bio/bustools/sort`: BUSTOOLS SORT ============= .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/bustools/sort?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/bustools/sort Sort raw BUS output from pseudoalignment programs **URL**: https://github.com/BUStools/bustools#sort Example ------- This wrapper can be used in the following way: .. code-block:: python rule test_bustools_sort: input: "file.bus", output: "sorted.bus", threads: 1 resources: mem_mb=765, params: extra="--umi", log: "bustools.log", wrapper: "v3.0.1/bio/bustools/sort" 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. Notes ----- `--temp` is automatically defined through `resources.tmpdir` `--memory` is automatically defined through `resources.mem_mb` Multiple bus files in input will result in a single bus file in output. Software dependencies --------------------- * ``bustools=0.43.1`` * ``snakemake-wrapper-utils=0.6.2`` Input/Output ------------ **Input:** * Path to bus file, or list of bus files **Output:** * Path to bus file Params ------ * ``extra``: Optional parameters Authors ------- Code ---- .. code-block:: python #!/usr/bin/env python3 # coding: utf-8 """Snakemake wrapper for bustools sort""" __author__ = "Thibault Dayris" __copyright__ = "Copyright 2022, Thibault Dayris" __email__ = "thibault.dayris@gustaveroussy.fr" __license__ = "MIT" from snakemake.shell import shell from tempfile import TemporaryDirectory from snakemake_wrapper_utils.snakemake import get_mem log = snakemake.log_fmt_shell(stdout=True, stderr=True) extra = snakemake.params.get("extra", "") bus_files = snakemake.input if isinstance(bus_files, list): bus_files = " ".join(bus_files) mem = get_mem(snakemake, "MiB") with TemporaryDirectory() as tempdir: shell( "bustools sort " "--memory {mem} " "--temp {tempdir} " "--threads {snakemake.threads} " "--output {snakemake.output[0]} " "{bus_files} " "{log}" ) .. |nl| raw:: html