PRETEXT MAP

https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/pretext/graph?label=version%20update%20pull%20requests

Embeds bedgraph data into Pretext contact maps.

URL: https://github.com/wtsi-hpag/PretextGraph

Example

This wrapper can be used in the following way:

rule pretext_graph:
    input:
        bedgraph="{a}.bedgraph",
        map="map.pretext",
    output:
        "{a}.pretext",
    log:
        "logs/{a}.pretext_graph.log",
    params:
        graph_name="graph_name",
        extra="",
    wrapper:
        "v3.8.0-1-g149ef14/bio/pretext/graph"

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

  • The extra param allows for additional arguments.

Software dependencies

  • pretextgraph=0.0.6

Input/Output

Input:

  • BEDgraph file

Output:

  • pretext contact map

Authors

  • Filipe G. Vieira

Code

__author__ = "Filipe G. Vieira"
__copyright__ = "Copyright 2022, Filipe G. Vieira"
__license__ = "MIT"


from snakemake.shell import shell


log = snakemake.log_fmt_shell(stdout=True, stderr=True)
extra = snakemake.params.get("extra", "")


if snakemake.input[0].endswith(".gz"):
    pipe = "gunzip -c"
elif snakemake.input[0].endswith(".bz2"):
    pipe = "bunzip2 -c"
else:
    pipe = "cat"


shell(
    "({pipe}"
    " {snakemake.input.bedgraph} | "
    "PretextGraph"
    " -i {snakemake.input.map}"
    " -n {snakemake.params.graph_name}"
    " {extra}"
    " -o {snakemake.output}"
    ") {log}"
)