MEHARI DOWNLOAD CLINVAR DB

https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/mehari/download-clinvar-db?label=version%20update%20pull%20requests

Download mehari clinvar database

URL: https://github.com/varfish-org/mehari

Example

This wrapper can be used in the following way:

rule download_mehari_clinvar_db_sv:
    output:
        directory("resources/mehari/dbs/clinvar/sv"),
    params:
        version="20250609+0.42.4",  # check https://github.com/varfish-org/annonars-data-clinvar/releases for available versions
        build="GRCh38",  # GRCh37 or GRCh38
        flavour="sv",  # genes, minimal or sv
    log:
        "logs/mehari/download_mehari_clinvar_db.log",
    cache: "omit-software"  # save space and time with between workflow caching (see docs)
    wrapper:
        "v7.6.1/bio/mehari/download-clinvar-db"

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

  • curl=8.14.1

  • tar=1.35

Params

  • version: Version of the clinvar DB, from available versions

  • build: GRCh37 or GRCh38

  • flavour: genes, minimal or sv

Authors

  • Till Hartmann

Code

__author__ = "Till Hartmann"
__copyright__ = "Copyright 2025, Till Hartmann"
__email__ = "till.hartmann@bih-charite.de"
__license__ = "MIT"

from snakemake.shell import shell

import re

version_re = re.compile(r"(?P<date>\d{8})\+(?P<annonars>\d+\.\d+\.\d+)")

log = snakemake.log_fmt_shell(stdout=True, stderr=True)

match = version_re.fullmatch(snakemake.params.version)
if not match:
    raise ValueError("Version must have format YYYYMMDD+MAJOR.MINOR.PATCH")
date, annonars_version = match.groups()

build = snakemake.params.get("build", "").lower()
if build not in {"grch37", "grch38"}:
    raise ValueError("build must be 'grch37' or 'grch38'")

flavour = snakemake.params.get("flavour", "").lower()
if flavour not in {"genes", "minimal", "sv"}:
    raise ValueError("flavour must be 'genes', 'minimal' or 'sv'")

output = snakemake.output[0]

# FIXME: investigate why the second shell command fails without the explicit mkdir call
#  snakemake should have created all output dirs/files before launching the wrapper.
shell("mkdir -p {output:q}")
shell(
    "(curl --fail --silent --location https://github.com/varfish-org/annonars-data-clinvar/releases/download/annonars-data-clinvar-{date}/annonars-clinvar-{flavour}-{build}-{date}+{annonars_version}.tar.gz | "
    "tar xvz -f- --strip-components=1 -C {output:q}"
    ") {log}"
)