From 003735d5f6d2ff1876b8e30a86c4a71d5f2f7960 Mon Sep 17 00:00:00 2001 From: Jakob Nybo Nissen Date: Mon, 18 Nov 2024 16:48:58 +0100 Subject: [PATCH] Write medoid to cluster metadata file (#369) It's often useful to know which medoid was used to generate a cluster. Remarkably, we didn't think to output it earlier. --- vamb/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vamb/__main__.py b/vamb/__main__.py index b5f73fbd..3d567dc7 100755 --- a/vamb/__main__.py +++ b/vamb/__main__.py @@ -1134,7 +1134,7 @@ def cluster_and_write_files( # Write the cluster metadata to file with open(Path(base_clusters_name + "_metadata.tsv"), "w") as file: - print("name\tradius\tpeak valley ratio\tkind\tbp\tncontigs", file=file) + print("name\tradius\tpeak valley ratio\tkind\tbp\tncontigs\tmedoid", file=file) for i, cluster in enumerate(clusters): cluster_dict[str(i + 1)] = { sequence_names[cast(int, i)] for i in cluster.members @@ -1150,6 +1150,7 @@ def cluster_and_write_files( cluster.kind_str, sum(sequence_lens[i] for i in cluster.members), len(cluster.members), + sequence_names[cluster.medoid], file=file, sep="\t", )