I have a file like this:
A2ML1,ENST00000541459
A2ML1,ENST00000545692
A2ML1,ENST00000545850
A3GALT2,ENST00000442999
A4GALT,ENST00000249005
A4GALT,ENST00000381278
And I want to group the lines like this:
A2ML1,ENST00000541459,ENST00000545692,ENST00000545850
A3GALT2,ENST00000442999
A4GALT,ENST00000249005,ENST00000381278
Here is my code in python, that is leaving the file as original XD:
import sys
with open('gene_list.csv', 'r') as file_open:
    iterfile = iter(file_open)
    for line in iterfile:
        l = line.split(",")
        select = l[0]
        linext = iterfile.next()
        linext2 = linext.split(",")
        if select == linext2[0]:
            sys.stdout.write(select + ',' + linext2[1])
            next(file_open)
        else:
            sys.stdout.write(select + ',' + l[1])
I know that it is very easy to do but I am stuck with this. I really apreciate your help. Thanks!
 
     
     
    