def read():
filename = input("Name of the file you want to use: ")
vol_seq = []
temp_seq = ""
with open(filename, "r", encoding="utf-8") as file:
for regel in file:
if ">" not in regel:
temp_seq += regel.strip()
else:
if temp_seq:
vol_seq.append(temp_seq)
temp_seq = ""
vol_seq.append(temp_seq)
print(vol_seq)
return vol_seq
CG percentage
def analyse_dna(seq):
lseq = len(seq)
A = 0
T = 0
C = 0
G = 0
for item in seq:
if item == "A":
A += 1
elif item == "T":
T += 1
elif item == "G":
G += 1
elif item == "C":
C += 1
cgp = ((C+G)/lseq)*100
return cgp