Mercurial > repos > guerler > springsuite
diff spring_minz.py @ 22:acaff61a09b2 draft
"planemo upload commit 83cb18661a4c7839dbec8d42b6018ddc80defd8f-dirty"
author | guerler |
---|---|
date | Wed, 28 Oct 2020 06:49:58 +0000 |
parents | 5feab7f00f02 |
children | 5469e19f1f96 |
line wrap: on
line diff
--- a/spring_minz.py Wed Oct 28 05:34:36 2020 +0000 +++ b/spring_minz.py Wed Oct 28 06:49:58 2020 +0000 @@ -3,18 +3,18 @@ import os def main(args): - inputs = set() + inputs = list() with open(args.inputlist) as file: for index, line in enumerate(file): name = line.strip() - inputs.add(name) + inputs.append(name) print ("Loaded %s input names from `%s`." % (len(inputs), args.inputlist)) - targets = set() + targets = list() duplicates = 0 with open(args.targetlist) as file: for index, line in enumerate(file): name = line.strip() - targets.add(name) + targets.append(name) if name in inputs: duplicates = duplicates + 1 print ("Loaded %s target names from `%s`." % (len(targets), args.targetlist)) @@ -34,7 +34,7 @@ targetFile = "%s/%s" % (targetDirectory, targetName) matchScores(targetFile=targetFile, targetName=targetName, - inputs=inputs, + inputs=sorted(inputs), inputPath=args.inputpath, crossReference=crossReference, minScore=args.minscore, @@ -80,11 +80,13 @@ minInfo = "%s\t%s\t%s\t%s" % (targetTop, inputTop, t, p) if minZ > minScore: if targetName > inputName: - interactionKey = "%s_%s_%s" % (targetName, inputName, minZ) + interactionKey = "%s_%s" % (targetName, inputName) else: - interactionKey = "%s_%s_%s" % (inputName, targetName, minZ) - if interactionKey not in interactions: - interactions[interactionKey] = dict(targetName=targetName, inputName=inputName, minZ=minZ, minInfo=minInfo) + interactionKey = "%s_%s" % (inputName, targetName) + if interactionKey in interactions: + if interactions[interactionKey]["minZ"] >= minZ: + continue + interactions[interactionKey] = dict(targetName=targetName, inputName=inputName, minZ=minZ, minInfo=minInfo) print("Predicting: %s, min-Z: %s, templates: %s" % (inputName, minZ, minInfo)) return interactions