I created this code:
gene = open("AY365046.1.txt","r")
g=0;
a=0;
c=0;
t=0;
gene.readline()
for line in gene:
line = line.lower()
for char in line:
if char == "g":
g+=1
if char == "a":
a+=1
if char == "c":
c+=1
if char == "t":
t+=1
print "Guanina: " + str(g)
print "Adenina: " + str(a)
print "Citosina: " + str(c)
print "Timina: " + str(t)
gc = (g+c+0.) / (a+t+c+g+0.)
print "Conteúdo GC: " +str(gc)
Now I want to make it interactive... My objective is use the input() funcion to get the "sequence number" which will display the corresponding data...
On the code above, it obtains only the data of one sequence/file (AY365046.1.txt)... Therefore, I need the code to get access to more files (for exemple, sequence1.txt and sequence2.txt)... And then, get the data of g, a, c and t on the sequence/file informed on the input() function...
For exemple:
1) The system ask for the Sequence Number
2) The user type sequence2
3) The system get data from sequence2.txt
4) The variables g, a, c and t get the data from that file
5) If the sequence doesn't exist, print an error...
As far as I understand, to do all that, I just need to declare the variables, assign the .txt files to each one of them, and make an if/else...
The problem is that I have tried all that I could find, and nothing works...
Obviously I am not asking to make the code for me, but... Can you guys at least tell me where do I need to start? My logic for what I need to do is correct? I am missing something?