From a7806b70c6d651acfdbbaeaa986b4bd28f1d685a Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Fri, 14 Aug 2026 22:09:21 +0100
Subject: Add domagi overlap --paths.
---
doc/domagi-overlap.dbk | 5 +++++
domagi/domagi.py | 8 +++++++-
tests/test_domagi.py | 17 +++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/doc/domagi-overlap.dbk b/doc/domagi-overlap.dbk
index e8e40e7..657e664 100644
--- a/doc/domagi-overlap.dbk
+++ b/doc/domagi-overlap.dbk
@@ -13,6 +13,11 @@
Find paths touched by PATH. This argument may be specified more than once to find paths touched by more than one path.
+
+
+
+ Find paths touched by paths listed in FILE, one per line.
+
diff --git a/domagi/domagi.py b/domagi/domagi.py
index faa7429..77d28b9 100644
--- a/domagi/domagi.py
+++ b/domagi/domagi.py
@@ -267,9 +267,15 @@ def matrix(con, threads):
multiple=True,
metavar="PATH",
help="find paths touched by PATH")
+@click.option("-R", "--paths", "paths_file",
+ type=click.File(),
+ metavar="FILE",
+ help="find paths touched by paths listed in FILE")
@common_options
-def overlap(con, paths, threads):
+def overlap(con, paths, paths_file, threads):
set_duckdb_threads(con, threads)
+ if paths_file:
+ paths = [line.rstrip() for line in paths_file.readlines()]
(con.execute(read_sql("overlap.sql"), [paths])
.fetchdf()
.to_csv(sys.stdout, sep="\t", index=False))
diff --git a/tests/test_domagi.py b/tests/test_domagi.py
index d678a3f..757d1ec 100644
--- a/tests/test_domagi.py
+++ b/tests/test_domagi.py
@@ -214,6 +214,23 @@ def test_domagi_overlap(tmp_path, test_data_file, expected_output):
.sort_values(by=["#path", "path.touched"],
ignore_index=True),
check_dtype=False)
+ # Test passing in the paths through a file.
+ paths_file = tmp_path / "paths"
+ with open(paths_file, "w") as file:
+ for path in paths:
+ print(path, file=file)
+ result = runner.invoke(main, ["overlap",
+ "--db", duckdb_path,
+ "--paths", paths_file])
+ assert result.exit_code == 0
+ assert_frame_equal(pd.read_csv(expected_output, sep="\t")
+ .sort_values(by=["#path", "path.touched"],
+ ignore_index=True),
+ pd.read_csv(io.StringIO(result.stdout),
+ sep="\t")
+ .sort_values(by=["#path", "path.touched"],
+ ignore_index=True),
+ check_dtype=False)
@pytest.mark.parametrize("test_data_file, expected_output",
[(Path("test-data/test1.gfa"),
--
cgit 1.4.1