Skip to content

Commit

Permalink
Update from "3-year" target to "2y" target
Browse files Browse the repository at this point in the history
I'd suggest using "3y" or "2y" in the URL wildcard rather than "3-year" or "2-year" as this will be consistent with existing timespan wildcards for seasonal flu (6m, 2y, 3y, 12y) and for ncov (1m, 2m, 6m, all-time).

I'd suggest doing a 2 year target rather than a 3 year target just because there seems to be well sufficient sequence counts in GISAID to pull >3000 genomes for a 2 year span for H5N1. If I look now, I see 5571 H5N1 viruses collected from 2022-04-22 to today.

I moved the wildcard dictionary parameters from being all in one-line to being separated by subtype to improve readability.
  • Loading branch information
trvrb committed Apr 22, 2024
1 parent 85d9e42 commit c0cd9ad
Showing 1 changed file with 48 additions and 8 deletions.
56 changes: 48 additions & 8 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUBTYPES = ["h5nx","h5n1","h7n9","h9n2"]#["h5nx","h5n1"]
SEGMENTS = ["pb2", "pb1", "pa", "ha","np", "na", "mp", "ns"]
TIME = ["all-time","3-year"]
TIME = ["all-time","2y"]

path_to_fauna = '../fauna'

Expand Down Expand Up @@ -41,7 +41,12 @@ def metadata_by_wildcards(w):
return(md[w.subtype])

def group_by(w):
gb = {'h5nx': {'all-time':'subtype country year','3-year': 'subtype region month host'},'h5n1': {'all-time':'region country year','3-year':'subtype region month host'}, 'h7n9': {'all-time':'division year'}, 'h9n2': {'all-time':'country year'}}
gb = {
'h5nx': {'all-time': 'subtype country year', '2y': 'subtype region month host'},
'h5n1': {'all-time': 'region country year', '2y': 'subtype region month host'},
'h7n9': {'all-time': 'division year'},
'h9n2': {'all-time': 'country year'}
}
return gb[w.subtype][w.time]

def min_length(w):
Expand All @@ -50,24 +55,59 @@ def min_length(w):
return(length)

def min_date(w):
date = {'h5nx': {'all-time':'1996','3-year': '3Y'},'h5n1': {'all-time':'1996','3-year':'3Y'}, 'h7n9': {'all-time':'2013'}, 'h9n2': {'all-time':'1966'}}
date = {
'h5nx': {'all-time': '1996', '2y': '2Y'},
'h5n1': {'all-time': '1996', '2y': '2Y'},
'h7n9': {'all-time': '2013'},
'h9n2': {'all-time': '1966'}
}
return date[w.subtype][w.time]

def traits_columns(w):
traits = {'h5nx':'region','h5n1': 'region country', 'h7n9': 'country division', 'h9n2': 'region country'}
return traits[w.subtype]

def clock_rate(w):
clock_rates_h5nx = {'pb2':'--clock-rate 0.00287','pb1':'--clock-rate 0.00267', 'pa':'--clock-rate 0.00238','ha':'--clock-rate 0.0048','np':'--clock-rate 0.0022','na':'--clock-rate 0.0028','mp':'--clock-rate 0.0017','ns':'--clock-rate 0.0017'}
clock_rates_h5n1 = {'pb2':'--clock-rate 0.00287','pb1':'--clock-rate 0.00264', 'pa':'--clock-rate 0.00248','ha':'--clock-rate 0.00455','np':'--clock-rate 0.00252','na':'--clock-rate 0.00349','mp':'--clock-rate 0.00191','ns':'--clock-rate 0.00249'}

clock_rate = {'h5nx': {'all-time':'','3-year': clock_rates_h5nx[w.segment]},'h5n1': {'all-time':'','3-year':clock_rates_h5n1[w.segment]}, 'h7n9': {'all-time':''}, 'h9n2': {'all-time':''}}
clock_rates_h5nx = {
'pb2': '--clock-rate 0.00287',
'pb1': '--clock-rate 0.00267',
'pa': '--clock-rate 0.00238',
'ha': '--clock-rate 0.0048',
'np': '--clock-rate 0.0022',
'na': '--clock-rate 0.0028',
'mp': '--clock-rate 0.0017',
'ns': '--clock-rate 0.0017'
}

clock_rates_h5n1 = {
'pb2': '--clock-rate 0.00287',
'pb1': '--clock-rate 0.00264',
'pa': '--clock-rate 0.00248',
'ha': '--clock-rate 0.00455',
'np': '--clock-rate 0.00252',
'na': '--clock-rate 0.00349',
'mp': '--clock-rate 0.00191',
'ns': '--clock-rate 0.00249'
}

clock_rate = {
'h5nx': {'all-time':'', '2y': clock_rates_h5nx[w.segment]},
'h5n1': {'all-time':'', '2y': clock_rates_h5n1[w.segment]},
'h7n9': {'all-time':''},
'h9n2': {'all-time':''}
}

return clock_rate[w.subtype][w.time]


def clock_rate_std_dev(w):
clock_rate_std_dev = {'h5nx': {'all-time':'','3-year': '--clock-std-dev 0.00211'},'h5n1': {'all-time':'','3-year':'--clock-std-dev 0.00211'}, 'h7n9': {'all-time':''}, 'h9n2': {'all-time':''}}
clock_rate_std_dev = {
'h5nx': {'all-time': '', '2y': '--clock-std-dev 0.00211'},
'h5n1': {'all-time': '', '2y': '--clock-std-dev 0.00211'},
'h7n9': {'all-time': ''},
'h9n2': {'all-time': ''}
}

return clock_rate_std_dev[w.subtype][w.time]


Expand Down

0 comments on commit c0cd9ad

Please sign in to comment.