Mercurial > repos > guerler > springsuite
diff spring_minz.py @ 25:5d1ae615e4ec draft
"planemo upload commit ff7d7e512b79436c3538078552983762330a920d-dirty"
author | guerler |
---|---|
date | Sat, 31 Oct 2020 22:01:29 +0000 |
parents | 5469e19f1f96 |
children | e34da554d415 |
line wrap: on
line diff
--- a/spring_minz.py Thu Oct 29 13:09:57 2020 +0000 +++ b/spring_minz.py Sat Oct 31 22:01:29 2020 +0000 @@ -41,7 +41,6 @@ inputPath=inputPath, crossReference=crossReference, minScore=args.minscore, - idLength=args.idx, logFile=logFile, interactions=interactions) if args.inputlist: @@ -54,7 +53,6 @@ inputPath=targetPath, crossReference=crossReference, minScore=args.minscore, - idLength=args.idx, logFile=logFile, interactions=interactions) interactions = sorted(interactions.values(), key=lambda item: item["minZ"], reverse=True) @@ -63,15 +61,15 @@ output_file.write("%s\t%s\t%s\t%s\n" % (entry["targetName"], entry["inputName"], entry["minZ"], entry["minInfo"])) logFile.close() -def matchScores(targetFile, targetName, inputs, inputPath, crossReference, minScore, idLength, logFile, interactions): - targetTop, targetHits = getTemplateScores(targetFile, minScore, idLength) +def matchScores(targetFile, targetName, inputs, inputPath, crossReference, minScore, logFile, interactions): + targetTop, targetHits = getTemplateScores(targetFile, minScore) if not targetHits: print("No targets found `%s`" % targetFile) else: print ("Loaded target scores from `%s`." % targetFile) for inputName in inputs: inputFile = "%s/%s" % (inputPath, inputName) - inputTop, inputHits = getTemplateScores(inputFile, minScore, idLength) + inputTop, inputHits = getTemplateScores(inputFile, minScore) minZ = 0 minInfo = "" for t in targetHits: @@ -94,17 +92,16 @@ interactions[interactionKey] = dict(targetName=targetName, inputName=inputName, minZ=minZ, minInfo=minInfo) logFile.write("Interaction between %s and %s [min-Z: %s].\n" % (targetName, inputName, minZ)) -def getTemplateScores(hhrFile, minScore, identifierLength): +def getTemplateScores(hhrFile, minScore): result = dict() topTemplate = None - identifierLength = identifierLength + 4 if os.path.isfile(hhrFile): with open(hhrFile) as file: for index, line in enumerate(file): if index > 8: if not line.strip(): break - templateId = line[4:identifierLength] + templateId = line[4:10] templateScore = float(line[57:63]) if templateScore > minScore: if topTemplate is None: @@ -119,7 +116,6 @@ parser.add_argument('-il', '--inputlist', help='Text file containing identifiers.', required=False) parser.add_argument('-ip', '--inputpath', help='Directory containing `hhr` files', required=False) parser.add_argument('-c', '--crossreference', help='Cross Reference index file', required=True) - parser.add_argument('-x', '--idx', help='Length of identifier', type=int, default=6) parser.add_argument('-o', '--output', help='Output file containing min-Z scores', required=True) parser.add_argument('-l', '--log', help='Log file', required=True) parser.add_argument('-m', '--minscore', help='min-Z score threshold', type=int, default=10)