Skip to content

Commit

Permalink
Move unused workflow logic to deprecated scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
trvrb committed Jan 24, 2025
1 parent 3b5e2d0 commit 7bd4daa
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 76 deletions.
47 changes: 46 additions & 1 deletion scripts/deprecated/calculate_delta_frequency.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
"""Calculate the change in frequency for clades over time (aka the delta frequency or dfreq).
"""
Calculate the change in frequency for clades over time (aka the delta frequency or dfreq).
Design discussion is located on GitHub at https://github.com/nextstrain/ncov/pull/595
--------------------------------------------------------------
This analysis was removed from the workflow on 2025-01-23
This used frequencies of strains in the tree to estimate logistic growth rates
However, analyses at nextstrain.org/sars-cov-2/forecasts use all the available
sequence data and provide a more sophisticated estimate of growth rate accounting
for competition between circulating viruses. These updated results are available
in the `mlr_lineage_fitness` analysis
rule logistic_growth:
input:
tree="results/{build_name}/tree.nwk",
frequencies="results/{build_name}/tip-frequencies.json",
output:
node_data="results/{build_name}/logistic_growth.json"
benchmark:
"benchmarks/logistic_growth_{build_name}.txt"
conda:
config["conda_environment"]
log:
"logs/logistic_growth_{build_name}.txt"
params:
method="logistic",
attribute_name = "logistic_growth",
delta_pivots=config["logistic_growth"]["delta_pivots"],
min_tips=config["logistic_growth"]["min_tips"],
min_frequency=config["logistic_growth"]["min_frequency"],
max_frequency=config["logistic_growth"]["max_frequency"],
resources:
mem_mb=256
shell:
python3 scripts/calculate_delta_frequency.py \
--tree {input.tree} \
--frequencies {input.frequencies} \
--method {params.method} \
--delta-pivots {params.delta_pivots} \
--min-tips {params.min_tips} \
--min-frequency {params.min_frequency} \
--max-frequency {params.max_frequency} \
--attribute-name {params.attribute_name} \
--output {output.node_data} 2>&1 | tee {log}
"""

import argparse
from augur.frequency_estimators import logit_transform
from augur.utils import annotate_parents_for_tree, read_node_data, read_tree, write_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,46 @@
Updated model outputs are available at https://github.com/bkotzen/sars-cov2-modeling following:
https://raw.githubusercontent.com/bkotzen/sars-cov2-modeling/main/2024-07-22/PyR0/mutations.tsv
--------------------------------------------------------------
This analysis was removed from the workflow on 2025-01-23
This was drawn from results at https://github.com/bkotzen/sars-cov2-modeling
But this repo hasn't been updated since 2024-07-22
If these results become updated more frequently, we should restore this analysis
This was used in the workflow following:
rule mutational_fitness:
input:
tree = "results/{build_name}/tree.nwk",
alignments = lambda w: rules.translate.output.translations,
distance_map = config["files"]["mutational_fitness_distance_map"]
output:
node_data = "results/{build_name}/mutational_fitness.json"
benchmark:
"benchmarks/mutational_fitness_{build_name}.txt"
log:
"logs/mutational_fitness_{build_name}.txt"
params:
genes = ' '.join(config.get('genes', ['S'])),
compare_to = "root",
attribute_name = "mutational_fitness"
conda:
config["conda_environment"],
resources:
mem_mb=2000
shell:
augur distance \
--tree {input.tree} \
--alignment {input.alignments} \
--gene-names {params.genes} \
--compare-to {params.compare_to} \
--attribute-name {params.attribute_name} \
--map {input.distance_map} \
--output {output} 2>&1 | tee {log}
"""

import argparse
import pandas as pd
import json
Expand Down
75 changes: 0 additions & 75 deletions workflow/snakemake_rules/main_workflow.smk
Original file line number Diff line number Diff line change
Expand Up @@ -1103,81 +1103,6 @@ rule tip_frequencies:
--proportion-wide {params.proportion_wide} \
--output {output.tip_frequencies_json} 2>&1 | tee {log}
"""
# This analysis is deprecated as of 2025-01-23
# This uses frequencies of strains in the tree to estimate logistic growth rates
# However, analyses at nextstrain.org/sars-cov-2/forecasts use all the available
# sequence data and provide a more sophisticated estimate of growth rate accounting
# for competition between circulating viruses. This updated results are available
# in the `mlr_lineage_fitness` analysis
# rule logistic_growth:
# input:
# tree="results/{build_name}/tree.nwk",
# frequencies="results/{build_name}/tip-frequencies.json",
# output:
# node_data="results/{build_name}/logistic_growth.json"
# benchmark:
# "benchmarks/logistic_growth_{build_name}.txt"
# conda:
# config["conda_environment"]
# log:
# "logs/logistic_growth_{build_name}.txt"
# params:
# method="logistic",
# attribute_name = "logistic_growth",
# delta_pivots=config["logistic_growth"]["delta_pivots"],
# min_tips=config["logistic_growth"]["min_tips"],
# min_frequency=config["logistic_growth"]["min_frequency"],
# max_frequency=config["logistic_growth"]["max_frequency"],
# resources:
# mem_mb=256
# shell:
# r"""
# python3 scripts/calculate_delta_frequency.py \
# --tree {input.tree} \
# --frequencies {input.frequencies} \
# --method {params.method} \
# --delta-pivots {params.delta_pivots} \
# --min-tips {params.min_tips} \
# --min-frequency {params.min_frequency} \
# --max-frequency {params.max_frequency} \
# --attribute-name {params.attribute_name} \
# --output {output.node_data} 2>&1 | tee {log}
# """

# This analysis is deprecated as of 2025-01-23
# This was drawn from results at https://github.com/bkotzen/sars-cov2-modeling
# But this analysis hasn't been updated since 2024-07-22
# If these results become updated more frequently, we should restore this analysis
# rule mutational_fitness:
# input:
# tree = "results/{build_name}/tree.nwk",
# alignments = lambda w: rules.translate.output.translations,
# distance_map = config["files"]["mutational_fitness_distance_map"]
# output:
# node_data = "results/{build_name}/mutational_fitness.json"
# benchmark:
# "benchmarks/mutational_fitness_{build_name}.txt"
# log:
# "logs/mutational_fitness_{build_name}.txt"
# params:
# genes = ' '.join(config.get('genes', ['S'])),
# compare_to = "root",
# attribute_name = "mutational_fitness"
# conda:
# config["conda_environment"],
# resources:
# mem_mb=2000
# shell:
# r"""
# augur distance \
# --tree {input.tree} \
# --alignment {input.alignments} \
# --gene-names {params.genes} \
# --compare-to {params.compare_to} \
# --attribute-name {params.attribute_name} \
# --map {input.distance_map} \
# --output {output} 2>&1 | tee {log}
# """

rule mlr_lineage_fitness:
input:
Expand Down

0 comments on commit 7bd4daa

Please sign in to comment.