Skip to content
Advertisement

How do I get my highest match from my findings

Hi im new to coding and i know this may be a a stupid question but i want to get my highest match from my output but dont know how i would do this. I shall put my example below:

JavaScript

Advertisement

Answer

a short version:

JavaScript

frac calculates the fraction where the characters match using zip. it uses that True is basically 1 (and False is 0) in python and can therefore be summed.

then it uses max in order to get the maximal start-index; the maximum is calculated by calling frac.

from the index mx_i it then finds the corresponding sequence mx_seq = Seq1[mx_i:mx_i+len(primer)] and re-calculated the fraction in order to print it out.

Advertisement