Skip to content

Commit

Permalink
Merge pull request #252 from nextstrain/phylo-traits
Browse files Browse the repository at this point in the history
[phylo] Reconnect traits to export
  • Loading branch information
joverlee521 authored May 10, 2024
2 parents 5a52c3f + 8a7eab4 commit b91a9ff
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
4 changes: 4 additions & 0 deletions phylogenetic/build-configs/ci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ clock_rate: 5.7e-5
clock_std_dev: 2e-5
divergence_units: "mutations"

traits:
columns: ""
sampling_bias_correction: 3

## recency
recency: true

Expand Down
4 changes: 4 additions & 0 deletions phylogenetic/defaults/hmpxv1/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ clock_rate: 5.7e-5
clock_std_dev: 2e-5
divergence_units: "mutations"

traits:
columns: ""
sampling_bias_correction: 3

## recency
recency: true

Expand Down
4 changes: 4 additions & 0 deletions phylogenetic/defaults/hmpxv1_big/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ clock_rate: 5.7e-5
clock_std_dev: 2e-5
divergence_units: "mutations"

traits:
columns: ""
sampling_bias_correction: 3

## recency
recency: true

Expand Down
4 changes: 4 additions & 0 deletions phylogenetic/defaults/mpxv/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ clock_rate: 3e-6
clock_std_dev: 6e-6
divergence_units: "mutations-per-site"

traits:
columns: ""
sampling_bias_correction: 3

## recency
recency: true

Expand Down
4 changes: 2 additions & 2 deletions phylogenetic/rules/annotate_phylogeny.smk
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ rule traits:
output:
node_data=build_dir + "/{build_name}/traits.json",
params:
columns="country",
sampling_bias_correction=3,
columns=config["traits"]["columns"],
sampling_bias_correction=config["traits"]["sampling_bias_correction"],
strain_id=config["strain_id_field"],
shell:
"""
Expand Down
16 changes: 10 additions & 6 deletions phylogenetic/rules/export.smk
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ OUTPUTS:

rule remove_time:
input:
"results/{build_name}/branch_lengths.json",
build_dir + "/{build_name}/branch_lengths.json",
output:
"results/{build_name}/branch_lengths_no_time.json",
build_dir + "/{build_name}/branch_lengths_no_time.json",
shell:
"""
python3 scripts/remove_timeinfo.py --input-node-data {input} --output-node-data {output}
Expand Down Expand Up @@ -66,11 +66,15 @@ rule export:
tree=build_dir + "/{build_name}/tree.nwk",
metadata=build_dir + "/{build_name}/metadata.tsv",
branch_lengths=(
"results/{build_name}/branch_lengths.json"
build_dir + "/{build_name}/branch_lengths.json"
if config.get("timetree", False)
else "results/{build_name}/branch_lengths_no_time.json"
else build_dir + "/{build_name}/branch_lengths_no_time.json"
),
traits=(
build_dir + "/{build_name}/traits.json"
if config.get("traits", {}).get("columns", False)
else []
),
traits=build_dir + "/{build_name}/traits.json",
nt_muts=build_dir + "/{build_name}/nt_muts.json",
aa_muts=build_dir + "/{build_name}/aa_muts.json",
clades=build_dir + "/{build_name}/clades.json",
Expand All @@ -95,7 +99,7 @@ rule export:
--tree {input.tree} \
--metadata {input.metadata} \
--metadata-id-columns {params.strain_id} \
--node-data {input.branch_lengths} {input.nt_muts} {input.aa_muts} {input.mutation_context} {input.clades} {input.recency}\
--node-data {input.branch_lengths} {input.traits} {input.nt_muts} {input.aa_muts} {input.mutation_context} {input.clades} {input.recency}\
--colors {input.colors} \
--lat-longs {input.lat_longs} \
--description {input.description} \
Expand Down

0 comments on commit b91a9ff

Please sign in to comment.