DNA互补序列
代码1:
dna_sequence_orange = "ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT"
complement1 = dna_sequence_orange.replace("A","t")
complement2 = complement1.replace("T","a")
complement3 = complement2.replace("G","c")
complement4 = complement3.replace("C","g")
dna_sequence = complement4.upper()
print(dna_sequence_orange)
print(dna_sequence)
代码2:
dna_sequence_orange = "ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT"
dna_sequence = list(dna_sequence_orange)
i = 0
lenth = len(dna_sequence)
A = "A"
T = "T"
C = "C"
G = "G"
for i in range(lenth):
if dna_sequence[i] == A:
dna_sequence[i] = "T"
elif dna_sequence[i] == T:
dna_sequence[i] = "A"
elif dna_sequence[i] == G:
dna_sequence[i] = "C"
elif dna_sequence[i] == C:
dna_sequence[i] = "G"
else:
print("The is something wrong in the sequence")
i = i + 1
print(dna_sequence_orange,''.join(dna_sequence),sep='\n')