小编sha*_*ida的帖子

Python中经常使用的单词

如何编写代码以找到最常见的2-mer"GATCCAGATCCCCATAC".我写了这段代码,但似乎我错了,请帮忙纠正我.

def PatternCount(Pattern, Text):
    count = 0
    for i in range(len(Text)-len(Pattern)+1):
        if Text[i:i+len(Pattern)] == Pattern:
            count = count+1
    return count
Run Code Online (Sandbox Code Playgroud)

此代码在字符串中打印最频繁的k-mer,但它不会给出给定字符串中的2-mer.

python bioinformatics string-matching

4
推荐指数
1
解决办法
1086
查看次数

标签 统计

bioinformatics ×1

python ×1

string-matching ×1