nucleotides dictionary
GreatBahram opened this issue · 3 comments
GreatBahram commented
Hi, first of all thanks for your great book.
You could just save the nucleotide inside a dictionary, instead of iterating on each one.
NUCLEOTIDES_MAP = {
'A': 0b00,
'C': 0b01,
'G': 0b10,
'T': 0b11,
}
RMAP = {v: k for k, v in NUCLEOTIDES_MAP.items()}GreatBahram commented
Moreover, you could pass self.bit_string to bin function which returns a binary string representation. Then split the text into two-character group, and each of which would be a nucleotide. What's the benefit? In this case, you don't need to bitwise anything or reverse the output.
GreatBahram commented
You're totally right, last paragraph make everything clear.
davecom commented
Hi @GreatBahram ,
Sorry for not replying sooner. Yes, I was going to point you to that paragraph.
Thanks for reading,
Dave