In python, I have one large dictionary which contains smaller nested dictionaries.
The dictionary could have as many as 7 nested dictionaries, and up to 100 'exons'. There will always be overlaps between some of exons. Here is a relatively small example:
{
0: {
"exon_count": 4,
"length": 29832,
"exon": {
0: {"start": 77, "end": 323},
1: {"start": 1245, "end": 1507},
2: {"start": 6225, "end": 6598},
3: {"start": 29186, "end": 29909},
},
},
1: {
"exon_count": 3,
"length": 6688,
"exon": {
0: {"start": 0, "end": 323},
1: {"start": 1245, "end": 1507},
2: {"start": 6225, "end": 6688},
},
},
2: {
"exon_count": 4,
"length": 6688,
"exon": {
0: {"start": 0, "end": 323},
1: {"start": 487, "end": 971},
2: {"start": 1245, "end": 1507},
3: {"start": 6225, "end": 6688},
},
},
}
I am struggling to find a way to extract all of the overlaps between the exons. I.e. only extracting start and end coordinates which appear in every nested dictionary.
Here are the overlaps in this example:
77-323
1245-1507
6225-6598
I thought of using a basic for loop, but I don't think it works well here. Please help!