Skip to content

Commit

Permalink
update util test; fix util 3d illustration new bps
Browse files Browse the repository at this point in the history
  • Loading branch information
t47io committed Jun 7, 2016
1 parent 64934ec commit 6084d4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion primerize/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,8 +1021,9 @@ def _draw_str_region(sequence, structures, bps, params):
illustration_2 += '\033[91m|%s\033[0m' % (' ' * len(fragments[2]))
illustration_3 += '\033[91m|%s\033[0m' % (' ' * len(fragments[2]))

bps = [bp for helix in bps for bp in helix]
for structure in structures:
this_bps = str_to_bps(structure)
this_bps = [bp for helix in str_to_bps(structure) for bp in helix]
this_bps = filter(lambda x: (x in bps), this_bps)
bps = filter(lambda x: (x not in this_bps), bps)
this_bps = [nt for bp in this_bps for nt in bp]
Expand Down
9 changes: 5 additions & 4 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ def test_mut_range(self):
self.assertListEqual(which_muts, range(102, 261 + 1))

def test_bps(self):
self.assertListEqual(primerize.util.diff_bps('.....(((((.....))))).....'), [(6, 20), (7, 19), (8, 18), (9, 17), (10, 16)])
self.assertListEqual(primerize.util.diff_bps(['.....(((((.....))))).....', '.....((((......).))).....'], 10), [(-1, 6), (-1, 7), (0, 6)])
self.assertListEqual(primerize.util.diff_bps(['.....(((((.....))))).....', '.....((((......).))).....'], -10), [(19, 27), (19, 26), (20, 26)])
self.assertListEqual(primerize.util.diff_bps('.....[[(((...]]..))).....'), [(6, 15), (7, 14), (8, 20), (9, 19), (10, 18)])
self.assertListEqual(primerize.util.diff_bps('.....(((((.....))))).....'), [[(6, 20), (7, 19), (8, 18), (9, 17), (10, 16)]])
self.assertListEqual(primerize.util.diff_bps('.....((.((.....)).)).....'), [[(9, 17), (10, 16)], [(6, 20), (7, 19)]])
self.assertListEqual(primerize.util.diff_bps(['.....(((((.....))))).....', '.....((((......).))).....'], 10), [[(-1, 7), (0, 6)], [(-1, 6)]])
self.assertListEqual(primerize.util.diff_bps(['.....(((((.....))))).....', '.....((((......).))).....'], -10), [[(19, 27), (20, 26)], [(19, 26)]])
self.assertListEqual(primerize.util.diff_bps('.....[[(((...]]..))).....'), [[(6, 15), (7, 14)], [(8, 20), (9, 19), (10, 18)]])
self.assertListEqual(primerize.util.diff_bps(['.....(((((.....))))).....', '.....(((((.....))))).....']), [])

def test_get_mut(self):
Expand Down

0 comments on commit 6084d4a

Please sign in to comment.