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:
rule test_bustools_sort:
input:
"file.bus",
output:
"sorted.bus",
threads: 1
resources:
mem_mb=765,
params:
extra="--umi",
log:
"bustools.log",
wrapper:
"v1.19.2/bio/bustools/sort"
Note that input, output and log file paths can be chosen freely.
When running with
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.41.0
snakemake-wrapper-utils=0.5.0
Params¶
extra
: Optional parameters
Authors¶
Code¶
#!/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}"
)