Example #1
0
    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)])
Example #2
0
    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)])
Example #3
0
    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)])
Example #4
0
    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)])
Example #5
0
    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)
Example #6
0
    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)
Example #7
0
 def add_seen(kmer):
     seen.add(kmer)
     seen.add(revcomp(kmer))
Example #8
0
def _contains_rc(match, query):
    return (query in match) or (revcomp(query) in match)
Example #9
0
def _equals_rc(query, match):
    return (query == match) or (revcomp(query) == match)
Example #10
0
def _contains_rc(match, query):
    return (query in match) or (revcomp(query) in match)
Example #11
0
def _equals_rc(query, match):
    return (query == match) or (revcomp(query) == match)
Example #12
0
 def add_seen(kmer):
     seen.add(kmer)
     seen.add(revcomp(kmer))