-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add function to retrieve metadata from Nextstrain's ncov pipeline run at a specific point in time #26
Conversation
session.headers.update(headers) | ||
|
||
if retry: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're using package functions an interactive context (in addition to using them in batch scripts), let's provide a way to make retries optional when using a requests session.
|
||
def test_cladetime_ncov_metadata(): | ||
ct = CladeTime() | ||
ct.url_ncov_metadata = "https://httpstat.us/200" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: https://httpstat.us/
return self._ncov_metadata | ||
|
||
@ncov_metadata.getter | ||
def ncov_metadata(self) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nextstrain only began publishing their pipeline metadata at the beginning on 8/1/24, so we won't find it for earlier dates.
closes #20
Background
This PR addresses the issue above and also introduces a new class to simplify the interface for working with Nextstrain files:
CladeTime
(because we can get sequences and clade assignments at any point in time, get it?)The only thing
CladeTime
currently does is instantiate with:as_of
date for both Sars-Cov-2 sequences/sequence metadataas_of
date for the reference tree used to assign sequences to cladesCladeTime
also has anncov_metadata
attribute, because that's what we need right now to get the variant nowcast hub ready.Review Notes
The commits are reasonably organized, so starting at the first one and reviewing commit by commit is recommended.
Demo
There's more information in the README, but to try
CladeTime
as a code reviewer, you'll need to install the package from this branch:pip install "git+https://github.com/reichlab/virus-clade-utils.git@bsweger/get_nextstrain_ncov_metadata"
Then, from a Python console or script (the code below is what we'll add to
get_clades_to_model.py
in the variant nowcast repo, so we can save the metadata along with the clade list):The above should return a Python dictionary similar to: