Mercurial > repos > guerler > springsuite
annotate spring_minz.py @ 29:41353488926c draft
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
author | guerler |
---|---|
date | Sun, 22 Nov 2020 14:15:24 +0000 |
parents | e34da554d415 |
children | 172398348efd |
rev | line source |
---|---|
0
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
1 #! /usr/bin/env python3 |
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
2 import argparse |
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
3 import os |
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
4 |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
5 |
0
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
6 def main(args): |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
7 logFile = open(args.log, 'a+') |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
8 targets = list() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
9 targetPath = args.targetpath.rstrip("/") |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
10 with open(args.targetlist) as file: |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
11 for line in file: |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
12 name = line.strip() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
13 targets.append(name) |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
14 print("Loaded %s target names from `%s`." % (len(targets), |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
15 args.targetlist)) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
16 if args.inputlist: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
17 inputs = list() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
18 inputPath = args.inputpath.rstrip("/") |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
19 with open(args.inputlist) as file: |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
20 for line in file: |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
21 name = line.strip() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
22 inputs.append(name) |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
23 print("Loaded %s input names from `%s`." % (len(inputs), |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
24 args.inputlist)) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
25 else: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
26 inputs = targets |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
27 inputPath = targetPath |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
28 crossReference = dict() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
29 with open(args.crossreference) as file: |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
30 for line in file: |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
31 columns = line.split() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
32 core = columns[0] |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
33 partner = columns[-1] |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
34 if core not in crossReference: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
35 crossReference[core] = [] |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
36 crossReference[core].append(partner) |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
37 print("Loaded cross reference from `%s`." % args.crossreference) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
38 interactions = dict() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
39 for targetName in targets: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
40 targetFile = "%s/%s" % (targetPath, targetName) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
41 matchScores(targetFile=targetFile, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
42 targetName=targetName, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
43 inputs=inputs, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
44 inputPath=inputPath, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
45 crossReference=crossReference, |
27
e34da554d415
"planemo upload commit f12d400ea7827bb7d6b2ef31eb7f38e555bd053f-dirty"
guerler
parents:
25
diff
changeset
|
46 idLength=args.idlength, |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
47 minScore=args.minscore, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
48 logFile=logFile, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
49 interactions=interactions) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
50 if args.inputlist: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
51 for inputName in inputs: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
52 inputDirectory = inputPath |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
53 inputFile = "%s/%s" % (inputDirectory, inputName) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
54 matchScores(targetFile=inputFile, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
55 targetName=inputName, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
56 inputs=targets, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
57 inputPath=targetPath, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
58 crossReference=crossReference, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
59 minScore=args.minscore, |
27
e34da554d415
"planemo upload commit f12d400ea7827bb7d6b2ef31eb7f38e555bd053f-dirty"
guerler
parents:
25
diff
changeset
|
60 idLength=args.idlength, |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
61 logFile=logFile, |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
62 interactions=interactions) |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
63 interactions = sorted(interactions.values(), key=lambda item: item["minZ"], |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
64 reverse=True) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
65 with open(args.output, 'w') as output_file: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
66 for entry in interactions: |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
67 output_file.write("%s\t%s\t%s\t%s\n" % (entry["targetName"], |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
68 entry["inputName"], entry["minZ"], |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
69 entry["minInfo"])) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
70 logFile.close() |
17
c790d25086dc
"planemo upload commit b0ede77caf410ab69043d33a44e190054024d340-dirty"
guerler
parents:
16
diff
changeset
|
71 |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
72 |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
73 def matchScores(targetFile, targetName, inputs, inputPath, crossReference, |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
74 minScore, idLength, logFile, interactions): |
27
e34da554d415
"planemo upload commit f12d400ea7827bb7d6b2ef31eb7f38e555bd053f-dirty"
guerler
parents:
25
diff
changeset
|
75 targetTop, targetHits = getTemplateScores(targetFile, minScore, idLength) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
76 if not targetHits: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
77 print("No targets found `%s`" % targetFile) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
78 else: |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
79 print("Loaded target scores from `%s`." % targetFile) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
80 for inputName in inputs: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
81 inputFile = "%s/%s" % (inputPath, inputName) |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
82 inputTop, inputHits = getTemplateScores(inputFile, |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
83 minScore, idLength) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
84 minZ = 0 |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
85 minInfo = "" |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
86 for t in targetHits: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
87 if t in crossReference: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
88 partners = crossReference[t] |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
89 for p in partners: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
90 if p in inputHits: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
91 score = min(targetHits[t], inputHits[p]) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
92 if score > minZ: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
93 minZ = score |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
94 minInfo = "%s\t%s\t%s\t%s" % (targetTop, |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
95 inputTop, t, p) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
96 if minZ > minScore: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
97 if targetName > inputName: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
98 interactionKey = "%s_%s" % (targetName, inputName) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
99 else: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
100 interactionKey = "%s_%s" % (inputName, targetName) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
101 if interactionKey in interactions: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
102 if interactions[interactionKey]["minZ"] >= minZ: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
103 continue |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
104 interactions[interactionKey] = dict(targetName=targetName, |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
105 inputName=inputName, |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
106 minZ=minZ, minInfo=minInfo) |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
107 logFile.write("Interaction between %s and %s [min-Z: %s].\n" % |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
108 (targetName, inputName, minZ)) |
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
109 |
0
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
110 |
27
e34da554d415
"planemo upload commit f12d400ea7827bb7d6b2ef31eb7f38e555bd053f-dirty"
guerler
parents:
25
diff
changeset
|
111 def getTemplateScores(hhrFile, minScore, idLength): |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
112 result = dict() |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
113 topTemplate = None |
27
e34da554d415
"planemo upload commit f12d400ea7827bb7d6b2ef31eb7f38e555bd053f-dirty"
guerler
parents:
25
diff
changeset
|
114 idLength = idLength + 4 |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
115 if os.path.isfile(hhrFile): |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
116 with open(hhrFile) as file: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
117 for index, line in enumerate(file): |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
118 if index > 8: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
119 if not line.strip(): |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
120 break |
27
e34da554d415
"planemo upload commit f12d400ea7827bb7d6b2ef31eb7f38e555bd053f-dirty"
guerler
parents:
25
diff
changeset
|
121 templateId = line[4:idLength] |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
122 templateScore = float(line[57:63]) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
123 if templateScore > minScore: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
124 if topTemplate is None: |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
125 topTemplate = templateId |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
126 result[templateId] = templateScore |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
127 return topTemplate, result |
0
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
128 |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
129 |
0
d30785e31577
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
guerler
parents:
diff
changeset
|
130 if __name__ == "__main__": |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
131 parser = argparse.ArgumentParser(description='This script identifies interactions by detecting matching HH-search results.') |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
132 parser.add_argument('-tl', '--targetlist', help='Text file containing identifiers.', required=True) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
133 parser.add_argument('-tp', '--targetpath', help='Directory containing `hhr` files', required=True) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
134 parser.add_argument('-il', '--inputlist', help='Text file containing identifiers.', required=False) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
135 parser.add_argument('-ip', '--inputpath', help='Directory containing `hhr` files', required=False) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
136 parser.add_argument('-c', '--crossreference', help='Cross Reference index file', required=True) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
137 parser.add_argument('-o', '--output', help='Output file containing min-Z scores', required=True) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
138 parser.add_argument('-l', '--log', help='Log file', required=True) |
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
139 parser.add_argument('-m', '--minscore', help='min-Z score threshold', type=int, default=10) |
27
e34da554d415
"planemo upload commit f12d400ea7827bb7d6b2ef31eb7f38e555bd053f-dirty"
guerler
parents:
25
diff
changeset
|
140 parser.add_argument('-idx', '--idlength', help='Length of identifier in reference', type=int, default=6) |
23
5469e19f1f96
"planemo upload commit 37a4c6844fd7ab1071ddf90f51915ec1a13c26b3"
guerler
parents:
22
diff
changeset
|
141 args = parser.parse_args() |
29
41353488926c
"planemo upload commit 1c0a60f98e36bccb6d6c85ff82a8d737a811b4d5"
guerler
parents:
27
diff
changeset
|
142 main(args) |