Skip to content

Commit

Permalink
new geo stats
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Nov 9, 2021
1 parent ef9006f commit e2f9e68
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 9 deletions.
Binary file removed map_caucasus.pdf
Binary file not shown.
Binary file added map_divtree.pdf
Binary file not shown.
19 changes: 19 additions & 0 deletions workflow/notebooks/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,22 @@ def calc_peak_ci(data, confidence, tails):
def func_exp(x, a, b, c):
"""Fit an exponential function."""
return a * x + b * x ** 2 + c

# Find the closest relative
def closest_terminal_node(sample, tree):
"""Return the closests terminal node to the sample in tree."""
sample1 = sample
closest_dist = 999
closest_sample = None

# Search through tree and calculate genetic distances
for sample2 in tree.get_terminals():
# Skip self
if sample1 == sample2: continue

gene_dist = tree.distance(sample1, sample2)
if gene_dist < closest_dist:
closest_dist = gene_dist
closest_sample = sample2

return closest_sample
213 changes: 208 additions & 5 deletions workflow/notebooks/iqtree_stats.py.ipynb

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions workflow/scripts/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@
url = project + query
output = "{}_{}_{}.pdf".format(clade, panel, color)

url = "https://nextstrain.org/community/ktmeaton/plague-phylogeography-projects@main/main/ml/all?d=map&f_population=1.PRE,2.MED,0.PE&legend=closed&onlyPanels&p=full&sidebar=closed&transmissions=hide"
output = "map_caucasus.pdf"
url ="https://nextstrain.org/community/ktmeaton/plague-phylogeography-projects@main/main/ml/1.IN?branchLabel=Province%20Confidence&c=province&d=map&legend=closed&m=div&onlyPanels&p=full&sidebar=closed&tl=host_order_raw&transmissions=hide"
output = "map_divtree.pdf"




print(url)
print()

wait = 10
width = 1920
height = 1080
#width = 1920
#height = 1080
width = 720
height = 540
options = {
"path": output,
"format": "A0",
Expand Down

0 comments on commit e2f9e68

Please sign in to comment.