Skip to content

Commit

Permalink
refactor(updating random.sample to avoid deprecation):
Browse files Browse the repository at this point in the history
  • Loading branch information
pchaumeil committed Apr 16, 2024
1 parent 47b5671 commit 501aacc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gtdbtk/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -2188,7 +2188,7 @@ def root_with_outgroup(self, input_tree, taxonomy, outgroup_taxa):

leaves_in_tree = sum([1 for _ in new_tree.leaf_node_iter()])
while True:
rnd_ingroup_leaf = random.sample(ingroup_in_tree, 1)[0]
rnd_ingroup_leaf = random.sample(tuple(ingroup_in_tree), 1)[0]
new_tree.reroot_at_edge(rnd_ingroup_leaf.edge,
length1=0.5 * rnd_ingroup_leaf.edge_length,
length2=0.5 * rnd_ingroup_leaf.edge_length)
Expand Down
2 changes: 1 addition & 1 deletion gtdbtk/reroot_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def root_with_outgroup(self, input_tree: str, output_tree: str, outgroup: Set[st
mrca = tree.mrca(taxa=outgroup_in_tree)
mrca_leaves = len(mrca.leaf_nodes())
while True:
rnd_ingroup = random.sample(ingroup_leaves, 1)[0]
rnd_ingroup = random.sample(tuple(ingroup_leaves), 1)[0]
tree.reroot_at_edge(rnd_ingroup.edge,
length1=0.5 * rnd_ingroup.edge_length,
length2=0.5 * rnd_ingroup.edge_length)
Expand Down
2 changes: 1 addition & 1 deletion gtdbtk/trim_msa.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def subsample_msa(self, seqs, markers):
lack_cols_marker_ids.append(marker_id)

offset_valid_cols = [i + start for i in valid_cols]
sel_cols = random.sample(offset_valid_cols, min(
sel_cols = random.sample(tuple(offset_valid_cols), min(
self.subset, len(offset_valid_cols)))
sampled_cols.extend(sel_cols)

Expand Down

0 comments on commit 501aacc

Please sign in to comment.