week 2 根据窗口特点确定ori的位置

// integer division 

def SymbolArray(Genome, symbol): array = {}

    n = len(Genome)

    ExtendedGenome = Genome + Genome[0:n//2]

    for i in range(n):

        array[i] = PatternCount(symbol, ExtendedGenome[i:i+(n//2)])

        return array

2.计HammingDistance:The total number of mismatches between strings p and q is called the Hamming distance between these strings. 

# Input: Two strings p and q

# Output: An integer value representing the Hamming Distance between p and q.

def HammingDistance(p, q):

    # your code here

    k=len(p)

    HammingDistance=0

    for i in range(0,k):#range() 函数默认 0 为起始值,不过可以通过添加参数来指定起始值:range(3, 10),这意味着值为 3 到 10(但不包括 10):

        if not p[i]==q[i]:

            HammingDistance+=1

            l=p[i]

    return HammingDistance

你可能感兴趣的:(week 2 根据窗口特点确定ori的位置)