diff --git a/bio/bustools/text/environment.yaml b/bio/bustools/text/environment.yaml new file mode 100644 index 0000000000..9ae9af6d85 --- /dev/null +++ b/bio/bustools/text/environment.yaml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - nodefaults +dependencies: + - bustools =0.41 \ No newline at end of file diff --git a/bio/bustools/text/meta.yaml b/bio/bustools/text/meta.yaml new file mode 100644 index 0000000000..44cca8dd68 --- /dev/null +++ b/bio/bustools/text/meta.yaml @@ -0,0 +1,13 @@ +name: bustools text +description: convert bus to tsv files +url: https://github.com/BUStools/bustools#text +author: + - Thibault Dayris +input: + - list of bus files +output: + - Path to TSV output +params: + - extra: Optional parameters, besides `--o/-output` +notes: | + When multiple bus files are provided, only one TSV file is produced. \ No newline at end of file diff --git a/bio/bustools/text/test/Snakefile b/bio/bustools/text/test/Snakefile new file mode 100644 index 0000000000..738036e174 --- /dev/null +++ b/bio/bustools/text/test/Snakefile @@ -0,0 +1,26 @@ +rule test_bustools_text: + input: + "file.bus", + output: + "file.tsv", + threads: 1 + params: + extra="", + log: + "logs/bustools.log", + wrapper: + "master/bio/bustools/text" + + +rule test_bustools_text_list: + input: + ["file.bus", "file2.bus"], + output: + "file2.tsv", + threads: 1 + params: + extra="--flags --pad", + log: + "logs/bustools.log", + wrapper: + "master/bio/bustools/text" diff --git a/bio/bustools/text/test/file.bus b/bio/bustools/text/test/file.bus new file mode 100644 index 0000000000..107f18c486 Binary files /dev/null and b/bio/bustools/text/test/file.bus differ diff --git a/bio/bustools/text/test/file2.bus b/bio/bustools/text/test/file2.bus new file mode 100644 index 0000000000..107f18c486 Binary files /dev/null and b/bio/bustools/text/test/file2.bus differ diff --git a/bio/bustools/text/wrapper.py b/bio/bustools/text/wrapper.py new file mode 100644 index 0000000000..f249cae249 --- /dev/null +++ b/bio/bustools/text/wrapper.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +# conding: utf-8 + +"""snakemake wrapper for bustool text""" + + +__author__ = "Thibault Dayris" +__copyright__ = "Copyright 2022, Thibault Dayris" +__email__ = "thibault.dayris@gustaveroussy.fr" +__license__ = "MIT" + +from snakemake.shell import shell + +log = snakemake.log_fmt_shell(stdout=True, stderr=True) +extra = snakemake.params.get("extra", "") + +bus_files = snakemake.input[0] +if isinstance(bus_files, list): + bus_files = " ".join(bus_files) + +shell("bustools text --output {snakemake.output[0]} {extra} {bus_files} {log}") diff --git a/test.py b/test.py index dc2737716e..87de2d4dc9 100644 --- a/test.py +++ b/test.py @@ -239,6 +239,18 @@ def test_biobambam2_bamsormadup(): ) +@skip_if_not_modified +def test_bustools_text(): + run( + "bio/bustools/text", + ["snakemake", "--cores", "1", "file.tsv", "--use-conda", "-F"] + ) + run( + "bio/bustools/text", + ["snakemake", "--cores", "1", "file2.tsv", "--use-conda", "-F"] + ) + + @skip_if_not_modified def test_open_cravat_run(): run(