I'm just starting to learn how to code in python, applying it to the bioinformatics field. Nevertheless, I'm having troubles with the next program:
First you introduce a dna sequence (made from g, c, t, a, and n), with the command dna=input("enter your sequence: ")
Then I try to identify if the DNA sequence has only the g, c, t, a, and n characters (not specifically in that order). If it doesn't, I want the program to say something like: That's not right, enter a sequence again; and then let you enter a new sequence (and repeat the checking process). If it does only have those characters, I want the program to move forward, but I am not able to do that.
This is more or less what I have done so far... It works for sequences with 3 or more characters, but if you write for example one letter (whichever) after "Not right, enter a sequence again: ", it understands that it's a valid sequence when it's not.
def Start():
dna=input("Enter a sequence: ")
for i in range(len(dna)):
if dna[i] not in "actgn":
dna=input("Not right, enter a sequence again: ")
else:
break
print("here the program will continue")