I have afile which has entries like
BIG_CLUSTER106: cluster1150: CUB CUB CUB
BIG_CLUSTER106: cluster1627: CUB Zona_pellucida
BIG_CLUSTER106: cluster1632: CUB CUB CUB CUB CUB
BIG_CLUSTER106: cluster1814: Kringle WSC CUB
BIG_CLUSTER106: cluster2768: CUB CUB F5_F8_type_C F5_F8_type_C MAM DUF3481
BIG_CLUSTER106: cluster661: Astacin CUB CUB CUB CUB
BIG_CLUSTER106: cluster687: CUB PDGF
BIG_CLUSTER106: cluster701: CUB CUB Zona_pellucida
BIG_CLUSTER106: cluster744: CUB CUB
BIG_CLUSTER106: cluster968: CUB Laminin_EGF
now I have written program which conver this format to this format
>BIG_CLUSTER106: [['CUB', 'CUB', 'CUB'], ['CUB', 'Zona_pellucida'], ['CUB', 'CUB', 'CUB', 'CUB', 'CUB'], ['Kringle', 'WSC', 'CUB'], ['CUB', 'CUB', 'F5_F8_type_C', 'F5_F8_type_C', 'MAM', 'DUF3481'], ['Astacin', 'CUB', 'CUB', 'CUB', 'CUB'], ['CUB', 'PDGF'], ['CUB', 'CUB', 'Zona_pellucida'], ['CUB', 'CUB'], ['CUB', 'Laminin_EGF']]
program
from sys import*
file = open(argv[1],'r')
outfile = open(argv[2],'w')
buffer = []
bigcluster = ''
setlist = []
rec = file.readlines()
for line in rec :
field = line.split()
if (bigcluster != field[0]):
print setlist
setlist = []
header = ">"+field[0]#header is the variable caries the values
print header +"\t",
#outfile.writelines(header+"\n")
bigcluster = field[0]
#setlist = field[2:]
setlist.append(field[2:])
#print setlist
#setlist = []
#outfile.writelines(setlist)
file.close()
outfile.close()
but i want to change something so that list of list which i got from this program , set operation on all list to get common string from all the list
like >BIG_CLUSTER106: 'CUB' from
>BIG_CLUSTER106: [['CUB', 'CUB', 'CUB'], ['CUB', 'Zona_pellucida'], ['CUB', 'CUB', 'CUB', 'CUB', 'CUB'], ['Kringle', 'WSC', 'CUB'], ['CUB', 'CUB', 'F5_F8_type_C', 'F5_F8_type_C', 'MAM', 'DUF3481'], ['Astacin', 'CUB', 'CUB', 'CUB', 'CUB'], ['CUB', 'PDGF'], ['CUB', 'CUB', 'Zona_pellucida'], ['CUB', 'CUB'], ['CUB', 'Laminin_EGF']]