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

Export pivot growth advantage #127

Merged
merged 7 commits into from
Feb 3, 2025
Merged

Export pivot growth advantage #127

merged 7 commits into from
Feb 3, 2025

Conversation

joverlee521
Copy link
Contributor

@joverlee521 joverlee521 commented Jan 31, 2025

Blocked on merge of nextstrain/forecasts-viz#24

Description of proposed changes

Export the growth advantage for the pivot variant with a hard-coded value of 1.0.
There may be a better way to accomplish this with evofr methods, but I'm unfamiliar with the models so will leave that as a potential later improvement.

Note the pivot does not show up in the viz app because the pivot was purposely excluded in nextstrain/forecasts-viz@661df8b. Will need to update forecasts-viz and then update the viz library in this repo to plot the pivot GA.

Related issue(s)

Resolves #126

Checklist

This config value isn't used in the automated workflows because it
overrides with the `--pivot` flag. However, nice to keep things in sync
for testing the script.

Follow up to #124
Previously this was assumed to be the last value in the
`variants` list.¹ Adding an explicit metadata field for `pivot` so that
we can remove this assumption in the viz app.

¹ <nextstrain/forecasts-viz@661df8b>
Export hard-coded value of 1.0 for the growth advantage of the pivot
variant according to
<#126>

There may be a better way to accomplish this with evofr methods,
but I'm unfamiliar with the models so will leave that as a potential
later improvement.
I realized in looking into including the pivot GA plots in
forecasts-viz that the model data includes the `pivot` value.

Use the `pivot` value from the model data instead of hard-coding it
so it won't get out-of-sync when we update the pivots.
@joverlee521
Copy link
Contributor Author

Trial run successfully completed and results can be viewed at


Note the pivot does not show up in the viz app because the pivot was purposely excluded

I was partially correct. Pivot (24F) is not showing up on the x-axis and the legend of the GA plots, but the 1.0 value is plotted on the left side of the y-axis 🤦‍♀️

Screenshot 2025-01-31 at 12 34 11 PM

I can fix the plot in forecasts-viz and update the viz library in this PR as well.

@joverlee521 joverlee521 marked this pull request as draft January 31, 2025 20:36
@@ -20,6 +20,10 @@ function App() {
const mlrCladesData = useModelData(mlrCladesConfig);
const mlrLineagesData = useModelData(mlrLineagesConfig);

const mlrCladesPivotRaw = mlrCladesData?.modelData?.get('pivot') || "loading";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very clever! Adding metadata.pivot and using this to dynamically write out legend info should be really nice for maintenance.

joverlee521 added a commit to nextstrain/forecasts-viz that referenced this pull request Jan 31, 2025
The pivot is exported in the model JSON in
nextstrain/forecasts-ncov#127

Use the explicit pivot if it's available, otherwise continue to use
the final entry in the model's list of variants as the pivot.
joverlee521 added a commit to nextstrain/forecasts-viz that referenced this pull request Jan 31, 2025
The model JSONs will include GA values for the pivot variant as of
<nextstrain/forecasts-ncov#127>. Update the
Graph's xDomain and the Legend to include the pivot variants
to properly plot the pivot variant values.
@trvrb
Copy link
Member

trvrb commented Jan 31, 2025

This looks great to me @joverlee521! I like the additional touch of metadata.pivot. This will make working with old JSON outputs easier. The specific code at if pivot: looks good.

I agree that this shouldn't be merged however until the corresponding change is made to forecasts-viz so that we don't have the pivot point floating to the left of the plot y-axis.

@joverlee521 joverlee521 marked this pull request as ready for review February 3, 2025 18:34
@joverlee521
Copy link
Contributor Author

Updated the viz app in b2c353f and locally looks good to me

Screenshot 2025-02-03 at 10 38 54 AM

Merging so these changes will get incorporated in tonight's model run.

@joverlee521 joverlee521 merged commit 91ee5b1 into main Feb 3, 2025
1 check passed
@joverlee521 joverlee521 deleted the export-pivot-ga branch February 3, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pivot growth advantage not exported
2 participants