Hi, i am new to python and having some problems...
I am trying to figure out how to change multiple integers at once so i can produce the complement of this DNA strand...
>>>dna = """tgaattctatga atggactgtccccaa agaagtaggacccac taatgcagatcctgg a
tccctagctaagatg tattattctgctgtg aattcgatcccacta aagat"""
(ie. acttaagatactt.. ...)
I have learnt how to remove \n character using
>>> dna = replace(dna, ’\n’, "”)
but i cannot figure out how to write a script that will change t to a, a to t, g to c and c to g.
If i change them individually
>>> dna = replace(dna, ’a’, "t”)
then all the a's do become t's then the true t's cannot be distinguished. I then thought of making them w,x,y,z then changing them to the complent but that also takes too much time.
is there some way to write
>>> dna = replace(dna, 'a', "t") and replace(dna, 't', "a")...and so on so it will change all 4 at once???
Any help would be greatly appreciated :)
Thanks, Lel
I am trying to figure out how to change multiple integers at once so i can produce the complement of this DNA strand...
>>>dna = """tgaattctatga atggactgtccccaa agaagtaggacccac taatgcagatcctgg a
tccctagctaagatg tattattctgctgtg aattcgatcccacta aagat"""
(ie. acttaagatactt.. ...)
I have learnt how to remove \n character using
>>> dna = replace(dna, ’\n’, "”)
but i cannot figure out how to write a script that will change t to a, a to t, g to c and c to g.
If i change them individually
>>> dna = replace(dna, ’a’, "t”)
then all the a's do become t's then the true t's cannot be distinguished. I then thought of making them w,x,y,z then changing them to the complent but that also takes too much time.
is there some way to write
>>> dna = replace(dna, 'a', "t") and replace(dna, 't', "a")...and so on so it will change all 4 at once???
Any help would be greatly appreciated :)
Thanks, Lel
Comment