Mercurial > repos > bornea > saint_preprocessing
comparison SAINT_preprocessing_mq_pep.py @ 40:8102ffab0f85 draft
Uploaded
author | bornea |
---|---|
date | Thu, 19 May 2016 10:35:15 -0400 |
parents | e414a55b4c42 |
children | ca0649bf68e3 |
comparison
equal
deleted
inserted
replaced
39:e414a55b4c42 | 40:8102ffab0f85 |
---|---|
249 bait_index = [] | 249 bait_index = [] |
250 for bait_item in bait: | 250 for bait_item in bait: |
251 bait_index.append(header.index(bait_item[0])) | 251 bait_index.append(header.index(bait_item[0])) |
252 proteins = read_MaxQuant(MaxQuant_input).proteins | 252 proteins = read_MaxQuant(MaxQuant_input).proteins |
253 errors = [] | 253 errors = [] |
254 valid_prots = [] | |
254 for e in err: | 255 for e in err: |
255 errors.append(e[0]) | 256 errors.append(e[0]) |
256 for a in proteins: | 257 for a in proteins: |
257 a = a.replace("\n", "") | 258 a = a.replace("\n", "") |
258 # Remove \n for input into function. | 259 # Remove \n for input into function. |
259 a = a.replace("\r", "") | 260 a = a.replace("\r", "") |
260 # Ditto for \r. | 261 # Ditto for \r. |
261 seq = get_info(a).seqlength | 262 seq = get_info(a).seqlength |
262 GN = get_info(a).genename | 263 GN = get_info(a).genename |
263 if seq == 'NA': | 264 if seq != 'NA': |
264 if GN == 'NA': | 265 if GN != 'NA': |
265 errors.append(a) | 266 valid_prots.append(a) |
266 with open('inter.txt', 'w') as input_file: | 267 with open('inter.txt', 'w') as input_file: |
267 l = 0; a = 0 | 268 l = 0; a = 0 |
268 for bb in bait: | 269 for bb in bait: |
269 for lst in data: | 270 for lst in data: |
270 if proteins[a] not in errors: | 271 if valid_prots[a] not in errors: |
271 input_file.write(header[bait_index[l]] + '\t' + bb[1] + '\t' + proteins[a] + '\t' | 272 input_file.write(header[bait_index[l]] + '\t' + bb[1] + '\t' + proteins[a] + '\t' |
272 + lst[bait_index[l]] + '\n') | 273 + lst[bait_index[l]] + '\n') |
273 a += 1 | 274 a += 1 |
274 if a == len(proteins): | 275 if a == len(valid_prots): |
275 l += 1; a = 0 | 276 l += 1; a = 0 |
276 | 277 |
277 | 278 |
278 def bait_check(bait, MaxQuant_input): | 279 def bait_check(bait, MaxQuant_input): |
279 # Check that bait names share header titles. | 280 # Check that bait names share header titles. |