SEX.DETERRMINE
calculate the relative coverage of X and Y chromosomes, and their associated error bars, out of capture data.
Example
This wrapper can be used in the following way:
rule test_sexdeterrmine:
input:
depth="samples.depth.tsv",
output:
tsv="results.tsv",
json="results.json",
threads: 1
log:
"sexdeterrmine.log",
wrapper:
"v7.2.0/bio/sexdeterrmine"
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
See depth header format at: https://github.com/TCLamnidis/Sex.DetERRmine/tree/master?tab=readme-ov-file#instructions
Software dependencies
sexdeterrmine=1.1.2
Input/Output
Input:
depth: Path to samtools depths file accross multiple samples with a header line giving sample names.
Output:
Path to result table
Params
No extra parameters handled.:
Code
# coding: utf-8
"""Snakemake wrapper for Sex.DetERRmine"""
__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2024, Thibault Dayris"
__email__ = "thibault.dayris@gustaveroussy.fr"
__license__ = "MIT"
from snakemake.shell import shell
from tempfile import TemporaryDirectory
import os
import os.path
log = snakemake.log_fmt_shell(
stdout=False,
stderr=True,
)
extra = snakemake.params.get("extra", "")
with TemporaryDirectory() as tempdir:
orig_path = os.path.realpath(os.getcwd())
input_path = os.path.realpath(snakemake.input.depth)
os.chdir(tempdir)
commands = [
f"sexdeterrmine --Input {input_path} {extra} > out.tsv",
]
tsv = snakemake.output.get("tsv")
if tsv:
commands.append(f"mv --verbose out.tsv {orig_path}/{tsv}")
json = snakemake.output.get("json")
if json:
commands.append(f"mv --verbose sexdeterrmine.json {orig_path}/{json}")
commands = " && ".join(commands)
shell("({commands}) {log}")