Skip to content

Update Nextclade workflow to handle new clade Ib outbreak sh2023 lineages#368

Merged
corneliusroemer merged 9 commits into
masterfrom
nextclade-tweaks
Jul 7, 2026
Merged

Update Nextclade workflow to handle new clade Ib outbreak sh2023 lineages#368
corneliusroemer merged 9 commits into
masterfrom
nextclade-tweaks

Conversation

@corneliusroemer

Copy link
Copy Markdown
Member
  • Uncommitted changes from December 2025
  • Switch to iqtree and reformat Snakefile
  • nextclade: Improve clade I mask and exclude Pakistani sequences
  • Format snakefile and exclude Pakistani seqs with artefacts
  • nextclade: namespace lineages by outbreak
  • Adding new lineage definitions to clades, make deduplication more robust
  • Treemask problematic clade Ib Ugandan sites
  • Add joint outbreakLineage field & use it for filtering, stabilize clade I tree with constraint tree
  • Unmask clade A.1 defining stable mutation: { "begin": 185990, "end": 186092 },

Description of proposed changes

Changes necessary to support a second lineage system under clade Ib outbreak sh2023.

See mpxv-lineages/lineage-designation#52 for the lineage designation PR that introduces those lineages.

Copilot AI review requested due to automatic review settings July 7, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the Nextclade/Snakemake phylogeny workflow to support outbreak-namespaced lineages (notably a second lineage system under clade Ib outbreak sh2023), along with masking/exclusion and visualization updates.

Changes:

  • Introduce and propagate a new outbreakLineage field (outbreak/lineage) for filtering, grouping, and coloring.
  • Make deduplication/known-duplicate filtering respect “include” accession lists to keep required references/recombinants.
  • Add/adjust clade definitions, masks, constraints, and excluded accessions to stabilize clade I/Ib trees and handle problematic sequences.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
phylogenetic/rules/construct_phylogeny.smk Updates phylogenetic tree construction args/logging and rule formatting.
phylogenetic/defaults/exclude.txt Adds additional accessions to exclude from phylogenetic builds.
nextclade/Snakefile Adds outbreakLineage derivation, improves dedup/known-duplicate filtering, switches tree building and adds constraint support, and wires new clade renaming inputs.
nextclade/scripts/deduplicate.py Adds “include” support so certain accessions are never removed during deduplication.
nextclade/scripts/clades_renaming.py Namespaces lineages by outbreak, emits outbreakLineage, and adjusts branch label rewriting.
nextclade/scripts/assign-colors.py Allows color assignment to consider outbreakLineage.
nextclade/resources/lineage-b.1/include_recombinants.txt Ensures recombinants are retained for lineage-b.1 build.
nextclade/resources/lineage-b.1/clades.tsv Namespaces lineage-b.1 clades under sh2017/….
nextclade/resources/known_duplicates.txt Adds additional known-duplicate accessions.
nextclade/resources/exclude_accessions.txt Adds additional excluded accessions (recombinants + problematic sequences).
nextclade/resources/color_ordering.tsv Adds ordering for outbreakLineage (and related clade/lineage updates).
nextclade/resources/clade-iib/include_recombinants.txt Ensures recombinants are retained for clade IIb build.
nextclade/resources/clade-iib/clades.tsv Namespaces clade IIb lineages under sh2017/….
nextclade/resources/clade-i/mask.bed Adjusts clade I masking ranges (Ib-focused problematic sites).
nextclade/resources/clade-i/include_recombinants.txt Ensures recombinants are retained for clade I build.
nextclade/resources/clade-i/include_accessions.txt Adds references to ensure key sh2023 lineages are kept.
nextclade/resources/clade-i/constraint_tree.nwk Adds a constraint tree to stabilize clade I/Ib topology.
nextclade/resources/clade-i/clades.tsv Adds sh2023 lineage definitions under clade Ib.
nextclade/resources/clade-i/auspice_config_patch.json Adjusts clade I auspice placement mask patch ranges.
nextclade/resources/auspice_config.json Adds outbreakLineage to auspice coloring and filters.
nextclade/resources/all-clades/mask.bed Adds additional all-clades mask ranges.
nextclade/resources/all-clades/include_accessions.txt Adds sh2023 references to the all-clades include set.
nextclade/resources/all-clades/clades.tsv Adds/updates sh2023 and sh2017 namespaced clade definitions for all-clades build.
nextclade/config/config.yaml Switches filtering/subsampling/grouping to outbreakLineage and adds build-specific settings (outgroup name, constraints).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 43 to +46
rule fix_tree:
"""
Fixing tree
"""
Fixing tree
"""
Comment on lines +33 to +38
parser.add_argument("--tree-file", type=str, help="input tree file (not used)")
args = parser.parse_args()
# get all node names
with open (args.tree_file) as fh:
tree = Phylo.read(fh, "newick")
all_node_names = {clade.name for clade in tree.find_clades() if clade.name is not None}
Comment thread nextclade/Snakefile
Comment on lines 505 to +515
input:
alignment="results/{build_name}/masked.fasta",
constraint_tree=lambda w: config[w.build_name].get("constraint_tree", ""),
output:
tree="results/{build_name}/masked.fasta.treefile",
params:
constraint_option=lambda w: (
f"-g {config[w.build_name]['constraint_tree']}"
if "constraint_tree" in config[w.build_name]
else ""
),
Comment on lines +105 to +120
def deduplicate(
input: str,
output: str,
include: list[str] = [],
num_processes: int = 10,
):
"""
Deduplicate sequences in a file
Args:
sequences: path to sequences file
output: path to output file
include: paths containing sequence IDs that must not be removed
num_processes: number of cores to use
"""
includes = read_accessions(include)
dup_list = set()
@corneliusroemer corneliusroemer merged commit 3eba6a1 into master Jul 7, 2026
6 checks passed
@corneliusroemer corneliusroemer deleted the nextclade-tweaks branch July 7, 2026 13:54
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