about summary refs log tree commit diff
diff options
context:
space:
mode:
-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,