def foun(file: str): """The Founder Effect and Genetic Drift""" l1, l2 = Parser(file).lines() n, m = [int(x) for x in l1.split()] a = [int(x) for x in l2.split()] for x in pr.foun(n, m, a): print(*[round(f, 8) for f in x])
def conv(file: str): """Comparing Spectra with the Spectral Convolution""" l1, l2 = Parser(file).lines() s1 = list(map(float, l1.split())) s2 = list(map(float, l2.split())) res = mass.conv(s1, s2) print(res[1], res[0], sep="\n")
def rstr(file: str): """Matching Random Motifs""" l1, seq = Parser(file).lines() n, x = map(float, l1.split(" ")) gc = sum([seq.count(x) for x in "GC"]) lam = ((1 - x) / 2) ** (len(seq) - gc) * (x / 2) ** gc * n print(1 - math.exp(-lam))
def lexf(file: str): """Enumerating k-mers Lexicographically""" l1, l2 = Parser(file).lines() set = l1.split(" ") n = int(l2) perm = ["".join(x) for x in product(set, repeat=n)] print(*sorted(perm), sep="\n")
def lgis(file: str): """Longest Increasing Subsequence""" data = Parser(file).lines()[1] data = [int(x) for x in data.split(" ")] s1 = ros.lgis(data) print(*s1) s2 = ros.lgis([-x for x in data]) s2 = [-x for x in s2] print(*s2)
def lexv(file: str): """Ordering Strings of Varying Length Lexicographically""" l1, l2 = Parser(file).lines() print(*ros.lexv(l1.split(), int(l2)), sep="\n")