Skip to content

Add nextstrain-open build - #332

Open
joverlee521 wants to merge 19 commits into
masterfrom
phylo-open
Open

Add nextstrain-open build#332
joverlee521 wants to merge 19 commits into
masterfrom
phylo-open

Conversation

@joverlee521

@joverlee521 joverlee521 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description of proposed changes

Add example-open and nextstrain-open configs to use the open data.

Related issue(s)

Part of #330

Checklist

@joverlee521 joverlee521 mentioned this pull request Jun 26, 2026
6 tasks
Base automatically changed from multiple-inputs to master July 22, 2026 18:42
@joverlee521
joverlee521 changed the base branch from master to ingest-open-original-strain July 22, 2026 22:44
Base automatically changed from ingest-open-original-strain to master August 5, 2026 20:36
Comment thread profiles/nextstrain-open.yaml Outdated
vaccines: "config/{lineage}/vaccine.json"
enable_glycosylation: true
enable_lbi: true
enable_embeddings: true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test run in GH Action errored on embed_with_tsne

Traceback (most recent call last):
  File "/usr/local/bin/pathogen-embed", line 8, in <module>
    sys.exit(run_embed())
             ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pathogen_embed/__main__.py", line 109, in run_embed
    return embed(args)
           ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pathogen_embed/pathogen_embed.py", line 565, in embed
    embedding = embedder.fit_transform(distance_matrix)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sklearn/utils/_set_output.py", line 295, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sklearn/base.py", line 1474, in wrapper
    return fit_method(estimator, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sklearn/manifold/_t_sne.py", line 1135, in fit_transform
    self._check_params_vs_input(X)
  File "/usr/local/lib/python3.11/site-packages/sklearn/manifold/_t_sne.py", line 846, in _check_params_vs_input
    raise ValueError("perplexity must be less than n_samples")
ValueError: perplexity must be less than n_samples

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pathogen-embed should handle that error more gracefully, but the default perplexity is 30. Do you expect to have fewer than 30 samples in the open build? Maybe for a 6-month build there isn't that much more data?

The workaround is to set the perplexity to a smaller value. This is a global setting right now, so it would change embeddings for all the builds. Probably the better short-term fix is to disable embeddings like you had before.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you expect to have fewer than 30 samples in the open build? Maybe for a 6-month build there isn't that much more data?

Hmm, there should be more than 30 samples in the 6m build, but yeah I'll turn off embeddings for now.

joverlee521 added a commit that referenced this pull request Aug 12, 2026
Turn off for now since it errors for 6m builds
See <#332 (comment)>
@joverlee521
joverlee521 marked this pull request as ready for review August 17, 2026 20:35
@joverlee521 joverlee521 changed the title Example open build Add nextstrain-open build Aug 17, 2026
joverlee521 added a commit that referenced this pull request Aug 17, 2026
Turn off for now since it errors for 6m builds
See <#332 (comment)>

@huddlej huddlej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This worked well for me out of the box, @joverlee521. I made my own build covering all time for H3N2 and H1N1pdm which forced me to play around with the settings more. Everything worked as expected.

I had a question/suggestions about how we handle Auspice config JSON overrides, but I know that's a sticky subject better had with the rest of the team.

The main blocker I could imagine to releasing open builds based on this is that not all of the vaccine strains from our original builds have matching records in the open data. This is something we could look into outside of this PR, though.

auspice_config = "data/{lineage}/{segment}/auspice_config.json",
shell:
"""
jq '.data_provenance = [{{"name": "GenSpectrum", "url": "https://loculus.genspectrum.org"}}]' \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of special-casing the provenance of these builds, what if we either:

  1. add a rule to the main workflow that always adds a provenance based on values defined in the build config (e.g., data_provenance: 'gisaid'), so the provenance becomes an explicit configuration parameter instead of implicitly defaulting to one provenance

or

  1. add an argument to augur export v2 that allows the user/workflow to specify the data provenance as an argument that overrides the config JSON instead of unioning with the config (--data-provenance '[{{"name": "GenSpectrum", "url": "https://loculus.genspectrum.org"}}]') and make the export rule in this workflow pull the provenance from the build config

or

  1. make copies of the configs for the open data like config/{lineage}/{segment}/auspice_config_{provenance}.json

I get that this last option is what you're trying to avoid with this custom rule.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah thanks for flagging! This was a quick workaround for the example-open build, so I should definitely revisit.
Yes, definitely trying to avoid (3), so I think (1) is the most appealing.

This also reminds me that we should probably rename the GISAID builds if we are going to move to seasonal-flu/gisaid/... and seasonal-flu/open/... URLs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After today's in person discussion, will pivot to layering auspice configs for the separate data provenances. I'll update the PR to define maintainers and data_provenance in separate JSONs that can be layered on top the base segment auspice config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll update the PR to define maintainers and data_provenance in separate JSONs that can be layered on top the base segment auspice config.

This is now done with aa49e1b...f891b20

Comment thread profiles/nextstrain-open/description.md
Comment thread README.md Outdated
subclades: "config/{lineage}/{{segment}}/subclades.tsv"
# Created in the workflow with custom rule `overwrite_auspice_config`
auspice_config: "data/{lineage}/{{segment}}/auspice_config.json"
vaccines: "config/{lineage}/vaccine.json"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note to self to check that the vaccine strains actually appear in the open data with the same names.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found that several H3N2 vaccine strains didn't have exact matches among the strain names in the open metadata (e.g., none of the Swiss strains post-2012, the recent Croatia strain, etc.). We will need to look for corresponding records in GenBank for all of these missing strains across all three subtypes.

Comment on lines +70 to +71
include: "'config/{lineage}/reference_strains.txt'"
exclude: "'config/{lineage}/outliers.txt'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We may need to define new reference and outlier files for open data or make new entries in the existing files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I ended up adding new entries to the existing files during my testing.

joverlee521 added a commit that referenced this pull request Aug 18, 2026
joverlee521 and others added 7 commits August 28, 2026 13:33
Based on existing example build, with changes to remove the custom rule
and switching the `submission_date_field`.
Add subclades to the build config (since subclade is the default
coloring in the Auspice config) and subsample the input data to a
smaller subset for faster runtime.
Prevents most sequences from being dropped by augur refine's clock rate
filter by increasing the threshold from 4 to 10.
This change is dependent on
- data uploaded by <#323>
- multiple input changes by <#331>
joverlee521 and others added 12 commits August 28, 2026 13:33
We will be using the same description and custom rule for the
nextstrain-open builds.
Using the existing public builds as for creating the open builds.
The following commit will make changes to fit the open builds.
Edit nextstrain-open config to work with the open data.
- overwrite Auspice config
- simplify build params since we don't use titer data
- remove passage filters since we don't have that metadata
Turn off for now since it errors for 6m builds
See <#332 (comment)>
Doing this in preparation for deleting all of the lineage level
auspice configs. We will only use the segment level auspice configs
going forward.
Point all config files to use the segment level auspice configs
so that we no longer have the extra lineage level auspice configs.

Doing this clean up in preparation for splitting out the shared parts
of the auspice configs into composable parts.
Create a shared Auspice config for the GISAID data provenance and the
maintainers. This allows data provenance and maintainers to be only
defined in a central JSON that can be shared with all of the other
lineage/segment Auspice configs. Data provenance and maintainers are in
separate JSONs because we use the maintainers for the open builds as well.
Removes the need to use an override rule to change the data provenance
in the shared configs.
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.

2 participants