diff options
| author | Arun Isaac | 2026-08-14 15:28:26 +0100 |
|---|---|---|
| committer | Arun Isaac | 2026-08-14 16:00:34 +0100 |
| commit | c1cc6709705b4cddb339a92f7d7ed71d1a1600b8 (patch) | |
| tree | 106ad94bfebb5b7e69359836f61ad3520b3da516 | |
| parent | 793fdd6301d75eec5241df6ab638870c24b805fa (diff) | |
| download | domagi-c1cc6709705b4cddb339a92f7d7ed71d1a1600b8.tar.gz domagi-c1cc6709705b4cddb339a92f7d7ed71d1a1600b8.tar.lz domagi-c1cc6709705b4cddb339a92f7d7ed71d1a1600b8.zip | |
Reverse complement sequences as required in FASTA.
| -rw-r--r-- | domagi/domagi.py | 7 | ||||
| -rw-r--r-- | 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")), |
