Beispiel #1
0
def gene(seq_name):
    PATH = "./sequences/" + seq_name
    s1 = Seq()
    s1.read_fasta(PATH)
    context = {
        'gene_name': seq_name,
        'gene_contents': s1.bases
    }
    contents = read_template_html_file('./html/gene.html').render(context=context)
    return contents
        elif msg.startswith("COMP"):
            parts = msg.split(" ")
            if len(parts) == 2 and parts[0] == "COMP":
                termcolor.cprint("COMP", 'green')
                seq = Seq(parts[1])
                complem = seq.complement()
                termcolor.cprint(f"{complem}\n", 'white')
                cs.send(f"{complem}\n".encode())
                cs.close()

        elif msg.startswith("REV"):
            parts = msg.split(" ")
            if len(parts) == 2 and parts[0] == "REV":
                termcolor.cprint("REV", 'green')
                seq = Seq(parts[1])
                rev = seq.reverse()
                termcolor.cprint(f"{rev}\n", 'white')
                cs.send(f"{rev}\n".encode())
                cs.close()

        elif msg.startswith("GENE"):
            parts = msg.split(" ")
            if len(parts) == 2 and parts[0] == "GENE":
                termcolor.cprint("GENE", 'green')
                filename = f"{parts[1]}.txt"
                seq = Seq()
                seq.read_fasta(filename)
                termcolor.cprint(f"{seq}\n", 'white')
                cs.send(f"{seq}\n".encode())
                cs.close()
Beispiel #3
0
from seq import Seq


print("-----| Exercise 9 |------")
s = Seq()

s.read_fasta("U5.txt")

print(f"Sequence: (Length: {s.len()}) {s}")
print(f"\tBases: {s.count()}")
print(f"\tRev: {s.reverse()}")
print(f"\tComp: {s.complement()}")
Beispiel #4
0
                cs.close()
                termcolor.cprint(f"{info}", 'white')
        elif msg.startswith("COMP"):
            slices = msg.split(" ")
            if len(slices) == 2 and slices[0] == "COMP":
                termcolor.cprint("COMP", 'green')
                seq = Seq(slices[1])
                comp = seq.complement()
                cs.send(f"{comp}\n".encode())
                cs.close()
                termcolor.cprint(f"{comp}\n", 'white')
        elif msg.startswith("REV"):
            slices = msg.split(" ")
            if len(slices) == 2 and slices[0] == "REV":
                termcolor.cprint("REV", 'green')
                seq = Seq(slices[1])
                rev = seq.reverse()
                cs.send(f"{rev}\n".encode())
                cs.close()
                termcolor.cprint(f"{rev}\n", 'white')
        elif msg.startswith("GENE"):
            slices = msg.split(" ")
            if len(slices) == 2 and slices[0] == "GENE":
                termcolor.cprint("GENE", 'green')
                filename = f"{slices[1]}.txt"
                seq = Seq()
                seq.read_fasta(filename)  # Comment: try-except
                cs.send(f"{seq}\n".encode())
                cs.close()
                termcolor.cprint(f"{seq}\n", 'white')