READ_GC
GC content distribution of reads.
URL: https://rseqc.sourceforge.net/#read-gc-py
Example
This wrapper can be used in the following way:
rule test_rseqc_read_gc:
input:
"A.bam",
output:
xls="A.gc_percent.xls",
plot_r="A.script.r",
pdf="A.plot.pdf",
log:
"rseqc.log",
params:
extra="",
wrapper:
"v5.0.1/bio/rseqc/read_gc"
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:
Path to SAM/BAM file
Output:
xls
: Optional path to gc percent tableplot_r
: Optional path to R scriptpdf
: Optional path to PDF-formatted graph
Params
extra
: Optional parameters for read_gc.py
Code
# coding: utf-8
"""Snakemake wrapper for RSeQC read_GC.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(
"read_GC.py {extra} "
"--input-file {snakemake.input} "
"--out-prefix {tempdir}/out "
"{log} "
)
if "xls" in snakemake.output.keys():
shell(
"mv --verbose " "{tempdir}/out.GC.xls " "{snakemake.output.xls} " "{log} "
)
if "plot_r" in snakemake.output.keys():
shell(
"mv --verbose "
"{tempdir}/out.GC_plot.r "
"{snakemake.output.plot_r} "
"{log} "
)
if "pdf" in snakemake.output.keys():
shell(
"mv --verbose "
"{tempdir}/out.GC_plot.pdf "
"{snakemake.output.pdf} "
"{log} "
)