Skip to content

Commit

Permalink
Simplify renaming logic for nextflu-private deploy
Browse files Browse the repository at this point in the history
Simplifies the logic to rename Auspice JSONs for nextflu-private builds
to match what we were already doing manually and collects the "rename"
and "deploy" rules into a single Snakemake file.
  • Loading branch information
huddlej committed Jan 12, 2024
1 parent bc1e2c9 commit 31871c5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 77 deletions.
8 changes: 4 additions & 4 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ include: "workflow/snakemake_rules/fitness.smk"

include: "workflow/snakemake_rules/report.smk"

if "custom_rules" in config:
for rule_file in config["custom_rules"]:
include: rule_file

def _get_build_outputs():
outputs = []
for build_name, build_params in config["builds"].items():
Expand All @@ -60,6 +56,10 @@ def _get_build_outputs():

return outputs

if "custom_rules" in config:
for rule_file in config["custom_rules"]:
include: rule_file

rule all:
input:
_get_build_outputs()
6 changes: 0 additions & 6 deletions profiles/nextflu-private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ custom_rules:
- workflow/snakemake_rules/download_from_s3.smk
- profiles/nextflu-private/antigenic_distances.smk
- profiles/nextflu-private/report.smk
- profiles/nextflu-private/rename.smk
- profiles/nextflu-private/deploy.smk

# URL for auto-deploying builds
Expand Down Expand Up @@ -51,7 +50,6 @@ recency:

builds:
h1n1pdm_2y_titers:
auspice_name: "flu_seasonal_{build_date}_h1n1pdm_2y_titers_{segment}"
lineage: h1n1pdm
reference: "config/h1n1pdm/{segment}/reference.fasta"
annotation: "config/h1n1pdm/{segment}/genemap.gff"
Expand Down Expand Up @@ -100,8 +98,6 @@ builds:
# enabling titer models to be fit to egg-passaged data.
filters: --query "(is_titer_strain == True)" --min-date {min_date} --exclude {exclude}
h3n2_2y_titers:
# flu/seasonal/2023-10-26/h3n2/2y/titers/ha
auspice_name: "flu_seasonal_{build_date}_h3n2_2y_titers_{segment}"
lineage: "h3n2"
reference: "config/h3n2/{segment}/reference.fasta"
annotation: "config/h3n2/{segment}/genemap.gff"
Expand Down Expand Up @@ -147,7 +143,6 @@ builds:
title: "Cell-passaged HI titers from pooled human sera"
subsamples: *titers-subsampling-scheme
h3n2_2y:
auspice_name: "flu_seasonal_{build_date}_h3n2_2y_{segment}"
lineage: "h3n2"
reference: "config/h3n2/{segment}/reference.fasta"
annotation: "config/h3n2/{segment}/genemap.gff"
Expand Down Expand Up @@ -185,7 +180,6 @@ builds:
references:
filters: --query "(is_reference == True)" --min-date {reference_min_date} --exclude {exclude}
vic_2y_titers:
auspice_name: "flu_seasonal_{build_date}_vic_2y_titers_{segment}"
lineage: vic
reference: "config/vic/{segment}/reference.fasta"
annotation: "config/vic/{segment}/genemap.gff"
Expand Down
21 changes: 18 additions & 3 deletions profiles/nextflu-private/deploy.smk
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
"""
This part of the workflow handles automatic deployments of nextflu-private builds.
Depends on the `all_private` rule from rename.smk
"""

rule all_private:
input:
jsons=_get_build_outputs(),
output:
json_dir=directory("auspice_renamed"),
params:
build_date=datetime.date.today().strftime("%Y-%m-%d"),
shell:
"""
for file in {input.jsons}
do
ln ${{file}} {output.json_dir}/"flu_seasonal_{params.build_date}_`basename ${{file}}`"
done
"""

rule deploy_all:
input: rules.all_private.input
input:
json_dir=directory("auspice_renamed"),
params:
deploy_url = config["deploy_url"]
shell:
"""
nextstrain login --no-prompt;
nextstrain remote upload {params.deploy_url} {input}
nextstrain remote upload {params.deploy_url} {input.json_dir}/*.json
"""
64 changes: 0 additions & 64 deletions profiles/nextflu-private/rename.smk

This file was deleted.

0 comments on commit 31871c5

Please sign in to comment.