示例#1
0
def test_join():
    loc = {
        "type": "join",
        "segments": [
            {"type": "span", "from": 2, "to": 3},
            {"type": "span", "from": 5, "to": 7}
        ]
    }
    t.eq(t.extract("ACGTACGT", loc), ("CGACG", (False, False)))
示例#2
0
def test_fuzzy_internal_join():
    mod1 = {"from": "fuzzy"}
    mod2 = {"to": "fuzzy"}
    loc = {
        "type": "join",
        "segments": [
            {"type": "span", "from": 2, "to": 3},
            {"type": "span", "from": 4, "to": 5, "modifiers": mod1},
            {"type": "span", "from": 6, "to": 7}
        ]
    }
    t.raises(ValueError, t.extract, "ACGTATACACT", loc)
    loc["segments"][1]["modifiers"] = mod2
    t.raises(ValueError, t.extract, "ACGTATACACT", loc)
    del loc["segments"][1]["modifiers"]
    t.eq(t.extract("ACGTATACACT", loc), ("CGTATA", (False, False)))
示例#3
0
def test_fuzzy_join():
    mod1 = {"from": "fuzzy"}
    mod2 = {"to": "fuzzy"}
    loc = {
        "type": "join",
        "segments": [
            {"type": "span", "from": 2, "to": 3, "modifiers": mod1},
            {"type": "span", "from": 5, "to": 7, "modifiers": mod2}
        ]
    }
    t.eq(t.extract("TGGCACGTAA", loc), ("GGACG", (True, True)))
    loc["segments"][0]["modifiers"] = mod2
    t.raises(ValueError, t.extract, "ACGTATACACT", loc)
    del loc["segments"][0]["modifiers"]
    loc["segments"][1]["modifiers"] = mod1
    t.raises(ValueError, t.extract, "ACGTATACACT", loc)
示例#4
0
def test_basic():
    loc = {"type": "span", "from": 2, "to": 3}
    t.eq(t.extract("ACGT", loc), ("CG", (False, False)))
示例#5
0
def test_fuzzy_span():
    mods = {"from": "fuzzy", "to": "fuzzy"}
    loc = {"type": "span", "from": 2, "to": 3, "modifiers": mods}
    t.eq(t.extract("TCGGGA", loc), ("CG", (True, True)))
示例#6
0
def test_index():
    loc = {"type": "index", "position": 3}
    t.eq(t.extract("ACGTAG", loc), ("G", (False, False)))
示例#7
0
def test_complement():
    loc = {
        "type": "complement",
        "segment": {"type": "span", "from": 2, "to": 6}
    }
    t.eq(t.extract("ACCGTT", loc), ("AACGG", (False, False)))