Beispiel #1
0
from seq1 import Seq

print("-- Practice 1, Exercise 9 --")

folder = "../session-04/"
FILENAME =folder + "U5.txt"
# -- Create a Null sequence
s = Seq()
# -- Initialize the null seq with the given file in fasta format
s.read_fasta(FILENAME)
print(f"Sequence : (Length: {s.len()}) {s}")
print("\tBases: ", s.count())
print("\tRev: ", s.reverse())
print("\tComp:", s.complement())
Beispiel #2
0
from Client0 import Client
from seq1 import Seq

PRACTICE = 2
EXERCISE = 5

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

# -- Parameters
IP = "192.168.1.41"
PORT = 8081
FOLDER = "../session-04/"
filename = FOLDER + 'U5.txt'
s = Seq()
s.read_fasta(filename)

# -- Create a client object
c = Client(IP, PORT)

c.debug_talk("Sending the U5 Gene to the server..")
c.debug_talk(s)
                count_bases_string += s_base

            response = ("Sequence: " + str(seq_info) + "\n" +
                        "Total length: " + str(seq_info.len()) + "\n" +
                        count_bases_string)

        elif "COMP" in msg:
            seq_comp = Seq(argument_command)
            response = seq_comp.complement() + "\n"

        elif "REV" in msg:
            seq_rev = Seq(argument_command)
            response = seq_rev.reverse() + "\n"

        elif "GENE" in msg:
            gene = argument_command
            s = Seq()
            s.read_fasta("../Session-04/" + gene + ".txt")
            response = str(s) + "\n"

        # -- The message has to be encoded into bytes
        # Server Console

        termcolor.cprint(msg[:msg.find(" ")], "green")
        print(response)

        # Client console
        cs.send(response.encode())
        # -- Close the data socket
        cs.close()