I've created a list and a dictionary for calculating amino acid frequencies.
I want to basically replace the values in the dictionary with values in the list.
So for example,
what I have now is.
L1 = [0.0429, 0.0071, 0.05, 0.0929, 0.0429, 0.0143, 0.0071, 0.0429, 0.0929, 0.1143, 0.0643, 0.0643, 0.05, 0.0286, 0.0286, 0.0643, 0.0857, 0.0714, 0.0143, 0.0214]
and
D1 = OrderedDict([('A', 6), ('C', 1), ('D', 7), ('E', 13), ('F', 6), ('G', 2), ('H', 1), ('I', 6), ('K', 13), ('L', 16), ('M', 9), ('N', 9), ('P', 7), ('Q', 4), ('R', 4), ('S', 9), ('T', 12), ('V', 10), ('W', 2), ('Y', 3)])
I want to replace every value in D1 to values in L1.
So for example I want ([('A', 0.0429),('C',0.0071).... and so on.
This is the code that creates the list (L1) and the dictionary(D1).
for seq_record in SeqIO.parse(f1,'fasta'):
sorted_dict = (collections.OrderedDict(sorted(Counter(seq_record.seq).items())))
total = float(sum(Counter(seq_record.seq).values()))
print sorted_dict
aa_frequency =(round(value/total,4) for key, value in sorted_dict.items())
aa_frequency_value = []
for i in aa_frequency:
aa_frequency_value.append(i)