# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# #**GC Content**

letters = ["B","D","E","F","H","I","J","K","L","M","N","O","P","Q","R","S","U","V","W","X","Y","Z"]
seq = input("Hello, what is your sequence?   ")
sequ = seq.upper()
if any(elem in letters for elem in sequ):
    print("I'm sorry, there are non-base letters in your sequence")
else:
    import re
    seqf = re.sub(" ", "", sequ)
    cnt = input("Okay, what would you like to count?   ")
    cntu = cnt.upper()
    if "A" in cntu:
        a = seqf.count("A")
    else: 
        a = 0
    if "T" in cntu:
        t = seqf.count("T")
    else:
        t = 0
    if "C" in cntu:
        c = seqf.count("C")
    else:
        c = 0
    if "G" in cntu:
        g = seqf.count("G")
    else:
        g = 0

    total = a + t + c + g
    percent = total/len(seqf)
    print(cntu + " Count: " + str(total))
    print(cntu + " Content: " + str(round(percent,3)))



StarcoderdataJupyterScriptsDedupFiltered