Skip to content

Commit

Permalink
Infer compression for downloaded metadata
Browse files Browse the repository at this point in the history
Fixes a bug in the download_metadata rule where the rule hardcoded
`gunzip` as the decompression tool but gunzip is not guaranteed to
support decompression of LZMA-compressed files (`.xz` files) on all
operating systems (or at least across all implementations of `gunzip`).
This commit uses the same pattern as the other download rules of
inferring the decompression command from the filename.
  • Loading branch information
huddlej committed May 5, 2021
1 parent 4c91c05 commit e917368
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions workflow/snakemake_rules/download.smk
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ rule download_metadata:
metadata = "data/downloaded{origin}.tsv"
conda: config["conda_environment"]
params:
address = lambda w: config["inputs"][_trim_origin(w.origin)]["metadata"]
address = lambda w: config["inputs"][_trim_origin(w.origin)]["metadata"],
deflate = lambda w: _infer_decompression(config["inputs"][_trim_origin(w.origin)]["metadata"]),
shell:
"""
aws s3 cp {params.address} - | gunzip -cq >{output.metadata:q}
aws s3 cp {params.address} - | {params.deflate} > {output.metadata:q}
"""

rule download_aligned:
Expand Down

0 comments on commit e917368

Please sign in to comment.