CNVKIT TARGET
Prepare a BED file of baited regions for use with CNVkit.
URL: https://cnvkit.readthedocs.io/en/stable/pipeline.html#target
Example
This wrapper can be used in the following way:
rule cnvkit_targetl:
input:
bed="test.bed",
annotate="refflat-mini.txt",
output:
bed="test.target.bed",
log:
"logs/test.target.log",
params:
extra = "--split" # optional
wrapper:
"v3.9.0-14-g476823b/bio/cnvkit/target"
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
cnvkit=0.9.11
Input/Output
Input:
bed
: bed fileannotate
: gene annotation databases, e.g. RefSeq or Ensembl, as a “flat” format (can be found at UCSC) (optional)
Output:
bed
: bed file
Params
extra
: additional parameters that will be forwarded to cnvkit target
Code
__author__ = "Patrik Smeds"
__copyright__ = "Copyright 2023, Patrik Smeds"
__email__ = "patrik.smeds@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
extra = snakemake.params.get("extra", "")
annotate = snakemake.input.get("annotate", "")
if annotate:
annotate = f"--annotate {annotate}"
shell(
"cnvkit.py target "
"{snakemake.input.bed} "
"-o {snakemake.output.bed} "
"{annotate} "
"{extra} "
"{log}"
)