I have, for example, this dictionary
d={'M':['ATG'],'D':['GAC','GAT'],'E':['GAA','GAG']}
What I would like to receive as the output given by the sequence of keys is a list with all possible sequences. (there may also be a line in which all possible sequences will be on separate lines "\ n")
sequence = "MDE"
So, the conclusion should be as follows:
['ATGGACGAA','ATGGACGAG','ATGGATGAA','ATGGATGAG']
What I have tried so far is the following, but of course this is not what I want:
seq_trans = '' for aa in sequence: for k, v in d.iteritems(): if k == aa: for item in v: seq_trans= seq_trans + item print seq_trans
And what I get for "MDE":
'ATGGACGATGAAGAG'
source share