comparison SAINT_preprocessing_v6.py @ 17:40c88c39f8d7 draft

Uploaded
author bornea
date Tue, 17 Nov 2015 12:14:10 -0500
parents 13383ba55336
children b230824e1a0e
comparison
equal deleted inserted replaced
16:413ffa0e80e7 17:40c88c39f8d7
24 fasta_db = str(tool_path) + "/SwissProt_HUMAN_2014_08.fasta" 24 fasta_db = str(tool_path) + "/SwissProt_HUMAN_2014_08.fasta"
25 make_bait= sys.argv[6] 25 make_bait= sys.argv[6]
26 26
27 27
28 baits = make_bait.split() 28 baits = make_bait.split()
29 print baits
30 i = 0 29 i = 0
31 bait_file_tmp = open("bait.txt", "wr") 30 bait_file_tmp = open("bait.txt", "wr")
32 order = [] 31 order = []
33 bait_cache = [] 32 bait_cache = []
34 33
133 db_len = len(lines) 132 db_len = len(lines)
134 seqlength = 0 133 seqlength = 0
135 count = 0 134 count = 0
136 for i in lines: 135 for i in lines:
137 if ">sp" in i: 136 if ">sp" in i:
137 namer = i.split("|")[2]
138 if uniprot_accession_in == i.split("|")[1]: 138 if uniprot_accession_in == i.split("|")[1]:
139 match = count+1
140 if 'GN=' in i:
141 lst = i.split('GN=')
142 lst2 = lst[1].split(' ')
143 genename = lst2[0]
144 if 'GN=' not in i:
145 genename = 'NA'
146 while ">sp" not in lines[match]:
147 if match <= db_len:
148 seqlength = seqlength + len(lines[match].strip())
149 match = match + 1
150 else:
151 break
152 return ReturnValue1(seqlength, genename)
153 elif uniprot_accession_in == namer.split(" "):
139 match = count+1 154 match = count+1
140 if 'GN=' in i: 155 if 'GN=' in i:
141 lst = i.split('GN=') 156 lst = i.split('GN=')
142 lst2 = lst[1].split(' ') 157 lst2 = lst[1].split(' ')
143 genename = lst2[0] 158 genename = lst2[0]
240 sys.exit("Bait must share header titles with Scaffold output") 255 sys.exit("Bait must share header titles with Scaffold output")
241 256
242 if __name__ == '__main__': 257 if __name__ == '__main__':
243 main(infile, baitfile) 258 main(infile, baitfile)
244 259
245 os.rename('inter.txt', sys.argv[4]) 260 os.rename("inter.txt", sys.argv[4])
246 os.rename("bait.txt", sys.argv[7]) 261 os.rename("bait.txt", sys.argv[7])