I've been working on an algorithm that involves genetic code. I started by associating all 4 genetic bases, A, C, T, G with a list. A is 1,0,0,0. C is 0,1,0,0. T is 0,0,1,0 and G is 0,0,0,1. There are two different genetic codes, one being the original one and the other being one that was genetically mutated. The algorithm is going to come to conclusions of the data given based on the difference between the two genetic codes. But first, I need to sort of preprocess the data before I can work on the algorithm making conclusions.
This part of the code should essentially go through both the original code and the new code, compare them position by position, and determine if that position is equal. If you look at the code below and example would be, position 0 in both has A and A so they are equal. However, position 1 has T and C so it isn't equal. The for loop is meant to cycle through both parts of the list.
The code looks like this:
# Assigning all 4 base letters to a certain list of numbers so it can be edited later based on what the new genetic code has.
A = [1,0,0,0]
C = [0,1,0,0]
T = [0,0,1,0]
G = [0,0,0,1]
# Making two sample pieces of genetic code
original = [A,T,C,G,T,A,G]
copy = [A,C,C,A,T,G,G]
# Going through both the new and original list and comparing values at every position(0-6)
for i in range(original):
if original[i] == copy[i]:
print("They're the same")
else:
print("They're not the same.")
i += 1
I got the error that 'list' object cannot be interpreted as an integer. I've read in stack overflow that I should remove the range part of the for statement. I tried different variations of that and got "list indices must be integers or slices, not list." Upon reading more posts on this error people are saying to add the range. So it's going back and forth.
Does anyone know why both errors come up if I incorporate range or not? Is there another part of the algorithm that I'm not missing. I'm relatively new to python so I might be missing something pretty simple.