def test_acgt_complement_new_table(input_sequence, expected):
    assert (reverse_complement.complement(input_sequence,
                                          COMPLEMENTS_STR).upper() == expected)
def test_acgt_complement(input_sequence, expected):
    assert reverse_complement.complement(input_sequence).upper() == expected
示例#3
0
            position.append(tmp.find(target) + 1)
            # print(target)
    return [box, position]


def rsearch(tmp: str):
    search_times = len(tmp) + 1 - target_len
    print('search %d times' % (search_times))
    box = []
    position = []
    for i in range(search_times):
        target = tmp[i:i + target_len]
        if target[-1] == 'G' and cal_GC(target):
            box.append(target)
            position.append(tmp.find(target) + 1)
            # print(target)
    return [box, position]


box = fsearch(a[0])[0]
position = fsearch(a[0])[1]
for j in range(len(box)):
    print('%d ~ %d: %s' % (-1 * (len(a[0]) - position[j]), -1 *
                           (len(a[0]) - (position[j] + target_len)), box[j]))

box = rsearch(a[1])[0]
position = rsearch(a[1])[1]
for j in range(len(box)):
    print('%d ~ %d: %s' % (position[j],
                           (position[j] + target_len), complement(box[j])))