diff SAINT_preprocessing_mq_pep.py @ 40:8102ffab0f85 draft

Uploaded
author bornea
date Thu, 19 May 2016 10:35:15 -0400
parents e414a55b4c42
children ca0649bf68e3
line wrap: on
line diff
--- a/SAINT_preprocessing_mq_pep.py	Thu May 19 10:29:44 2016 -0400
+++ b/SAINT_preprocessing_mq_pep.py	Thu May 19 10:35:15 2016 -0400
@@ -251,6 +251,7 @@
         bait_index.append(header.index(bait_item[0]))
     proteins = read_MaxQuant(MaxQuant_input).proteins
     errors = []
+    valid_prots = []
     for e in err:
         errors.append(e[0])
     for a in proteins:
@@ -260,18 +261,18 @@
         # Ditto for \r.
         seq = get_info(a).seqlength
         GN = get_info(a).genename
-        if seq == 'NA':
-            if GN == 'NA':
-                errors.append(a)
+        if seq != 'NA':
+            if GN != 'NA':
+                valid_prots.append(a)
     with open('inter.txt', 'w') as input_file:
         l = 0; a = 0
         for bb in bait:
             for lst in data:
-                if proteins[a] not in errors:
+                if valid_prots[a] not in errors:
                     input_file.write(header[bait_index[l]] + '\t' + bb[1] + '\t' + proteins[a] + '\t' 
                             + lst[bait_index[l]] + '\n')
                 a += 1
-                if a == len(proteins):
+                if a == len(valid_prots):
                     l += 1; a = 0