Skip to content

Commit c2c8fb1

Browse files
authored
add use-column to pairwise_to_matrix (#41)
1 parent 63ddca7 commit c2c8fb1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "sourmash_plugin_betterplot"
33
description = "sourmash plugin for improved plotting/viz and cluster examination."
44
readme = "README.md"
55
requires-python = ">=3.10"
6-
version = "0.4.1"
6+
version = "0.4.2"
77

88
dependencies = ["sourmash>=4.8.8,<5", "sourmash_utils>=0.2",
99
"matplotlib", "numpy", "scipy", "scikit-learn",

src/sourmash_plugin_betterplot.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,12 @@ def __init__(self, subparser):
515515
)
516516
subparser.add_argument("-o", "--output-matrix", required=True)
517517
subparser.add_argument("--labels-to")
518+
subparser.add_argument(
519+
"-u",
520+
"--use-column",
521+
default="jaccard",
522+
help="column name to use in matrix (default: jaccard)",
523+
)
518524

519525
def main(self, args):
520526
super().main(args)
@@ -527,14 +533,15 @@ def main(self, args):
527533
notify(f"loaded {len(rows)} rows containing {len(sample_d)} distinct samples")
528534

529535
mat = numpy.zeros((len(sample_d), len(sample_d)))
536+
colname = args.use_column
530537

531538
for row in rows:
532539
# get unique indices for each query/match pair.
533540
q = row["query_name"]
534541
qi = sample_d[q]
535542
m = row["match_name"]
536543
mi = sample_d[m]
537-
jaccard = float(row["jaccard"])
544+
jaccard = float(row[colname])
538545

539546
mat[qi, mi] = jaccard
540547
mat[mi, qi] = jaccard

0 commit comments

Comments
 (0)