Skip to content
This repository has been archived by the owner on Mar 20, 2020. It is now read-only.

Commit

Permalink
#13: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Toshiyuki Yokoyama committed Jul 18, 2019
1 parent 8a54928 commit aee4823
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,15 @@ def __init__(self, node: Node, strand: str = '+'):
self.strand = strand # TODO: make this required

def __repr__(self):
return self.node.seq
if self.strand == '+':
return self.node.seq
else:
complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
return "".join(complement.get(base, base) for base in reversed(self.node.seq))


def __eq__(self, other):
return self.node.id == other.node.id
return self.node.id == other.node.id and self.strand == other.strand


class Graph:
Expand Down
3 changes: 1 addition & 2 deletions src/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ def test_simple_inversion(self):
dagify = DAGify(paths)
profile, rep_count = dagify.search_for_minimizing_replications()
graph = dagify.to_graph(profile)
# self.assertEqual(graph, [['CAAATAAG', {x,y}], ['A', {x,y}], ['G', {x, y}]])
self.assertEqual(graph, [['CAAATAAG', {x,y}], ['A', {x}, 'A', {y}], ['G', {x, y}]])
self.assertEqual(graph, [['CAAATAAG', {x,y}], ['AC', {x}, 'AC', {y}], ['G', {x, y}]])


location_of_xg = "../test/xg"
Expand Down
2 changes: 1 addition & 1 deletion test/simple_inv.gfa
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ P y 1+,2-,3+ *,*
S 1 CAAATAAG
L 1 + 2 + 0M
L 1 + 2 - 0M
S 2 A
S 2 AC
L 2 - 3 + 0M
L 2 + 3 + 0M
S 3 G

0 comments on commit aee4823

Please sign in to comment.