INTERSECTBED¶
Intersect BED/BAM/VCF files with bedtools.
URL: https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html
Example¶
This wrapper can be used in the following way:
rule bedtools_merge:
input:
left="A.bed",
right="B.bed"
output:
"A_B.intersected.bed"
params:
## Add optional parameters
extra="-wa -wb" ## In this example, we want to write original entries in A and B for each overlap.
log:
"logs/intersect/A_B.log"
wrapper:
"v1.17.2/bio/bedtools/intersect"
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¶
bedtools=2.30
Authors¶
- Jan Forster
Code¶
__author__ = "Jan Forster"
__copyright__ = "Copyright 2019, Jan Forster"
__email__ = "j.forster@dkfz.de"
__license__ = "MIT"
from snakemake.shell import shell
## Extract arguments
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
shell(
"(bedtools intersect"
" {extra}"
" -a {snakemake.input.left}"
" -b {snakemake.input.right}"
" > {snakemake.output})"
" {log}"
)