Skip to content

Commit

Permalink
feat: Bustools text (#509)
Browse files Browse the repository at this point in the history
* [fix] (template): Missing code in wrappers' doc. Error #187

* Wrapper tested

* test written

* format

* file extension set to tsv

* Update bio/bustools/text/environment.yaml

Co-authored-by: tdayris <tdayris@gustaveroussy.fr>
Co-authored-by: tdayris <thibault.dayris@gustaveroussy.fr>
Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
4 people committed Aug 16, 2022
1 parent 0ea245b commit 00f60b7
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bio/bustools/text/environment.yaml
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
- nodefaults
dependencies:
- bustools =0.41
13 changes: 13 additions & 0 deletions 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.
26 changes: 26 additions & 0 deletions 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"
Binary file added bio/bustools/text/test/file.bus
Binary file not shown.
Binary file added bio/bustools/text/test/file2.bus
Binary file not shown.
21 changes: 21 additions & 0 deletions 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}")
12 changes: 12 additions & 0 deletions test.py
Expand Up @@ -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(
Expand Down

0 comments on commit 00f60b7

Please sign in to comment.