From fefdec7c0442526589880ab5f45c49b99a163113 Mon Sep 17 00:00:00 2001 From: John Huddleston Date: Fri, 20 Dec 2024 16:12:01 -0800 Subject: [PATCH] titer_model: Fix error when subsampling strains Fixes a type error "Population must be a sequence. For dicts or sets, use sorted(d)." --- augur/titer_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/augur/titer_model.py b/augur/titer_model.py index 734cc2675..adafaab52 100644 --- a/augur/titer_model.py +++ b/augur/titer_model.py @@ -415,7 +415,7 @@ def make_training_set(self, training_fraction=1.0, subset_strains=False, **kwarg from random import sample tmp = set(self.test_strains) tmp.difference_update(self.ref_strains) # don't use references viruses in the set to sample from - training_strains = sample(tmp, int(training_fraction*len(tmp))) + training_strains = sample(sorted(tmp), int(training_fraction*len(tmp))) for tmpstrain in self.ref_strains: # add all reference viruses to the training set if tmpstrain not in training_strains: training_strains.append(tmpstrain)