COOLTOOLS DOTS#
Calculate cis eigenvectors for a resolution in an .mcool file
URL: https://github.com/open2c/cooltools
Example#
This wrapper can be used in the following way:
rule cooltools_dots:
input:
cooler="small_test.mcool", ## Multiresolution cooler file
expected="test_expected.tsv", ## Expected file
view="test_view.txt", ## File with the region names and coordinates
output:
"HFF_{resolution,[0-9]+}.dots.bedpe",
params:
extra="", ## Add extra parameters
threads: 4
log:
"logs/HFF_{resolution}_dots.log",
wrapper:
"v3.0.2/bio/cooltools/dots"
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#
cooltools=0.6.1
Input/Output#
Input:
a multiresolution cooler file (.mcool)
an expected file
(optional) view, a bed-style file with region coordinates and names to use for analysis
Output:
A .bedpe file with coordinates of detected dots. Can have a {resolution} wildcard that specifies the resolution for the analysis, then it doesn’t need to be specified as a parameter.
Params#
resolution
: Optional, can be instead specified as a wildcard in the outputextra
: Any additional arguments to pass
Code#
__author__ = "Ilya Flyamer"
__copyright__ = "Copyright 2022, Ilya Flyamer"
__email__ = "flyamer@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
## Extract arguments
view = snakemake.input.get("view", "")
if view:
view = f"--view {view}"
expected = snakemake.input.get("expected", "")
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
resolution = snakemake.params.get(
"resolution", snakemake.wildcards.get("resolution", 0)
)
if not resolution:
raise ValueError(
"Please specify ressolution either as a wildcard or as a parameter"
)
shell(
"(cooltools dots"
" {snakemake.input.cooler}::resolutions/{resolution} "
" {expected} "
" {view} "
" -p {snakemake.threads} "
" {extra} "
" -o {snakemake.output}) {log}"
)