aakechin / cutPrimers

curPrimers is a tool for trimming primer sequences from amplicon based NGS reads
GNU General Public License v3.0
17 stars 11 forks source link

Little doubt #2

Closed ray1919 closed 4 years ago

ray1919 commented 6 years ago
def makeHashes(seq,k):
    # k is the length of parts
    subSeqs=[]
    h=[]
    lens=set()
    for i in range(len(seq)-k+1):
        h.append(hashlib.md5(seq[i:i+k].encode('utf-8')).hexdigest())
        lens.add(k)
    return(h,lens)

I am new to python. Why add k to set lens in each iteration since it is a fixed value?

aakechin commented 6 years ago

Yes, you are right, it is an excess operation. I replaced it with one-time value storage in the function. Thank you for your comment!