Commit 6b1e2b23 authored by MARIJON Pierre's avatar MARIJON Pierre

Test if they are a containement depend if read have same strand

parent 45287c70
......@@ -91,28 +91,34 @@ class Parser:
self._add_link(l.read_a, "+", l.read_b, "-", l.nb_base,
l.nb_match, overhang/maplen)
elif l.beg_a <= l.beg_b and l.len_a - l.end_a < l.len_b - l.end_b:
elif l.strand == "+" and l.beg_a <= l.beg_b and l.len_a - l.end_a < l.len_b - l.end_b:
# B containe A
self._add_segment(l.read_a, l.len_a)
self._add_segment(l.read_b, l.len_b)
if l.strand == "+":
self._add_containment(l.read_b, "+", l.read_a, "+", l.beg_b,
l.nb_base)
else:
self._add_containment(l.read_b, "-", l.read_a, "+", l.beg_b,
l.nb_base)
elif l.beg_a >= l.beg_b and l.len_a - l.end_a > l.len_b - l.end_b:
self._add_containment(l.read_b, "+", l.read_a, "+", l.beg_b,
l.nb_base)
elif l.strand == "-" and l.beg_a <= l.len_b - l.end_b and l.len_a - l.end_a < l.beg_b:
# B containe A
self._add_segment(l.read_a, l.len_a)
self._add_segment(l.read_b, l.len_b)
self._add_containment(l.read_b, "-", l.read_a, "+", l.beg_b,
l.nb_base)
elif l.strand == "+" and l.beg_a >= l.beg_b and l.len_a - l.end_a > l.len_b - l.end_b:
# A containe B
self._add_segment(l.read_a, l.len_a)
self._add_segment(l.read_b, l.len_b)
if l.strand == "+":
self._add_containment(l.read_a, "+", l.read_b, "+", l.beg_a,
l.nb_base)
else:
self._add_containment(l.read_a, "-", l.read_b, "+", l.beg_a,
l.nb_base)
self._add_containment(l.read_a, "+", l.read_b, "+", l.beg_a,
l.nb_base)
elif l.strand == "-" and l.beg_a >= l.len_b - l.end_b and l.len_a - l.end_a > l.beg_b:
# A containe B
self._add_segment(l.read_a, l.len_a)
self._add_segment(l.read_b, l.len_b)
self._add_containment(l.read_a, "-", l.read_b, "+", l.beg_a,
l.nb_base)
elif l.strand == "+":
self._add_segment(l.read_a, l.len_a)
self._add_segment(l.read_b, l.len_b)
......
......@@ -7,16 +7,18 @@ def test_minimap_3contain():
59727 27255 14393 26854 - 63107 23535 11119 23497 1298 12461 255 cm:i:145
59847 18269 51 18268 - 63107 23535 4047 22282 2124 18235 255 cm:i:247"""
resu = """S 56001 * LN:i:3693
resu = """
S 56001 * LN:i:3693
S 63107 * LN:i:23535
S 59727 * LN:i:27255
S 59847 * LN:i:18269
L 59727 + 63107 - 12461M NM:i:11163 om:f:0.04
C 63107 + 56001 + 5870 3275M
C 59727 + 63107 - 14393 12461M
C 63107 + 59847 - 4047 18235M
"""
p = paf2gfa.Parser()
p.parse_lines(line.split("\n"))
assert resu == p.get_gfa()
print(p.get_gfa())
assert resu.strip() == p.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