I have files with two column, column 1 is with id and column 2 is with data(sequence)<br>My goal is to create a table in such a way, the column one of the table should have all the id from the files and next column will be have the respective seq of the file1 with correlation to the id and the third column will be sequence information of the next file with respective to the id<br>
original files look like this <br><br>45    ytut<br>46    erete<br>37   dfasf<br>45  dassdsd<br><br><br>and so on  for all the 10 files that is it has two column as mentioned above.<br><br>The output should look like this:<br>
<br>Id    file1      file2     file3     file4   file5<br>43    ytuh    ytuh     ytuh    ytuh    ytuh<br>46   erteee   rty       ryyy              ertyu<br>47   yutio    rrr                    eeerr     <br clear="all"><br>
<br><br>The goal is if the pick all the common id in the files and with their respective information in the adjacent rows.<br>the various conditons ca also prevails<br>1) common id present in all the files, which have same information<br>
2)common id present in all the files, which donot have same information<br>3) common id may not be present in all the files <br><br>But the goal is exactly find the common id in all the files and add their corresponding information in the file to the table as per the view<br>
 my script :<br>def file1_search(*files1):<br>    for file1 in files1:<br>        gi1_lis = []<br>        fh = open(file1,'r')<br>        for line in fh.readlines():<br>            data1 = line.strip().split('\t')<br>
            gi1 = data1[0].strip()<br>            seq1 = data1[1].strip()<br>            gi1_lis.append(gi1)<br>        return gi1_lis<br>def file2_search(**files2):<br>    for file2 in files2:<br>        for file in files2[file2]:<br>
            gi2_lis = []<br>            fh1 = open(file,'r')<br>            for line1 in fh1.readlines():<br>                data2 = line1.strip().split('\t')<br>                gi2 = data2[0].strip()<br>                seq2 = data2[1].strip()<br>
                gi2_lis.append(gi2)<br><br>            return gi2_lis<br>def set_compare(data1,data2,*files1,**files2):<br>    A = set(data1) <br>    B = set(data2)<br>    I = A&B # common between thesetwo sets<br><br>
    D = A-B #57 is the len of D<br>    C = B-A #176 is  the len of c <br>#    print len(C)<br> #   print len(D)<br>    for file1 in files1:<br>        for gi in D:<br>            fh = open(file1,'r')<br>            for line in fh.readlines():<br>
                data1 = line.strip().split('\t')<br>                gi1 = data1[0].strip()<br>                seq1 = data1[1].strip()<br>            if gi == gi1:<br>#                print line.strip()<br>                    pass<br>
<br>    for file2 in files2:<br>        for file in files2[file2]:<br>            for gi in C:<br>                fh1 = open(file,'r')<br>                for line1 in fh1.readlines():<br>                    data2 = line1.strip().split('\t')<br>
                    gi2 = data2[0].strip()<br>                    seq2 = data2[1].strip()<br>                if gi == gi2:<br>                   # print line1.strip()<br>                    pass    <br>if __name__ == "__main__":<br>
    files1 = ["Fr20.txt",\<br>              "Fr22.txt",\<br>              "Fr24.txt",\<br>              "Fr60.txt",\<br>              "Fr62.txt"]<br>    files2 = {"data":["Fr64.txt",\<br>
              "Fr66.txt",\<br>              "Fr68.txt",\<br>              "Fr70.txt",\<br>              "Fr72.txt"]}<br>    data1 = file1_search(*files1)<br>    <br>    """113 is the total number of gi"""<br>
    data2 = file2_search(**files2)<br>    #for j in data2:<br>     #   print j <br>    """232 is the total number of gi found"""<br>    result = set_compare(data1,data2,*files1,**files2)<br><br>
 It doesnot work fine... some body please suggest me the way i can proceed .<br>Thanks a lot<br><br>-- <br>Beema Shafreen