Skip to content

Commit

Permalink
fix: download already indexed vep cache tarball (#3102)
Browse files Browse the repository at this point in the history
<!-- Ensure that the PR title follows conventional commit style (<type>:
<description>)-->
<!-- Possible types are here:
https://github.com/commitizen/conventional-commit-types/blob/master/index.json
-->

This PR adds a parameter named `indexed` to the wrapper interface to
allow downloading a vep_cache version which has already been indexed and
thus needs no additional post-processing via `--CONVERT`.
> Tabix-indexed cache files are available to download for most supported
species in our [FTP
server](https://ftp.ensembl.org/pub/release-112/variation/indexed_vep_cache/).
[[1]](http://www.ensembl.org/info/docs/tools/vep/script/vep_cache.html)

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] I confirm that I have followed the [documentation for contributing
to
`snakemake-wrappers`](https://snakemake-wrappers.readthedocs.io/en/stable/contributing.html).

While the contributions guidelines are more extensive, please
particularly ensure that:
* [x] `test.py` was updated to call any added or updated example rules
in a `Snakefile`
* [x] `input:` and `output:` file paths in the rules can be chosen
arbitrarily
* [x] wherever possible, command line arguments are inferred and set
automatically (e.g. based on file extensions in `input:` or `output:`)
* [x] temporary files are either written to a unique hidden folder in
the working directory, or (better) stored where the Python function
`tempfile.gettempdir()` points to
* [x] the `meta.yaml` contains a link to the documentation of the
respective tool or command under `url:`
* [x] conda environments use a minimal amount of channels and packages,
in recommended ordering
  • Loading branch information
tedil authored Aug 6, 2024
1 parent a09832a commit 13c6ef7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions bio/vep/cache/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ params:
- species: species to download cache data
- build: build to download cache data
- release: release to download cache data
- indexed: whether to download an already indexed cache
15 changes: 15 additions & 0 deletions bio/vep/cache/test/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ rule get_vep_cache:
"master/bio/vep/cache"


rule get_indexed_vep_cache:
output:
directory("resources/vep/indexed_cache"),
params:
species="saccharomyces_cerevisiae",
build="R64-1-1",
release="98",
indexed=True,
log:
"logs/vep/indexed_cache.log",
cache: "omit-software" # save space and time with between workflow caching (see docs)
wrapper:
"master/bio/vep/cache"


rule get_vep_cache_ebi:
output:
directory("resources/vep/cache_ebi"),
Expand Down
9 changes: 7 additions & 2 deletions bio/vep/cache/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
cache_tarball = (
f"{snakemake.params.species}_vep_{release}_{snakemake.params.build}.tar.gz"
)
vep_dir = "vep" if snakemake.params.get("url") or release >= 97 else "VEP"
if snakemake.params.get("indexed"):
vep_dir = "indexed_vep_cache"
convert = ""
else:
vep_dir = "vep" if snakemake.params.get("url") or release >= 97 else "VEP"
convert = "--CONVERT "
shell(
"curl -L {cache_url}/release-{release}/variation/{vep_dir}/{cache_tarball} -o {tmpdir}/{cache_tarball} {log}"
)
Expand All @@ -38,7 +43,7 @@
"--CACHE_VERSION {release} "
"--CACHEURL {tmpdir} "
"--CACHEDIR {snakemake.output} "
"--CONVERT "
"{convert}"
"--NO_UPDATE "
"{extra} {log}"
)
5 changes: 5 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6088,6 +6088,11 @@ def test_vep_cache():
["snakemake", "--cores", "1", "resources/vep/cache", "--use-conda", "-F"],
)

run(
"bio/vep/cache",
["snakemake", "--cores", "1", "resources/vep/indexed_cache", "--use-conda", "-F"],
)

run(
"bio/vep/cache",
["snakemake", "--cores", "1", "resources/vep/cache_ebi", "--use-conda", "-F"],
Expand Down

0 comments on commit 13c6ef7

Please sign in to comment.