From b42cedcea4d99d03f8418526755fb92a9c8d3b9e Mon Sep 17 00:00:00 2001 From: Bryan Briney Date: Thu, 5 Nov 2026 09:43:55 -0800 Subject: [PATCH 1/2] Constrain baltic<1; test that Phylogeny builds its baltic tree baltic 1.0 renamed its API: loadNewick is now load_newick, and leaf, node and tree are modules rather than classes. Under baltic 1.0, `import abutils` fails on Python 3.10 (a module inside typing.Union annotations), and Phylogeny.tree fails on every Python version. The existing phylo tests never built the baltic tree, so CI stayed green. Co-Authored-By: Claude Opus 5.5 --- abutils/tests/test_phylo.py | 7 +++++++ requirements.txt | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/abutils/tests/test_phylo.py b/abutils/tests/test_phylo.py index 982a7c1..0caf1ab 100644 --- a/abutils/tests/test_phylo.py +++ b/abutils/tests/test_phylo.py @@ -178,6 +178,13 @@ def test_phylogeny_with_list_input(sequences): assert len(phylo.sequences) == 3 +def test_phylogeny_tree_loads_newick(sequences): + phylo = phylogeny(sequences) + phylo.tree_string = "(seq1:0.1,seq2:0.2,seq3:0.3);" + leaves = [o for o in phylo.tree.Objects if o.branchType == "leaf"] + assert sorted(leaf.name for leaf in leaves) == ["seq1", "seq2", "seq3"] + + def test_phylogeny_with_name(fasta_file): name = "test_phylogeny_with_name" phylo = phylogeny(fasta_file.name, name=name) diff --git a/requirements.txt b/requirements.txt index e9bc612..c217a25 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ abstar>=0.7 -baltic +# baltic 1.0 renamed its API (loadNewick -> load_newick, leaf/node/tree are modules) +baltic<1 biopython>=1.78 # celery dnachisel From e35f326a8032713a95eaecf24bf5786648ea785a Mon Sep 17 00:00:00 2001 From: Bryan Briney Date: Thu, 5 Nov 2026 10:21:09 -0800 Subject: [PATCH 2/2] Use pl.len() instead of pl.count() for group row counts Recent polars releases raise TypeError for pl.count() without an argument. pl.len() is available in every polars the requirements allow (>=1.6). Co-Authored-By: Claude Opus 5.5 --- abutils/tools/preprocessing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/abutils/tools/preprocessing.py b/abutils/tools/preprocessing.py index d162ef4..6fc21c7 100644 --- a/abutils/tools/preprocessing.py +++ b/abutils/tools/preprocessing.py @@ -677,7 +677,7 @@ def _deduplicate_sequences( return ( df.group_by(group_by_cols) .agg( - pl.count().alias("count"), + pl.len().alias("count"), pl.col("sequence_id").first(), ) .sort("sequence") @@ -1030,7 +1030,7 @@ def deduplicate( pool_unique = ( pool_df.group_by("sequence") .agg( - pl.count().alias("count"), + pl.len().alias("count"), pl.col("sequence_id").first(), ) .sort("sequence")