Beispiel #1
0
from Client0 import Client
from Seq1 import Seq

PRACTICE = 2
EXERCISE = 7

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

IP = "192.168.8.212"
PORT = 12000
PORT_2 = 12001

c = Client(IP, PORT)
c_2 = Client(IP, PORT_2)

s = Seq()
s.seq_read_fasta("../P0/Sequences/FRAT1.txt")

count = 0
i = 0
while i < len(s.strbases) and count < 5:
    fragment = s.strbases[i:i + 10]
    count += 1
    i += 10
    print("Fragment", count, ":", fragment)
    if count % 2 == 0:
        print(c_2.talk("Fragment" + str(count) + ": " + fragment))
    else:
        print(c.talk("Fragment" + str(count) + ": " + fragment))
Beispiel #2
0
from Client0 import Client
from Seq1 import Seq

IP = "127.0.0.1"
PORT = 8080

FOLDER = "../Session-04/"
GENE = "U5"

c = Client(IP, PORT)
print(c)
s = Seq("").read_fasta(FOLDER + GENE)
c.debug_talk(f"Sending {GENE} gene to the server")
c.debug_talk(str(s))
Beispiel #3
0
from Client0 import Client
from pathlib import Path

PRACTICE = 2
EXERCISE = 5

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

# -- Parameters of the server to talk to
PORT = 20000
IP = "127.0.0.1"

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

print(c.talk("Sending the U5 Gene to the server..."))
print(c.talk(Path("U5.txt").read_text()))
Beispiel #4
0
from Client0 import Client  # cd P2 <<enter>> python Ex2.py
# for printing in the terminal

PRACTICE = 2
EXERCISE = 1

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

# IP always a string, Port always integer
IP = "192.168.8.212"
PORT = 12000
# IP always a string, Port always integer

c = Client(IP, PORT)

c.advanced_ping()
c.ping()

print(f"IP: {c.ip}, {c.port}")
from Client0 import Client
from termcolor import colored
PORT = 8081
IP = "212.128.253.169"

s = Client(IP, PORT)

for i in range(5):
    print('To Server:', colored(f'Message {i+1}', 'blue'))
    print(f'From Server:', s.debug_talk(colored(f'Message {i+1}', 'green')))
Beispiel #6
0
from Client0 import Client

SESSION = 10
EXERCISE = 2

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

# -- Parameters of the server to talk to
IP = "192.168.1.42"
PORT = 8080

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

print(c)
# -- Send a message to the server
print("Sending a message to the server...")
response1 = c.talk("Test1...")
print(f"ECHO: {response1}")

print("Sending a message to the server...")
response2 = c.talk("Test2...")
print(f"ECHO: {response2}")

print("Sending a message to the server...")
response3 = c.talk("Test3...")
print(f"ECHO: {response3}")

print("Sending a message to the server...")
response4 = c.talk("Test4...")
print(f"ECHO: {response4}")
Beispiel #7
0
from Client0 import Client
print("---|PRACTICE 2: EXERCISE 2|---")

IP = "127.0.0.1"
PORT = 12000
c = Client(IP, PORT)
print(str(c))
from Client0 import Client

IP = "127.0.0.1"
PORT = 10000

c = Client(IP, PORT)
print(c)
print()
c.debug_talk("Message 1---")
print()
c.debug_talk("Message 2: Testing!!!")
Beispiel #9
0
from Client0 import Client

PRACTICE = 2
EXERCISE = 4

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

IP = "212.128.253.142"
PORT = 8080
c = Client(IP, PORT)  #unir ip y port
print(c)

c.debug_talk("Message 1---")
c.debug_talk("Message 2: Testing !!!")
from Client0 import Client
from Seq1 import Seq


IP = "127.0.0.1"
PORT = 8080
PORT2= 8081
FOLDER = "../Session-04/"
EXT = ".txt"
GENE = "FRAT1"

c = Client(IP, PORT)
c1= Client(IP, PORT2)

print(c)


s = Seq().read_fasta(FOLDER + GENE + EXT)
b = str(s)
print(f"Gene {GENE}: {b}")
length=10

c.talk(f"Sending {GENE} Gene to the server..., in fragments of {length}")
c1.talk(f"Sending {GENE} Gene to the server..., in fragments of {length}")

for i in range(10):
    fragm = b[i*length: (i+1)*length]
    print(f"Fragment {i+1}: {fragm}")
    message= (f"Fragment {i+1}: {fragm}")
    if i % 2:
        c1.talk(message)
Beispiel #11
0
from Client0 import Client

PRACTICE = 2
EXERCISE = 3

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

IP = "192.168.1.105"
PORT = 8080

clnt = Client(IP, PORT)

print(clnt)

# -- Send a message to the server
print("Sending a message to the server...")
response = clnt.talk("Hi there!")
print(f"Response: {response}")
from Client0 import Client

print(f"-----| Practice 2, Exercise 2 |------")

# -- Parameters of the server to talk to
ip = "127.0.0.1"
port = 8080

# -- Create a client object
create_client = Client(ip, port)

print(create_client)
from Client0 import Client

ip = "192.168.1.45"
port = 8080

c = Client(ip, port)

for i in range(5):
    c.debug_talk(f"Message {i}")
Beispiel #14
0
from Client0 import Client

PRACTICE = 2
EXERCISE = 3

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

IP = "127.0.0.1"
PORT = 8083

# -- Create a client object
c = Client(IP, PORT)
response = c.talk("Message for u <3")
print("Response:", response)
Beispiel #15
0
from Client0 import Client

PRACTICE = 3
EXERCISE = 7

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

# -- Parameters of the server to talk to
IP = "127.0.0.1"
PORT = 8080

# -- Cofigure the client
c = Client(IP, PORT)
print(c)

# -- Test 1: Ping
print("* Testing PING...")
print(c.talk("PING"))

# -- Test 2: Get
print("* Testing GET...")
for i in range(5):
    cmd = f"GET {i}"
    print(f"{cmd}: {c.talk(cmd)}", end="")

# -- Test 3: INFO
# -- Get the sequence 0 for testing
seq = c.talk("GET 0")
print()
print("* Testing INFO...")
cmd = f"INFO {seq}"
Beispiel #16
0
# -- Write a python program that takes 5 fragments of 10 bases each from the FRAT1 gene
# -- and sends them to the server.
# -- Use the talk method. Print the fragments on the Client console for checking

from Client0 import Client
from Seq1 import Seq

PRACTICE = 2
EXERCISE = 6

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

# -- Parameters of the server to talk to
IP = "192.168.1.42"
PORT = 8080
c = Client(IP, PORT)
print(c)
s = Seq()
s.read_fasta("../SESSION-04/FRAT1.txt")
s1 = str(s)
message = "Sending FRAT1 Gene to the server, in fragments of 10 bases..."
F1 = ""
F2 = ""
F3 = ""
F4 = ""
F5 = ""

for index in range(0, 50):
    if 0 <= index < 10:
        F1 = F1 + s1[index]
    elif 10 <= index < 20:
Beispiel #17
0
from Client0 import Client
from Seq1 import Seq

PRACTICE = 2
EXERCISE = 5

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")
IP = "212.128.253.129"
PORT = 8099
c = Client(IP, PORT)
FOLDER = "../Session-04/"
txt = ".txt"
gene = "FRAT1"
file_name = FOLDER + gene + txt
s0 = Seq('')
s0 = str(s0.read_fasta(file_name))
len0 = 10
num_frag = 5
print(f"Gene {gene}: {s0}")
fragments = []
for e in range(num_frag):
    print(f"fragment {e+1}: {s0[len0*e:len0*(e+1)]}")
    fragments.append(s0[len0 * e:len0 * (e + 1)])

c.talk(fragments[0])
c.talk(fragments[1])
c.talk(fragments[2])
c.talk(fragments[3])
c.talk(fragments[4])
Beispiel #18
0
from Client0 import Client
from termcolor import colored
from pathlib import Path
PRACTICE = 2
EXERCISE = 5

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

# -- Parameters of the server to talk to
IP = "192.168.1.213"
PORT = 8080

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

FILENAME = "U5.txt"
file_contents = Path(FILENAME).read_text()
lines = file_contents.split("\n")
body = lines[1:]
bodystr = " "
bodystr = bodystr.join(body)

# -- Send a message to the server
print("Sending a message to the server...")
response1 = "Sending gene U5"
response2 = bodystr
response_list = [response1, response2]
for i in response_list:
    print("To server: ", colored(response1, "green"), "\n", "From server: ",
          c.debug_talk(i))
Beispiel #19
0
from Client0 import Client
from P1.Seq1 import Seq

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

FOLDER = "../Session-04/"
Filename = "FRAT1"
TypeDoc = '.txt'

IP = "127.0.0.1"
PORT = 8080

c = Client(IP, PORT)
print(c)

seq = Seq().read_fasta(FOLDER + Filename + TypeDoc)
bases = str(seq)
print('Gene ', Filename, ':', seq)

c.talk(f"Sending {Filename} Gene to the server, in fragments of 10 bases")
for i in range(5):
    fragment = (bases[i * 10:(i + 1) * 10])
    print(f"Fragment {i+1}: {fragment}")
    c.talk(f"Fragment {i+1}: {fragment}")
Beispiel #20
0
import server_utils
PRACTICE = 3
EXERCISE = 7

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")
list_sequences = [
    "ACGTAAAAGTTTAAGCGCCAAT", "AGTCCCCCCAAAATTTTGGGGGAATAT",
    "AGAGAGAGGATTATTATATACTCTTC", "GGGGGGGGGGGTTTTTTTTTAAAAAACCCC",
    "AAAAAATTTTTCGAAAAAAA"
]
list_genes = ["U5", "ADA", "FRAT1", "FXN", "RNU6_269P"]
IP = "127.0.0.1"
PORT = 8080

c = Client(IP, PORT)
print(c)

print("*Testing PING...")
print(c.talk("OK!"))

print("*Testing GET...")
for elem in range(0, len(list_sequences)):
    response = c.talk("GET " + str(elem))
    print(f"{response}")

print("*Testing INFO...")
for elem in range(0, len(list_sequences)):
    response = c.talk("INFO " + str(elem))
    print(f"{response}")
Beispiel #21
0
from Client0 import Client

PRACTICE = 2
EXERCISE = 3

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

# -- Parameters of the server to talk to
IP = "212.128.253.1"
PORT = 8080

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

# -- Testing the talk function:
print("Sending a message to the server...")
response = c.talk("Testing!!!")
print(f"Response: {response}")
from Client0 import Client

PRACTICE = 2
EXERCISE = 4

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

IP = "192.168.1.40"
PORT = 8080
c = Client(IP, PORT)  #merges ip and port as c

# --  message to and from the server
c.debug_talk("Message 1---")
c.debug_talk("Message 2: Testing !!!")
Beispiel #23
0
from Client0 import Client
from Seq1 import Seq


# -- Parameters of the server to talk to
ip = "127.0.0.1"
port = 8080

file = "../DNA Files/"
extension = ".txt"
dna = 'U5'

# -- Create a client object
c = Client(ip, port)

# -- Print the IP and PORTs
print(c)

# -- Read the Gene from a file
s = Seq().read_fasta(file + dna + extension)

# -- Send the Gene
c.debug_talk(f"Sending {dna} Gene to the server...")
c.debug_talk(str(s))
Beispiel #24
0
from Client0 import Client
print("-----| Practice 3 |------")
list_of_genes = ["U5", "ADA", "FRAT1", "FXN", "RNU6_269P" ]
IP = "127.0.0.1"
PORT = 8080
c = Client(IP, PORT)
t = ""
print("*Testing PING...")
print(c.talk("PING"))
print("*Testing GET...")
print("*Testing INFO...")
print(c.talk("INFO ATCCGTA"))
print("*Testing COMP...")
print(c.talk("COMP ACCTCCTCTCCAGCAATGCCAACCCCAGTCCAGGCCCCCATCCGCCCAGGATCTCGATCA"))
print("*Testing REV...")
print(c.talk("REV ACCTCCTCTCCAGCAATGCCAACCCCAGTCCAGGCCCCCATCCGCCCAGGATCTCGATCA"))
print("*Testing GENE...")
for e in list_of_genes:
    print(c.talk("GENE "+ e))
Beispiel #25
0
from P1.Seq1 import Seq
from Client0 import Client

PRACTICE = 2
EXERCISE = 6

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

IP = "127.0.0.1"
PORT = 8081
c = Client(IP, PORT)
s = Seq()
s.read_fasta('../P2/FRAT1.txt')
count = 0
i = 0
while i < len(s.strbases) and count < 5:
    fragment = s.strbases[i:i + 10]
    count += 1
    i += 10
    print(c.talk(fragment))
Beispiel #26
0
from Client0 import Client
from Seq1 import Seq

PRACTICE = 2
EXERCISE = 5

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

IP = "127.0.0.1"
PORT = 8080
c = Client(IP, PORT)
s = Seq()
s.read_fasta("../P0/Sequences/U5.txt")
print(c)
c.debug_talk("Sending the U5 Gene to the server...")
c.debug_talk(s)
Beispiel #27
0
from Client0 import Client

IP = "192.168.1.149"
PORT = 8080

c = Client(IP, PORT)

for a in range(5):
    c.debug_talk(f"Message {a}")
Beispiel #28
0
from Client0 import Client
PRACTICE = 2
EXERCISE = 2
print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")
IP = "192.168.56.1"
PORT = 8080
c = Client(IP, PORT)

c.__str__()
Beispiel #29
0
from Client0 import Client

PRACTICE = 2
EXERCISE = 1

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

# -- Parameters of the server to talk to
IP = "192.168.1.45"
PORT = 8080

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

# -- Test the ping method
c.ping()

# -- Print the IP and PORTs
print(f"IP: {c.ip}, {c.port}")
Beispiel #30
0
from Client0 import Client
from Seq2 import Seq
print("---|PRACTICE 2: EXERCISE 6|---")

IP = "127.0.0.1"
PORT = 12000
c = Client(IP, PORT)

s = Seq()
s.seq_read_fasta("./Sequences/FRAT1.txt")
count = 0
i = 0
while i < len(s.strbases) and count < 5:
    fragment = s.strbases[i:i + 10]
    count += 1
    i += 10
    print("Fragment", count, ":", fragment)
    c.debug_talk(fragment)