Commit 80e4226e authored by MARIJON Pierre's avatar MARIJON Pierre

If remove contains switch are true didn't write any contains

parent 871a1838
......@@ -164,8 +164,8 @@ class Parser:
def generate_gfa(self):
yield "H\tVN:Z:1.0"
for seq, length in self.__segments.items():
# if not self.containment and seq in self.__containments:
# continue
if not self.containment and seq in self.__containments:
continue
yield "S\t{}\t*\tLN:i:{}".format(seq, length)
for (read_a, _, read_b, _), link in self.__links.items():
......@@ -174,10 +174,11 @@ class Parser:
yield "L\t" + "\t".join(link)
for conted, list_conter in self.__containments.items():
for (conter, straned, straner, pos, ov) in list_conter:
yield "\t".join(["C", conter, straner, conted, straned, str(pos),
str(ov)]) + "M"
if self.containment:
for conted, list_conter in self.__containments.items():
for (conter, straned, straner, pos, ov) in list_conter:
yield "\t".join(["C", conter, straner, conted, straned,
str(pos), str(ov)]) + "M"
def get_gfa(self):
lines = ""
......
......@@ -55,7 +55,7 @@ def test_A_contained_B_keep_contain_diff():
# --------->
def test_A_contain_B_leave_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\nC\t1\t+\t2\t+\t500\t1000M\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:2000\n"
p = paf2gfa.Parser(False)
p.parse_line(line)
......@@ -67,7 +67,7 @@ def test_A_contain_B_leave_contain_same():
# <---------
def test_A_contain_B_leave_contain_diff():
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\nC\t1\t+\t2\t-\t500\t1000M\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:2000\n"
p = paf2gfa.Parser(False)
p.parse_line(line)
......@@ -79,7 +79,7 @@ def test_A_contain_B_leave_contain_diff():
# --------------------------->
def test_A_contained_B_leave_contain_same():
line = "2\t1000\t0\t1000\t+\t1\t2000\t500\t1500\t30\t1000\t255"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:2000\nC\t1\t+\t2\t+\t500\t1000M\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:2000\n"
p = paf2gfa.Parser(False)
p.parse_line(line)
......@@ -91,7 +91,7 @@ def test_A_contained_B_leave_contain_same():
# <---------------------------
def test_A_contained_B_leave_contain_diff():
line = "2\t1000\t0\t1000\t-\t1\t2000\t500\t1500\t30\t1000\t255"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:2000\nC\t1\t+\t2\t-\t500\t1000M\n"
resu = "H\tVN:Z:1.0\nS\t1\t*\tLN:i:2000\n"
p = paf2gfa.Parser(False)
p.parse_line(line)
......
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