From c1cc6709705b4cddb339a92f7d7ed71d1a1600b8 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 14 Aug 2026 15:28:26 +0100 Subject: Reverse complement sequences as required in FASTA. --- domagi/domagi.py | 7 ++++++- tests/test_domagi.py | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/domagi/domagi.py b/domagi/domagi.py index 6981132..775c9b1 100644 --- a/domagi/domagi.py +++ b/domagi/domagi.py @@ -275,9 +275,14 @@ def paths(con, list_paths, fasta, threads): for name, in con.execute("SELECT name FROM path").fetchall(): print(name) elif fasta: + # We take care to reverse complement soft masked lower case nucleotides + # as well. for name, sequence in con.execute(""" SELECT ANY_VALUE(path.name), - string_agg(sequence, '' ORDER BY start) + string_agg(CASE WHEN segment_orientation='+' THEN sequence + ELSE reverse(translate(sequence, 'AGCTagct', 'TCGAtcga')) + END, + '' ORDER BY start) FROM path_segment INNER JOIN segment ON segment.id = path_segment.segment_id INNER JOIN path ON path.id = path_segment.path_id diff --git a/tests/test_domagi.py b/tests/test_domagi.py index 4af8c37..c65b87e 100644 --- a/tests/test_domagi.py +++ b/tests/test_domagi.py @@ -207,7 +207,6 @@ def test_domagi_paths(tmp_path, test_data_file, expected_output): header=None), check_dtype=False) -@pytest.mark.xfail @pytest.mark.parametrize("test_data_file, expected_output", [(Path("test-data/test1.gfa"), Path("test-data/expected-output/test1.fa")), -- cgit 1.4.1