comparison spring_minz.py @ 8:f2f38991c36f draft

"planemo upload commit ab5e686c62d07a0d45216b474d435b855745222d-dirty"
author guerler
date Sat, 01 Aug 2020 00:35:20 -0400
parents d30785e31577
children 4ac5d5a9b21c
comparison
equal deleted inserted replaced
7:2b9ed61195e2 8:f2f38991c36f
17 if core not in crossreference: 17 if core not in crossreference:
18 crossreference[core] = [] 18 crossreference[core] = []
19 crossreference[core].append(partner) 19 crossreference[core].append(partner)
20 print ("Loaded cross reference from `%s`." % args.crossreference) 20 print ("Loaded cross reference from `%s`." % args.crossreference)
21 targets = get_template_scores(args.target, args.minscore) 21 targets = get_template_scores(args.target, args.minscore)
22 interactions = []
22 if not targets: 23 if not targets:
23 print("No targets found `%s`" % args.target) 24 print("No targets found `%s`" % args.target)
24 else: 25 else:
25 print ("Loaded target scores from `%s`." % args.target) 26 print ("Loaded target scores from `%s`." % args.target)
26 interactions = []
27 for name in names: 27 for name in names:
28 input_directory = args.inputs.rstrip("/") 28 input_directory = args.inputs.rstrip("/")
29 input_file = "%s/%s" % (input_directory, name) 29 input_file = "%s/%s" % (input_directory, name)
30 templates = get_template_scores(input_file, args.minscore) 30 templates = get_template_scores(input_file, args.minscore)
31 minz = 0 31 minz = 0
39 minz = score 39 minz = score
40 if minz > args.minscore: 40 if minz > args.minscore:
41 interactions.append((name, minz)) 41 interactions.append((name, minz))
42 print("Predicting: %s, min-Z: %s" % (name, minz)) 42 print("Predicting: %s, min-Z: %s" % (name, minz))
43 interactions.sort(key=lambda tup: tup[1], reverse=True) 43 interactions.sort(key=lambda tup: tup[1], reverse=True)
44 with open(args.output, 'w') as output_file: 44 with open(args.output, 'w') as output_file:
45 for i in interactions: 45 for i in interactions:
46 output_file.write("%s %s\n" % (i[0], i[1])) 46 output_file.write("%s %s\n" % (i[0], i[1]))
47 47
48 def get_template_scores(hhr_file, min_score): 48 def get_template_scores(hhr_file, min_score):
49 result = {} 49 result = {}
50 if os.path.isfile(hhr_file): 50 if os.path.isfile(hhr_file):
51 with open(hhr_file) as file: 51 with open(hhr_file) as file: