def gene(cs, argument): GENE_FOLDER = "./SEQUENCES/" print_colored("GENE", "green") seq = Seq() response = seq.read_fasta(GENE_FOLDER + argument + ".txt") print(response) cs.send(str(response).encode())
from Seq02 import Seq print('-----| Practice 1, Exercise 9 |------') FOLDER = "../SEQUENCES/" file_name = FOLDER + "U5.txt" s0 = Seq('') s0 = s0.read_fasta(file_name) print(f"Sequence : (Length: {s0.len()}) {s0}") print(f"Bases: {s0.count()}") print(f"Rev: {s0.reverse(s0)}") print(f"Comp: {s0.complement(s0)}")
from client0 import Client from pathlib import Path from Seq02 import Seq PRACTICE = 2 EXERCISE = 6 print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------") # -- Parameters of the server to talk to IP = "192.168.1.12" PORT = 12000 # -- Create a client object c = Client(IP, PORT) s = Seq() s.read_fasta("FRAT1.txt") count = 0 for i in range(0, len(s.strbases), 10): fragment = s.strbases[i:i + 10] print(fragment) count = count + 1 if count == 5: break print("Fragment", count, ":", fragment) print(c.talk(fragment))
from Seq02 import Seq print('-----| Practice 1, Exercise 10 |------') bases = ["A", "C", "T", "G"] list_of_genes = ["U5", "ADA", "FRAT1", "FXN", "RNU6_269P" ] txt = ".txt" FOLDER = "../SEQUENCES/" for e in list_of_genes: s0 = Seq('') val = 0 base = '' s0 = s0.read_fasta(FOLDER+e+txt) dict1 = s0.count() for i, t in dict1.items(): while t > val: val = t base = i print("Gene ", e, " : Most frequent base: ", base)
from client0 import Client from pathlib import Path from Seq02 import Seq PRACTICE = 2 EXERCISE = 1 print(f"-----| Practice {2}, Exercise {7} |------") IP = "192.168.1.12" PORT = 12000 PORT_2 = 12002 c = Client(IP, PORT) c_2 = Client(IP, PORT_2) s = Seq() s.read_fasta('../P0/FRAT1.txt') i = 0 count = 0 while i < len(s.strbases) and count < 10: fragment = s.strbases[i:i + 10] count += 1 i += 10 fragment_text = "Fragment " + str(count) + ": " + fragment print(fragment_text) if count % 2 == 0: print(c_2.debug_talk(fragment_text)) else: print(c.debug_talk(fragment_text))