INNER_DISTANCE
Calculate inner distance between read pairs
URL: https://rseqc.sourceforge.net/#inner-distance-py
Example
This wrapper can be used in the following way:
rule test_rseqc_inner_distance:
input:
aln="A.bam",
refgene="annotation.bed",
output:
reads_inner_distance="a.txt",
freq="freq.txt",
pdf="a.pdf",
plot_r="script.a.r",
log:
"rseqc.log",
params:
extra="-k3 -q2",
wrapper:
"v5.8.0/bio/rseqc/inner_distance"
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.
Software dependencies
rseqc=5.0.4
Input/Output
Input:
aln
: Path to SAM/BAM inputrefgene
: Path to refgene model
Output:
reads_inner_distance
: Optional path to per-read inner distance tablepdf
: Optional path to pdf graphplot_r
: Optional Path to R scriptfreq
: Optional path to inner distance frequence
Params
extra
: Optional parameters for inner_distance.py, besides -i, -r, or -o
Code
# coding: utf-8
"""Snakemake wrapper for RSeQC inner_distance.py"""
__author__ = "Thibault Dayris"
__mail__ = "thibault.dayris@gustaveroussy.fr"
__copyright__ = "Copyright 2024, Thibault Dayris"
__license__ = "MIT"
from tempfile import TemporaryDirectory
from snakemake import shell
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True, append=True)
with TemporaryDirectory() as tempdir:
shell(
"inner_distance.py {extra} "
"--input-file {snakemake.input.aln} "
"--refgene {snakemake.input.refgene} "
"--out-prefix {tempdir}/out "
"{log} "
)
if snakemake.output.get("reads_inner_distance"):
shell(
"mv --verbose "
"{tempdir}/out.inner_distance.txt "
"{snakemake.output.reads_inner_distance} {log}"
)
if snakemake.output.get("pdf"):
shell(
"mv --verbose "
"{tempdir}/out.inner_distance_plot.pdf "
"{snakemake.output.pdf} {log}"
)
if snakemake.output.get("freq"):
shell(
"mv --verbose "
"{tempdir}/out.inner_distance_freq.txt "
"{snakemake.output.freq} {log}"
)
if snakemake.output.get("plot_r"):
shell(
"mv --verbose "
"{tempdir}/out.inner_distance_plot.r "
"{snakemake.output.plot_r} {log}"
)