Please bear with me, as I new to Python.
I have three dictionaries in three .txt files. Where the 'key' is the gene name followed by an integer for value. I would like to make a dictionary where I have a gene name followed by value1 from dict1, value2 from dict2, value3 from dict3.
So if key values are the same, build dictionary as key: (value2, value2, value3).
this is what I have so far where I define three txt files as dictionaries.
with open(dictionaryfile1.txt, 'r') as dic1:
dictionary1=eval(dic1.read())
with open(dictionaryfile2.txt, 'r') as dic2:
dictionary2=eval(dic2.read())
with open(dictionaryfile3.txt, 'r') as dic3:
dictionary3=eval(dic3.read())
Following are my dictionaries from .txt file.
dictionary1:
{'YAL008W': 25, 'YBR255W': 50, 'YGR164W': 37, 'YGR131W': 40, 'YNL003C': 11,
'YBR135W': 2, 'YBR160W': 6, 'YJL082W': 79, 'YJL142C': 4, 'YPL191C': 38,
'YGL215W': 31, 'YKL074C': 33, 'YJL077C': 67, 'YKL096W-A': 22, 'YIL124W': 60,
'YLR364C-A': 2, 'YPL039W': 58, 'YNL170W': 16, 'YGL141W': 62, 'YJL179W': 15,
'YDR316W-A': 13, 'YDR316W-B': 139, 'YKL083W': 25, 'YOR009W': 25,
'YKL029C': 395, 'YPL166W': 31, 'YKL052C': 20, 'YOL034W': 29, 'YBL008W': 42,
'YIL062C': 2, 'YCL023C': 27}
dictionary2:
{'YAL008W': 25, 'YBR255W': 50, 'YGR164W': 37, 'YGR131W': 40, 'YNL003C': 11,
'YBR135W': 2, 'YBR160W': 6, 'YJL082W': 79, 'YJL142C': 4, 'YPL191C': 38,
'YGL215W': 31, 'YKL074C': 33, 'YJL077C': 67, 'YKL096W-A': 22, 'YIL124W': 60,
'YLR364C-A': 2, 'YPL039W': 58, 'YNL170W': 16, 'YGL141W': 62, 'YJL179W': 15,
'YDR316W-A': 13, 'YDR316W-B': 139, 'YKL083W': 25, 'YOR009W': 25,
'YKL029C': 395, 'YPL166W': 31, 'YKL052C': 20, 'YOL034W': 29, 'YBL008W': 42,
'YIL062C': 2, 'YCL023C': 27, 'YOL116W': 28, 'YDR196C': 5, 'YBR280C': 80,
'YNR032W': 34, 'YNR045W': 31, 'YML105C': 2, 'YNL288W': 23}
dictionary3:
{'YAL008W': 13, 'YBR255W': 41, 'YGR164W': 23, 'YGR131W': 24, 'YNL003C': 11,
'YBR135W': 2, 'YBR160W': 3, 'YJL082W': 39, 'YJL142C': 2, 'YPL191C': 19,
'YGL215W': 15, 'YKL074C': 8, 'YJL077C': 51, 'YKL096W-A': 20, 'YIL124W': 29,
'YLR364C-A': 1, 'YPL039W': 20, 'YNL170W': 7, 'YGL141W': 29, 'YJL179W': 8,
'YDR316W-A': 12, 'YDR316W-B': 74, 'YKL083W': 16, 'YOR009W': 11,
'YKL029C': 203, 'YPL166W': 10, 'YKL052C': 12, 'YHR025W': 2, 'YOL034W': 12,
'YBL008W': 21, 'YIL062C': 3, 'YCL023C': 12, 'YOL116W': 4, 'YDR196C': 4,
'YBR280C': 49, 'YNR032W': 31, 'YNR045W': 18, 'YML105C': 2, 'YNL288W': 6,
'YIL059C': 25, 'YIL004C': 2, 'YNR018W': 33, 'YPL144W': 16}
Your help is much appreciated.
This is not a repeat as marked by two users because I have three dictionaries and It would be important for others to see how to link up three dictionaries instead of two. Thank you for your feedback