Skip to content

Commit

Permalink
Merge pull request #52 from outbreak-info/fixing
Browse files Browse the repository at this point in the history
mutation frequency keyword added, closes #36
  • Loading branch information
joshuailevy authored Jan 29, 2024
2 parents 74771fa + 8f03c6c commit 6374483
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/outbreak_data/outbreak_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def lineage_mutations(pango_lin=None, lineage_crumbs=False, mutations=None, freq
if mutations:
query = '&' + f'mutations={mutations}' + query

if freq!=0.8:
query = query + f'&frequency={freq}'
raw_data = get_outbreak_data('genomics/lineage-mutations', f'{query}', collect_all=False)
key_list = raw_data['results']
if len(key_list) == 0:
Expand All @@ -208,11 +210,7 @@ def lineage_mutations(pango_lin=None, lineage_crumbs=False, mutations=None, freq
key_list = list(key_list)
df = pd.DataFrame(raw_data['results'][key_list[0]])

if freq != 0.8:
if isinstance(freq, float) and freq > 0 and freq < 1:
return df.loc[df['prevalence'] >= freq]
else:
return df
return df


def global_prevalence(pango_lin, mutations=None, cumulative=None, lineage_crumbs=False, server=server):
Expand Down

0 comments on commit 6374483

Please sign in to comment.