Skip to content

Improve temporal colors#3

Open
jameshadfield wants to merge 2 commits into
mainfrom
temporal-colors
Open

Improve temporal colors#3
jameshadfield wants to merge 2 commits into
mainfrom
temporal-colors

Conversation

@jameshadfield
Copy link
Copy Markdown
Member

Current situation

  1. PPX has collectionDate formats of of (empty string), YYYY, YYYY-MM-DD
  2. Augur filter turns these into XXXX-XX-XX, YYYY-XX-XX, YYYY-MM-DD, respectively
  3. With the default categorical color scale Auspice sorts the values by the number of occurrences on the tree and generates a linear scale from these values. This results in a non-chronological ordering and doesn't emphasize the new data:
image

Changing to scale type "temporal" improves things, but only a little bit:

image 2

This PR

We use a script to projects the observed date range into our canonical rainbow color scale non-linearly
in order to space out the colors of more recent sequences.

image

(Long term we can move this script somewhere else, but I think this is appropriate for now)

Without this the `augur ancestral` step in the nextclade pipeline
fails: "KeyError: 'GPC'". Augur ancestral's reading of GenBank files
is:

> for 'CDS' features use the locus_tag or the gene. If neither, then silently ignore [1]

[1] https://github.com/nextstrain/augur/blob/4b9397bacea57a2436267c1312c075e925201191/augur/io/sequences.py#L455
The previous (default) date categorical scale didn't define a custom
color scale so auspice sorted the values by the number of occurrences on
the tree and generated a linear scale from these values. This resulted
in a non-chronological ordering and didn't emphasize the new data which
is particularly relevant. One improvement is to just use a "temporal"
scale type, but here we use a custom approach which projects the
observed date range into a our canonical rainbow color scale non-linearly
in order to space out the colors of more recent sequences.
@jameshadfield jameshadfield requested a review from rneher May 12, 2026 01:06
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.

1 participant