Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpxv temporal colouring scale #57

Merged
merged 3 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
from packaging import version
from augur.__version__ import __version__ as augur_version
import sys

min_version = "16.0.0"
if version.parse(augur_version) < version.parse(min_version):
print("This pipeline needs a newer version of augur than you currently have...")
print(f"Current augur version: {augur_version}. Minimum required: {min_version}")
sys.exit(1)

if not config:
configfile: "config/config_hmpxv1.yaml"

Expand Down
6 changes: 3 additions & 3 deletions config/auspice_config_mpxv.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"type": "categorical"
},
{
"key": "date",
"title": "Date",
"type": "categorical"
"key": "sample_date",
"title": "Sample Date",
"type": "temporal"
},
{
"key": "region",
Expand Down
15 changes: 13 additions & 2 deletions scripts/remove_timeinfo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
from collections import defaultdict
import json, argparse

def sample_date(node):
"""
Returns the sample date in numeric form.
In the future, we could examine the 'raw_date' attr here to decide whether to ignore
some sequences, as 'numdate' is the inferred (timetree) date which can hide
uncertainty in actual sampling date,
"""
if "raw_date" not in node: # internal node or tip with no date info
return
return node['numdate']



Expand All @@ -25,8 +35,9 @@
"mutation_length": node["mutation_length"],
"branch_length": node["branch_length"]
}
if "raw_date" in node:
new_node_data[name]["date"] = node["raw_date"]
sdate = sample_date(node)
if sdate:
new_node_data[name]["sample_date"] = sdate

data["nodes"] = new_node_data
with open(args.output_node_data, 'w') as fh:
Expand Down