def comp(argument, cs): print_colored("COMP", "yellow") argument = Seq(argument.replace('"', "")) comp_seq = str(Seq.seq_complement(argument)) response = f"""Initial sequence: {argument} Complement sequence: {comp_seq}""" cs.send(response.encode()) print(response)
def rev(argument, cs): print_colored("REV", "yellow") argument = Seq(argument.replace('"', "")) rev_seq = str(Seq.seq_reverse(argument)) response = f"""Initial sequence: {argument} Reverse sequence: {rev_seq}""" cs.send(response.encode()) print(response)
def info(argument, cs): print_colored("INFO", "yellow") list_bases = ["A", "C", "T", "G"] argument = Seq(argument.replace('"', "")) t_l = Seq.len(argument) count_list = [] percentage_list = [] for base in list_bases: count_list.append(argument.count_base_1(base)) for i in range(0, len(count_list)): percentage_list.append(count_list[i] * 100 / t_l) response = f"""Sequence: {argument} Total length: {t_l} A: {count_list[0]} ({percentage_list[0]}%) C: {count_list[1]} ({percentage_list[0]}%) G: {count_list[2]} ({percentage_list[0]}%) T: {count_list[3]} ({percentage_list[0]}%)""" cs.send(response.encode()) print(response)