Commit 17ab62e1 authored by MARIJON Pierre's avatar MARIJON Pierre

Replace some internal structure with gfapy object

parent 04ebab2b
This diff is collapsed.
......@@ -17,10 +17,10 @@ S 2 * LN:i:10000
S 5 * LN:i:10000
S 3 * LN:i:10000
S 4 * LN:i:10000
L 1 + 2 - 8001M NM:i:0 om:f:0.00
L 1 - 5 + 7999M NM:i:0 om:f:0.00
L 2 - 3 + 8000M NM:i:0 om:f:0.00
L 3 + 4 + 8000M NM:i:0 om:f:0.00
L 1 + 2 - 8001M NM:i:0 om:f:0.0
L 1 - 5 + 7999M NM:i:0 om:f:0.0
L 2 - 3 + 8000M NM:i:0 om:f:0.0
L 3 + 4 + 8000M NM:i:0 om:f:0.0
"""
p = paf2gfa.Parser()
......@@ -52,15 +52,15 @@ S 9 * LN:i:10000
S 7 * LN:i:10000
S 8 * LN:i:10000
S 6 * LN:i:10000
L 1 + 2 - 8001M NM:i:0 om:f:0.00
L 5 - 1 + 8000M NM:i:0 om:f:0.00
L 2 - 3 + 8000M NM:i:0 om:f:0.00
L 3 + 4 + 8000M NM:i:0 om:f:0.00
L 4 + 9 + 8000M NM:i:0 om:f:0.00
L 4 + 7 - 8000M NM:i:0 om:f:0.00
L 8 + 7 + 8000M NM:i:0 om:f:0.00
L 7 + 6 + 8000M NM:i:0 om:f:0.00
L 6 + 5 - 8000M NM:i:0 om:f:0.00
L 1 + 2 - 8001M NM:i:0 om:f:0.0
L 5 - 1 + 8000M NM:i:0 om:f:0.0
L 2 - 3 + 8000M NM:i:0 om:f:0.0
L 3 + 4 + 8000M NM:i:0 om:f:0.0
L 4 + 9 + 8000M NM:i:0 om:f:0.0
L 4 + 7 - 8000M NM:i:0 om:f:0.0
L 8 + 7 + 8000M NM:i:0 om:f:0.0
L 7 + 6 + 8000M NM:i:0 om:f:0.0
L 6 + 5 - 8000M NM:i:0 om:f:0.0
"""
p = paf2gfa.Parser()
p.parse_lines(line.split("\n"))
......
......@@ -7,12 +7,17 @@ import paf2gfa
# --------->
def test_A_contain_B_keep_contain_same():
line = "1\t2000\t500\t1500\t+\t2\t1000\t0\t1000\t30\t1000\t255"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:2000\nS\t2\t*\tLN:i:1000\nC\t1\t+\t2\t+\t500\t1000M\n"
resu = """
H VN:Z:1.0
S 1 * LN:i:2000
S 2 * LN:i:1000
C 1 + 2 + 500 1000M
"""
p = paf2gfa.Parser()
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# B is contain in A
# --------------------------->
......@@ -24,7 +29,7 @@ def test_A_contain_B_keep_contain_diff():
p = paf2gfa.Parser()
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# A is contain in B
# --------->
......@@ -36,7 +41,7 @@ def test_A_contained_B_keep_contain_same():
p = paf2gfa.Parser()
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# A is contain in B
# --------->
......@@ -48,7 +53,7 @@ def test_A_contained_B_keep_contain_diff():
p = paf2gfa.Parser()
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# B is contain in A
# --------------------------->
......@@ -60,7 +65,7 @@ def test_A_contain_B_leave_contain_same():
p = paf2gfa.Parser(False)
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# B is contain in A
# --------------------------->
......@@ -72,7 +77,7 @@ def test_A_contain_B_leave_contain_diff():
p = paf2gfa.Parser(False)
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# A is contain in B
# --------->
......@@ -84,7 +89,7 @@ def test_A_contained_B_leave_contain_same():
p = paf2gfa.Parser(False)
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# A is contain in B
# --------->
......@@ -96,7 +101,7 @@ def test_A_contained_B_leave_contain_diff():
p = paf2gfa.Parser(False)
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# A contain B
# B contain A
......@@ -112,9 +117,11 @@ H\tVN:Z:1.0
S\tA\t*\tLN:i:1000
S\tB\t*\tLN:i:1000
C\tB\t+\tA\t+\t1\t1000M
C\tA\t+\tB\t+\t1\t1000M
"""
p = paf2gfa.Parser()
p.parse_lines(line.split("\n"))
assert resu.strip() == p.get_gfa().strip()
......@@ -15,7 +15,7 @@ B\t1000\t0\t800\t+\tA\t1000\t200\t1000\t800\t800\t255
H\tVN:Z:1.0
S\tA\t*\tLN:i:1000
S\tB\t*\tLN:i:1000
L\tA\t+\tB\t+\t800M\tNM:i:0\tom:f:0.00
L\tA\t+\tB\t+\t800M\tNM:i:0\tom:f:0.0
"""
p = paf2gfa.Parser()
......
......@@ -2,6 +2,7 @@ import pytest
import paf2gfa
import logging
# A and B internal match same strand
# -- -->
# \ /
......@@ -78,6 +79,11 @@ def test_A_B_internal_match_remove_diff():
resu = """
H\tVN:Z:1.0
"""
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.DEBUG)
logger.addHandler(stream_handler)
p = paf2gfa.Parser(internal=False)
p.parse_line(line)
......
......@@ -7,45 +7,45 @@ import paf2gfa
# ------------->
def test_A_3_same():
line = "1\t1000\t20\t1000\t+\t2\t1000\t0\t980\t30\t980\t255"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t1\t+\t2\t+\t980M\tNM:i:950\tom:f:0.00\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t1\t+\t2\t+\t980M\tNM:i:950\tom:f:0.0\n"
p = paf2gfa.Parser()
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# overlap at A 3' orientation is different
# ---------------->
# <-------------
def test_A_3_diff():
line = "1\t1000\t10\t1000\t-\t2\t1000\t10\t1000\t30\t980\t255"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t1\t+\t2\t-\t980M\tNM:i:950\tom:f:0.00\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t1\t+\t2\t-\t980M\tNM:i:950\tom:f:0.0\n"
p = paf2gfa.Parser()
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# overlap at A 5' orientation is different
# ------------->
# ---------------->
def test_A_5_same():
line = "1\t1000\t0\t980\t+\t2\t1000\t20\t1000\t30\t980\t255"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t2\t+\t1\t+\t980M\tNM:i:950\tom:f:0.00\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t2\t+\t1\t+\t980M\tNM:i:950\tom:f:0.0\n"
p = paf2gfa.Parser()
p.parse_line(line)
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
# overlap at A 5' orientation is different
# ------------->
# <----------------
def test_A_5_diff():
line = "1\t1000\t0\t980\t-\t2\t1000\t0\t980\t30\t960\t255"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t1\t-\t2\t+\t960M\tNM:i:930\tom:f:0.00\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:1000\nS\t2\t*\tLN:i:1000\nL\t1\t-\t2\t+\t960M\tNM:i:930\tom:f:0.0\n"
p = paf2gfa.Parser()
p.parse_lines(line.split("\n"))
assert resu == p.get_gfa()
assert resu.strip() == p.get_gfa().strip()
......@@ -28,9 +28,13 @@ def test_overlap_poped():
selected_ov.parse_lines(paf.split("\n"))
all_ov.clean_data()
all_ov.clean_data()
selected_ov.clean_data()
print(all_ov.get_gfa())
print()
print(selected_ov.get_gfa())
assert set(all_ov.get_gfa().strip().split("\n")) != set(selected_ov.get_gfa().strip().split("\n"))
assert set(all_ov.get_gfa().strip().split("\n")) == set(selected_ov.get_gfa().strip().split("\n"))
def test_overlap_poped_short():
......@@ -56,6 +60,10 @@ def test_overlap_poped_short():
selected_ov.parse_lines(paf.split("\n"))
all_ov.clean_data()
all_ov.clean_data()
selected_ov.clean_data()
print(all_ov.get_gfa())
print()
print(selected_ov.get_gfa())
assert set(all_ov.get_gfa().strip().split("\n")) != set(selected_ov.get_gfa().strip().split("\n"))
assert all_ov.get_gfa().strip() == selected_ov.get_gfa().strip()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment