# HG changeset patch # User bornea # Date 1463674320 14400 # Node ID 09b89febcf987dd3ef2701e06a715bbdce89b12a # Parent 61b792d1766087db65a174df767d6297a09e05cd Uploaded diff -r 61b792d17660 -r 09b89febcf98 SAINT_preprocessing.py --- a/SAINT_preprocessing.py Thu May 19 12:07:36 2016 -0400 +++ b/SAINT_preprocessing.py Thu May 19 12:12:00 2016 -0400 @@ -242,40 +242,25 @@ bait = readtab(baitfile) data = read_Scaffold(Scaffold_input).data header = read_Scaffold(Scaffold_input).header - header = [MQ_var.replace(r"\"", "") for MQ_var in header] - header = [MQ_var.replace(r"Intensity.", r"") for MQ_var in header] - header = [MQ_var.replace(r".", r"-") for MQ_var in header] bait_index = [] - for bait_item in bait: - bait_index.append(header.index(bait_item[0])) + for bait_line in bait: + bait_index.append(header.index(bait_line[0])) proteins = read_Scaffold(Scaffold_input).proteins errors = [] - valid_prots = [] for e in err: errors.append(e[0]) - for a in proteins: - a = a.replace("\n", "") - # Remove \n for input into function. - a = a.replace("\r", "") - # Ditto for \r. - seq = get_info(a).seqlength - GN = get_info(a).genename - if seq != 'NA': - if GN != 'NA': - valid_prots.append(a) - with open('inter.txt', 'w') as input_file: + with open('inter.txt', 'w') as y: l = 0; a = 0 for bb in bait: for lst in data: - print lst - if lst[0] in valid_prots: - input_file.write(header[bait_index[l]] + '\t' + bb[1] + '\t' + lst[0] + '\t' + lst[bait_index[l]] + '\n') + if proteins[a] not in errors: + y.write(header[bait_index[l]] + '\t' + bb[1] + '\t' + proteins[a] + '\t' + + lst[bait_index[l]] + '\n') a += 1 if a == len(proteins): l += 1; a = 0 - def bait_check(bait, Scaffold_input): # Check that bait names share Scaffold header titles. bait_in = readtab(bait)