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

Unify colour & display name setting for all models #67

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

jameshadfield
Copy link
Member

@jameshadfield jameshadfield commented Oct 24, 2023

Over time setting the clade colours & display names separately to the lineage colour definitions resulted in the two falling out of sync. This work unifies the approach so that the same script (using a unified configuration) modifies each JSON respectively.

Including the colour and display name data within the clades JSON is a big improvement as it allows simple retrospective analysis of old datasets.

Tested locally with no observed changes to the resulting colours.


const variantColors = new Map([
["other", "#777777"],
["22B", "#999999"],
Copy link
Member Author

Choose a reason for hiding this comment

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

22B, 22D and 22E were not copied over to the new configuration as they were not present in the latest model runs.

Copy link
Member

@trvrb trvrb left a comment

Choose a reason for hiding this comment

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

I very much appreciate the centralization and moving colors into the JSON. Can I request one change however... the rest of workflow is quite good at putting everything you need to modify into config/config.yaml. The CLADES entry in modify-lineage-colours-and-order.py is now the exception and requires modifying the script itself. Can you move the CLADES entry into config/config.yaml? Or should this wait on unifying the hex values and the cmap entries? I think can be out of scope for this PR, but would be very useful to have a direct hex map here. As it stands if we add an additional clade you have to rejigger the start and stop values across different cmaps and have to do visual inspection to line up hex values with cmaps. My suggestion would be to drop cmaps and instead pad directly from hex values. This will keep things more easily in sync.

@trvrb
Copy link
Member

trvrb commented Oct 24, 2023

Another observation (that I don't know where to thread really)... if I take the resulting file 2023-10-24_results.json and drag-n-drop to https://nextstrain.github.io/forecasts-viz/ the resulting display is the generic color ramp rather than the hex values encoded in the JSON.

jameshadfield added a commit that referenced this pull request Oct 24, 2023
@jameshadfield
Copy link
Member Author

jameshadfield commented Oct 24, 2023

I've updated this PR to generate colour ranges from the provided clade colour (see commentary in the code of that function - I don't think the colours are better than using cmaps, but they are certainly much easier to maintain!) and also shifted the clade definitions into the config.

image

Another observation (that I don't know where to thread really)... if I take the resulting file 2023-10-24_results.json and drag-n-drop to https://nextstrain.github.io/forecasts-viz/ the resulting display is the generic color ramp rather than the hex values encoded in the JSON.

Oh! How annoying. The viz app must not be up-to-date. I'll update it. I've updated the viz app and it's now working.

Over time setting the clade colours & display names separately to the
lineage colour definitions resulted in the two falling out of sync. This
work unifies the approach so that the same script (using a unified
configuration) modifies each JSON respectively.

Including the colour and display name data within the clades JSON is a
big improvement as it allows simple retrospective analysis of old
datasets.
This avoids having to pick colour maps for each clade's colour and will
help with keeping things in sync, which is clearly important for an
automated forecasting pipeline. The resulting colours aren't quite as
nice IMO, but the colour generation can be improved over time as needed.

See <#66 (comment)>
for more.
@jameshadfield
Copy link
Member Author

I'm going to merge this now - any colour fixes (etc) can be easily applied by subsequent PRs if needed.

@jameshadfield jameshadfield merged commit 4a8c6c7 into main Oct 30, 2023
1 check passed
@jameshadfield jameshadfield deleted the unify-colour-defs branch October 30, 2023 19:43
@joverlee521 joverlee521 mentioned this pull request Oct 31, 2023
1 task
@trvrb
Copy link
Member

trvrb commented Nov 6, 2023

Thanks so much for the changes here James (and sorry that I forget to follow up). I really appreciate this. It should make things much more maintainable going forward.

@joverlee521 joverlee521 mentioned this pull request Nov 28, 2023
2 tasks
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.

4 participants