def test_left_of_branch_to_beginning_revcomp(self, right_tip_structure): # start from revcomp of HDN (left of branch) graph, contig, L, HDN, R, tip = right_tip_structure asm = khmer.LinearAssembler(graph) path = asm.assemble(revcomp(L)) assert len(path) == HDN.pos + K assert utils._equals_rc(path, contig[: len(path)])
def test_left_of_branch_to_beginning_revcomp(self, right_tip_structure): # start from revcomp of HDN (left of branch) graph, contig, L, HDN, R, tip = right_tip_structure asm = khmer.LinearAssembler(graph) path = asm.assemble(revcomp(L)) assert len(path) == HDN.pos + K assert utils._equals_rc(path, contig[:len(path)])
def test_beginning_to_branch_revcomp(self, right_tip_structure): # assemble from beginning of contig, up until branch point # starting from rev comp graph, contig, L, HDN, R, tip = right_tip_structure asm = khmer.LinearAssembler(graph) path = asm.assemble(revcomp(contig[0:K])) assert len(path) == HDN.pos + K assert utils._equals_rc(path, contig[:len(path)])
def test_beginning_to_branch_revcomp(self, right_tip_structure): # assemble from beginning of contig, up until branch point # starting from rev comp graph, contig, L, HDN, R, tip = right_tip_structure asm = khmer.LinearAssembler(graph) path = asm.assemble(revcomp(contig[0:K])) assert len(path) == HDN.pos + K assert utils._equals_rc(path, contig[: len(path)])
def test_from_branch_to_ends_with_stopbf_revcomp(self, left_tip_structure): # block the tip with the stop_bf. should return a full length contig. graph, contig, L, HDN, R, tip = left_tip_structure asm = khmer.LinearAssembler(graph) stop_bf = khmer.Nodegraph(K, 1e5, 4) stop_bf.count(tip) path = asm.assemble(revcomp(HDN), stop_bf) assert len(path) == len(contig) assert utils._equals_rc(path, contig)
def add_seen(kmer): seen.add(kmer) seen.add(revcomp(kmer))
def _contains_rc(match, query): return (query in match) or (revcomp(query) in match)
def _equals_rc(query, match): return (query == match) or (revcomp(query) == match)