Take the 2-minute tour ×

I have a big dic that contains different miRNA and their target genes. I use dic.values to pop out their target genes. Because I want to calculate their intersection of target genes (it's also called shared targets),using the set.(). Now I have a problem that is: How to write a loop that I can store different sets in different container:

I want to modify this script:

a1 = set(d1.values()[0])
a2 = set(d1.values()[1])
a3 = set(d1.values()[2])

Please give me a hand.T

share|improve this question
add comment

1 Answer

If you only need an intersection of all values:

share|improve this answer
I need to use a formula like set1 & set2, so I have to store them in different containers? Can you help me? Or there are other ways to find the intersection of two sets in one container? –  user1534733 Jul 18 '12 at 12:35
There is the updated answer for the intersection. –  eumiro Jul 18 '12 at 12:38
I have to caculate the shared targets A by B or B by C,not all of them. –  user1534733 Jul 18 '12 at 12:41
add comment

Your Answer


