about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-08-26 00:42:54 +0100
committerArun Isaac2026-08-26 00:47:34 +0100
commit76da978a3ba7aa5cc5c3b4a114fdfdf6dd775688 (patch)
tree5b768a61381756d8c73719100351ee55c90a7f8b
parent2dde35499067e462635cad6bfd5173f45001c18a (diff)
downloaddomagi-76da978a3ba7aa5cc5c3b4a114fdfdf6dd775688.tar.gz
domagi-76da978a3ba7aa5cc5c3b4a114fdfdf6dd775688.tar.lz
domagi-76da978a3ba7aa5cc5c3b4a114fdfdf6dd775688.zip
Traverse symmetrically in both directions with extract.
-rw-r--r--domagi/domagi.py12
-rw-r--r--tests/test_domagi.py1
2 files changed, 10 insertions, 3 deletions
diff --git a/domagi/domagi.py b/domagi/domagi.py
index 6175c08..4d9bb45 100644
--- a/domagi/domagi.py
+++ b/domagi/domagi.py
@@ -259,10 +259,18 @@ def extract(con, outfile, segment_name, path_range, steps, threads, progress):
           SELECT id, 0 FROM initial_segment
         UNION ALL
           SELECT DISTINCT to_segment, distance+1 FROM cte
-          INNER JOIN link ON from_segment=id
+          INNER JOIN (
+            -- Eliminate directionality of the link table. We must traverse both
+            -- to segments leading out of and to segments leading into the
+            -- current segment.
+            SELECT from_segment, to_segment FROM link
+            UNION
+            SELECT to_segment AS from_segment, from_segment AS to_segment FROM link
+          )
+          ON from_segment=id
           WHERE distance<?
       )
-      SELECT id FROM cte;
+      SELECT DISTINCT id FROM cte;
     """,
                    [steps])
     con.execute(f"""
diff --git a/tests/test_domagi.py b/tests/test_domagi.py
index 3312247..d7190a0 100644
--- a/tests/test_domagi.py
+++ b/tests/test_domagi.py
@@ -206,7 +206,6 @@ def test_domagi_depth_bed_windows(tmp_path, request, domagi_db_name, bed_windows
                        pd.read_csv(io.StringIO(result.stdout), sep="\t"),
                        check_dtype=False)
 
-@pytest.mark.xfail
 @pytest.mark.parametrize("domagi_db_name, context_steps, expected_output",
                          [("domagi_db_test1",
                            1,