changeset 22:acaff61a09b2 draft

"planemo upload commit 83cb18661a4c7839dbec8d42b6018ddc80defd8f-dirty"
author guerler
date Wed, 28 Oct 2020 06:49:58 +0000
parents 5feab7f00f02
children 5469e19f1f96
files spring_minz.py spring_minz.xml test-data/dbCAN_result.txt
diffstat 3 files changed, 24 insertions(+), 22 deletions(-) [+]
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
 
--- a/spring_minz.xml	Wed Oct 28 05:34:36 2020 +0000
+++ b/spring_minz.xml	Wed Oct 28 06:49:58 2020 +0000
@@ -28,29 +28,29 @@
         <test>
             <param name="targets">
                 <collection type="list">
-                    <element name="6W4H_A.hhr" value="6W4H_A.hhr" />
-                    <element name="6W4H_B.hhr" value="6W4H_B.hhr" />
-                    <element name="6W9C_A.hhr" value="6W9C_A.hhr" />
-                    <element name="6W9Q_A.hhr" value="6W9Q_A.hhr" />
-                    <element name="6W37_A.hhr" value="6W37_A.hhr" />
-                    <element name="6WEY_A.hhr" value="6WEY_A.hhr" />
+					<element name="6WEY_A.hhr" value="6WEY_A.hhr" />
                     <element name="6WJI_A.hhr" value="6WJI_A.hhr" />
                     <element name="6WLC_A.hhr" value="6WLC_A.hhr" />
                     <element name="7BQY_A.hhr" value="7BQY_A.hhr" />
+                    <element name="6W37_A.hhr" value="6W37_A.hhr" />
+                    <element name="6W9C_A.hhr" value="6W9C_A.hhr" />
+                    <element name="6W4H_A.hhr" value="6W4H_A.hhr" />
+                    <element name="6W4H_B.hhr" value="6W4H_B.hhr" />
+                    <element name="6W9Q_A.hhr" value="6W9Q_A.hhr" />
                 </collection>
             </param>
             <param name="idx" value="10"/>
             <param name="inputs">
                 <collection type="list">
-                    <element name="6W4H_A.hhr" value="6W4H_A.hhr" />
-                    <element name="6W4H_B.hhr" value="6W4H_B.hhr" />
-                    <element name="6W9C_A.hhr" value="6W9C_A.hhr" />
-                    <element name="6W9Q_A.hhr" value="6W9Q_A.hhr" />
-                    <element name="6W37_A.hhr" value="6W37_A.hhr" />
-                    <element name="6WEY_A.hhr" value="6WEY_A.hhr" />
+					<element name="6WEY_A.hhr" value="6WEY_A.hhr" />
                     <element name="6WJI_A.hhr" value="6WJI_A.hhr" />
                     <element name="6WLC_A.hhr" value="6WLC_A.hhr" />
                     <element name="7BQY_A.hhr" value="7BQY_A.hhr" />
+                    <element name="6W37_A.hhr" value="6W37_A.hhr" />
+                    <element name="6W9C_A.hhr" value="6W9C_A.hhr" />
+                    <element name="6W4H_A.hhr" value="6W4H_A.hhr" />
+                    <element name="6W4H_B.hhr" value="6W4H_B.hhr" />
+                    <element name="6W9Q_A.hhr" value="6W9Q_A.hhr" />
                 </collection>
             </param>
             <param name="crossreference" value="dbCAN_random.txt"/>
--- a/test-data/dbCAN_result.txt	Wed Oct 28 05:34:36 2020 +0000
+++ b/test-data/dbCAN_result.txt	Wed Oct 28 06:49:58 2020 +0000
@@ -5,5 +5,5 @@
 6W37_A.hhr	6W9C_A.hhr	21.3	CAG81347.1	ACY47587.1	CAG81347.1	AAO76127.1
 6W9Q_A.hhr	6W9C_A.hhr	21.0	AJP22991.1	ACY47587.1	ATY34423.1	AHA42547.2
 6W37_A.hhr	6W4H_B.hhr	16.0	CAG81347.1	CAR47543.1	ABO94043.1	ACY95489.1
+7BQY_A.hhr	6W37_A.hhr	14.0	QCE11709.1	CAG81347.1	ABO94043.1	ACY95489.1
 6W37_A.hhr	6W37_A.hhr	14.0	CAG81347.1	CAG81347.1	ABO94043.1	ACY95489.1
-7BQY_A.hhr	6W37_A.hhr	14.0	QCE11709.1	CAG81347.1	ABO94043.1	ACY95489.1