Mercurial > repos > ganjoo > webservice_toolsuite
annotate WebServiceToolWorkflow/generateClient.py @ 0:d5cd409b8a18 default tip
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author | ganjoo |
---|---|
date | Tue, 07 Jun 2011 18:00:50 -0400 |
parents | |
children |
rev | line source |
---|---|
0
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
1 import warnings |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
2 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
3 with warnings.catch_warnings(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
4 warnings.simplefilter("ignore") |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
5 import platform |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
6 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
7 from jpype._jpackage import JPackage |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
8 from jpype import * |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
9 import os.path |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
10 import sys |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
11 import string |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
12 from edit_tool_conf import * |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
13 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
14 class ClientGenerator(object): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
15 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
16 #instantiate a client for invocation of the selected method of a Web service in workflows |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
17 def __init__(self,url,methodName,resourceName,fileName): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
18 self.methodName = methodName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
19 self.resourceName=resourceName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
20 self.Ofile = fileName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
21 #replace '__tilda__' with '~' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
22 if(url.find('__tilda__')>-1): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
23 ulist = url.split('__tilda__') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
24 url = '~'.join(ulist) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
25 self.url = url |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
26 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
27 #replace '**' with ' ' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
28 def formatString(self,string): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
29 l = string.split(' ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
30 return '**'.join(l) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
31 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
32 #generates a xml describing a client capable of invoking a Web service described |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
33 #using a WADL document. Places this xml tool under ./workflowclients/ |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
34 def wadlClient(self): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
35 ##parse wadl |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
36 #javahome = os.environ.get('JAVA_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
37 #galaxyhome=os.environ.get('GALAXY_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
38 #classpath= galaxyhome + '/tools/WebServiceToolWorkflow/ParserForWADL/bin' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
39 #jarpath = galaxyhome + '/tools/WebServiceToolWorkflow/ParserForWADL/lib/' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
40 #machine = platform.machine() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
41 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
42 #if machine == 'x86_64' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
43 # print 'a' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
44 # startJVM("%s/jre/lib/amd64/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
45 #elif machine == 'i686' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
46 # print 'b' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
47 # startJVM("%s/jre/lib/i386/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
48 #elif machine == 'sun4u' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
49 # startJVM("%s/jre/lib/sparc/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
50 #else : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
51 # print 'c' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
52 # System.exit("Could not identify machine, please specify path to libjvm.so") |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
53 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
54 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
55 pkg=JPackage('lsdis') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
56 urlToPass=java.net.URL(self.url) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
57 wadlUrl = self.url |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
58 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
59 webserviceId = self.methodName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
60 resUrl = self.resourceName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
61 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
62 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
63 urls = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
64 methods = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
65 params = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
66 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
67 #invoke the WADL parser packaged with this tool. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
68 WADLParserDriver=pkg.WADLParserDriver |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
69 wPD=WADLParserDriver() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
70 wPD.parse(urlToPass) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
71 urls = wPD.getUrl() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
72 methods = wPD.getCompleteMethodList() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
73 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
74 #write into the output file information about the method and Web service to be invoked. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
75 f=open(self.Ofile,'w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
76 f.write(wadlUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
77 f.write('\n'+ resUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
78 f.write('\n'+webserviceId) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
79 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
80 #get parameters for the selected method of the Web service |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
81 i=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
82 for method in methods: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
83 f.write('\n in methods') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
84 x = str(method.getId()) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
85 y = str(urls.get(i)) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
86 if x == webserviceId : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
87 f.write('\n method matched') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
88 f.write('\n y is' + y + ', resUrl is '+resUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
89 if y == resUrl : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
90 f.write('res matched') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
91 params = method.getRequest().getParams() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
92 break |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
93 i=i+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
94 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
95 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
96 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
97 galaxyhome=os.environ.get('GALAXY_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
98 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
99 #./workflowclients/ClientCount.xml keeps the count of the clients/tools currently registered in Galaxy for Web service invocation. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
100 #read the count and increment it. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
101 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow/workflowclients/ClientCount.xml','r') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
102 clientCountFile.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
103 clientCountStr = clientCountFile.read(1) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
104 clientCount=string.atoi(clientCountStr) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
105 clientCount=clientCount+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
106 clientCountFile.close() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
107 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
108 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow/workflowclients/ClientCount.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
109 clientCountFile.write('<count> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
110 clientCountFile.write(str(clientCount)) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
111 clientCountFile.write('</count> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
112 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
113 #include the count in the tool's name and id to uniquely identify it. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
114 clientName = 'client_'+ str(clientCount) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
115 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
116 #create a new xml file under ./workflowclients/ |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
117 clientXml=open(galaxyhome+'/tools/WebServiceToolWorkflow/workflowclients/'+clientName+'.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
118 clientXml.seek(0,0) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
119 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
120 #write the tool id, name and description |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
121 clientXml.write('<tool id="' + clientName+'" name="' + self.methodName +' ">\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
122 clientXml.write(' <description> Client for method: '+self.methodName+' , Web service: '+self.url+' </description>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
123 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
124 #the workflow tool/client for a REST Web service invokes ./workflowclients/client_1.py to invoke the Web service |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
125 #write the command tag to specify the arguments passed to this client_1.py |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
126 clientXml.write(' <command interpreter="python">\n client_1.py\n'+' #if $cond_source.optional_param_source=="no":\n $output\n ' +resUrl+'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
127 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
128 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
129 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
130 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
131 if param.isRequired(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
132 clientXml.write(' '+self.formatString(param.getName())+'\n #if $source'+str(j)+'.source'+str(j)+'_source=="user":\n $source'+str(j)+'.user_param'+str(j)+'\n #else:\n fileInput\n $source' + str(j) + '.cached_param' + str(j)+'\n #end if\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
133 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
134 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
135 clientXml.write(' #else:\n $output\n ' +resUrl+'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
136 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
137 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
138 if param.isRequired(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
139 clientXml.write(' '+self.formatString(param.getName())+'\n #if $source'+str(j)+'.source'+str(j)+'_source=="user":\n $source'+str(j)+'.user_param'+str(j)+'\n #else:\n fileInput\n $source' + str(j) + '.cached_param' + str(j)+'\n #end if\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
140 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
141 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
142 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
143 if not param.isRequired(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
144 clientXml.write(' '+self.formatString(param.getName())+'\n #if $cond_source.source'+str(j)+'.source'+str(j)+'_source=="user":\n $cond_source.source'+str(j)+'.user_param'+str(j)+'\n #else:\n fileInput\n $cond_source.source' + str(j) + '.cached_param' + str(j)+'\n #end if\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
145 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
146 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
147 clientXml.write(' #end if\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
148 clientXml.write('</command>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
149 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
150 #start writing inputs |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
151 clientXml.write(' <inputs>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
152 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
153 #create a param for each required parameter described in the WADL. Check if defaults are specified. Create param such that |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
154 #it can either be given a value manually or the value can be taken from a previous step. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
155 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
156 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
157 if param.isRequired(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
158 pName = param.getName() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
159 for doc in param.getDocs(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
160 if doc.getTitle()=="prompt" or doc.getTitle()=="Prompt" or doc.getTitle()=="PROMPT": |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
161 pName = doc.getInnerText() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
162 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
163 clientXml.write('<conditional name="source'+str(j)+'">\n <param name="source' + str(j)+'_source" type="select" label="'+pName+' Source"> \n <option value="cached" selected="true">Param value will be taken from previous step</option> \n <option value="user">User will enter the param value</option> \n </param>\n <when value="user">\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
164 if param.getOptions().size()==0: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
165 clientXml.write(' <param format="text" size = "150" name = "user_param'+str(j)+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
166 if not param.getDefault1() == None: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
167 clientXml.write('value="'+param.getDefault1()+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
168 clientXml.write('type="text" label="Enter '+pName+'" help="see tip below" />\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
169 else: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
170 clientXml.write(' <param name="user_param'+str(j)+'" type="select" label="Select '+pName+'" help="see tip below">\n' ) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
171 for option in param.getOptions(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
172 clientXml.write(' <option value="'+self.formatString(option.getName())+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
173 if option.getName() == param.getDefault1(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
174 clientXml.write('selected="true"') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
175 clientXml.write('>'+option.getName()+'</option>\n ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
176 clientXml.write(' </param> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
177 clientXml.write(' </when>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
178 clientXml.write(' <when value="cached">\n <param name = "cached_param'+ str(j)+'" type="data" label="Choose the step from which to get the parameter ' + pName + '"/> \n </when></conditional>') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
179 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
180 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
181 #create a conditional param for each optional parameter described in the WADL. Again the param can be given a value manually or the value can be taken from |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
182 #a previous step. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
183 clientXml.write(' <conditional name="cond_source">\n <param name="optional_param_source" type="select" label="Display Additional Parameters"> \n <option value="no" selected="true">no</option> \n <option value="yes">yes</option> \n </param> \n <when value="no"> \n </when>\n <when value="yes"> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
184 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
185 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
186 if not param.isRequired(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
187 pName = param.getName() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
188 for doc in param.getDocs(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
189 if doc.getTitle()=="prompt" or doc.getTitle()=="Prompt" or doc.getTitle()=="PROMPT": |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
190 pName = doc.getInnerText() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
191 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
192 clientXml.write('\n<conditional name="source'+str(j)+'">\n <param name="source' + str(j)+'_source" type="select" label="'+pName+' Source"> \n <option value="cached" selected="true">Param value will be taken from previous step</option> \n <option value="user">User will enter the param value</option> \n</param>\n <when value="user">') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
193 if param.getOptions().size()==0: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
194 clientXml.write('<param format="text" size = "150" name = "user_param'+str(j)+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
195 if not param.getDefault1() == None: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
196 clientXml.write('value="'+param.getDefault1()+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
197 clientXml.write('type="text" label="Enter '+pName+'" help="see tip below" />\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
198 else: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
199 clientXml.write('<param name="user_param'+str(j)+'" type="select" label="Select '+pName+'" help="see tip below">\n' ) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
200 for option in param.getOptions(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
201 clientXml.write(' <option value="'+self.formatString(option.getName())+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
202 if option.getName() == param.getDefault1(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
203 clientXml.write('selected="true"') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
204 clientXml.write('>'+option.getName()+'</option>\n ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
205 clientXml.write(' </param> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
206 clientXml.write(' </when>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
207 clientXml.write('<when value="cached">\n <param name = "cached_param'+ str(j)+'" type="data" label="Choose the step from which to get the parameter ' + pName + '"/> \n </when></conditional>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
208 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
209 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
210 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
211 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
212 clientXml.write(' </when>\n </conditional>\n</inputs>\n <outputs>\n <data format="tabular" name="output" />\n </outputs>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
213 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
214 #write information about each parameter in the help section |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
215 clientXml.write(' <help>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
216 clientXml.write('Replace white space with ** in all parameter values\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
217 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
218 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
219 if param.isRequired(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
220 pName = param.getName() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
221 for doc in param.getDocs(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
222 if doc.getTitle()=="prompt" or doc.getTitle()=="Prompt" or doc.getTitle()=="PROMPT": |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
223 pName = doc.getInnerText() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
224 clientXml.write('\n.. class:: infomark\n\n**TIP:** '+ pName +' type is ' + param.getType()+'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
225 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
226 clientXml.write(' </help>\n</tool>') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
227 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
228 #adds the newly created tool to tool_conf.xml in Galaxy under the 'Web Service Workflow Tools' section. |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
229 editor = editToolConfig() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
230 editor.addTool(clientName) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
231 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
232 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
233 def sawadlClient(self): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
234 ##parse sawadl |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
235 javahome = os.environ.get('JAVA_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
236 galaxyhome=os.environ.get('GALAXY_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
237 classpath= galaxyhome + '/tools/WebServiceTool/lib/SAWADLParser/bin' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
238 jarpath = galaxyhome + '/tools/WebServiceTool/lib/' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
239 machine = platform.machine() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
240 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
241 #if machine == 'x86_64' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
242 # print 'a' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
243 # startJVM("%s/jre/lib/amd64/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
244 #elif machine == 'i686' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
245 # print 'b' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
246 # startJVM("%s/jre/lib/i386/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
247 #elif machine == 'sun4u' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
248 # startJVM("%s/jre/lib/sparc/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
249 #else : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
250 # print 'c' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
251 # System.exit("Could not identify machine, please specify path to libjvm.so") |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
252 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
253 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
254 pkg=JPackage('edu.uga.cs.lsdis.meteors.wadls') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
255 pkgModel =JPackage('org.semanticweb.owlapi.model') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
256 pkgApiBinding =JPackage('org.semanticweb.owlapi.apibinding') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
257 pkgVocab = JPackage('org.semanticweb.owlapi.vocab') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
258 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
259 DOCUMENT_IRI = "http://cs.uga.edu/~ganjoo/galaxy/EDAM.owl" |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
260 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
261 sawadlUrl = self.url |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
262 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
263 webserviceId = self.methodName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
264 resUrl = self.resourceName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
265 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
266 urls = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
267 methods = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
268 params = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
269 annotationSet = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
270 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
271 SAWADLParserDriver=pkg.SAWADLParserDriver |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
272 sawPD=SAWADLParserDriver() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
273 sawPD.parse(sawadlUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
274 urls = sawPD.getUrl() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
275 methods = sawPD.getCompleteMethodList() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
276 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
277 IRI = pkgModel.IRI |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
278 OWLRDFVocabulary = pkgVocab.OWLRDFVocabulary |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
279 OWLManager = pkgApiBinding.OWLManager |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
280 OWLLiteral = pkgModel.OWLLiteral |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
281 owlOntManager = OWLManager.createOWLOntologyManager() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
282 ontology = owlOntManager.loadOntologyFromOntologyDocument(IRI.create(DOCUMENT_IRI)) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
283 dataFactory = owlOntManager.getOWLDataFactory() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
284 propertyComment = dataFactory.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT.getIRI()) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
285 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
286 f=open(self.Ofile,'w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
287 f.write(sawadlUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
288 f.write('\n'+ resUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
289 f.write('\n'+webserviceId) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
290 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
291 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
292 i=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
293 for method in methods: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
294 x = str(method.getName()) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
295 y = str(urls.get(i)) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
296 if x == webserviceId : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
297 f.write('method matched') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
298 if y == resUrl : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
299 f.write('res matched') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
300 params = method.getRequest().getParamList() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
301 break |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
302 i=i+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
303 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
304 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
305 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
306 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
307 ##generate client's xml |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
308 galaxyhome=os.environ.get('GALAXY_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
309 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
310 clientCountFile=open(galaxyhome+'/tools/WebServiceTool/clients/ClientCount.xml','r') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
311 clientCountFile.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
312 clientCountStr = clientCountFile.read(1) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
313 clientCount=string.atoi(clientCountStr) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
314 clientCount=clientCount+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
315 clientCountFile.close() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
316 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
317 clientCountFile=open(galaxyhome+'/tools/WebServiceTool/clients/ClientCount.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
318 clientCountFile.write('<count> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
319 clientCountFile.write(str(clientCount)) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
320 clientCountFile.write('</count> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
321 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
322 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
323 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
324 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
325 clientName = 'client_'+ str(clientCount) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
326 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
327 clientXml=open(galaxyhome+'/tools/WebServiceToolWorkflow/workflowclients/'+clientName+'.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
328 clientXml.seek(0,0) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
329 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
330 clientXml.write('<tool id="' + clientName+'" name="' + self.methodName +'">\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
331 clientXml.write(' <description> Client for method: '+self.methodName+' , Web service: '+self.url+' </description>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
332 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
333 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
334 clientXml.write(' <command interpreter="python">\n #client_1.py \n'+' $output \n ' +resUrl+'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
335 ##write such that the parameters passed to client1.py(change name to clientName.py) are dependent on a for loop |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
336 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
337 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
338 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
339 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
340 if param.getRequired()=='true' or param.getRequired()=='True' or param.getRequired()=='TRUE': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
341 clientXml.write(' '+self.formatString(param.getName())+'\n#if $source'+str(j)+'.source'+str(j)+'_source=="user" $source'+str(j)+'.user_param'+str(j)+' #else $source' + str(j) + '.cached_param' + str(j)+' #end if\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
342 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
343 clientXml.write('#if $cond_source.optional_param_source=="yes"') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
344 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
345 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
346 if not param.getRequired()=='true' and not param.getRequired()=='True' and not param.getRequired()=='TRUE': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
347 clientXml.write(' '+self.formatString(param.getName())+'\n#if $cond_source.source'+str(j)+'.source'+str(j)+'_source=="user" $cond_source.source'+str(j)+'.user_param'+str(j)+' #else $cond_source.source' + str(j) + '.cached_param' + str(j)+' #end if\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
348 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
349 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
350 clientXml.write('#else \n#end if\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
351 clientXml.write('</command>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
352 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
353 ##write inputs depending on required or not. if not required den dont display |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
354 ##if required- den check default value, and if options exist.Depending on that |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
355 ##decide the type of parameter and options |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
356 clientXml.write(' <inputs>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
357 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
358 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
359 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
360 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
361 if param.getRequired()=='true' or param.getRequired()=='True' or param.getRequired()=='TRUE': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
362 clientXml.write('<conditional name="source'+str(j)+'">\n <param name="source' + str(j)+'_source" type="select" label="'+param.getName()+' Source"> \n <option value="cached" selected="true">Param value will be taken from previous step</option> \n <option value="user">User will enter the param value</option> \n </param>\n <when value="user">\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
363 if param.getOptionvalue().size()==0: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
364 clientXml.write(' <param format="text" size = "150" name = "user_param'+str(j)+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
365 if not param.getDefault1() == None: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
366 clientXml.write('value="'+param.getDefault1()+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
367 clientXml.write('type="text" label="Enter '+param.getName()+'" help="see tip below" />\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
368 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
369 else: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
370 clientXml.write(' <param name="user_param'+str(j)+'" type="select" label="Select '+param.getName()+'" help="see tip below">\n' ) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
371 for option in param.getOptionvalue(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
372 clientXml.write(' <option value="'+self.formatString(option)+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
373 if option == param.getDefault1(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
374 clientXml.write('selected="true"') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
375 clientXml.write('>'+option+'</option>\n ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
376 clientXml.write(' </param> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
377 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
378 clientXml.write(' </when>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
379 clientXml.write(' <when value="cached">\n <param name = "cached_param'+ str(j)+'" type="data" label="Choose the step from which to get the parameter ' + param.getName() + '"/> \n </when></conditional>') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
380 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
381 clientXml.write(' <conditional name="cond_source">\n <param name="optional_param_source" type="select" label="Display Additional Parameters"> \n <option value="no" selected="true">no</option> \n <option value="yes">yes</option> \n </param> \n <when value="no"> \n </when>\n <when value="yes"> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
382 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
383 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
384 if not param.getRequired()=='true' and not param.getRequired()=='True' and not param.getRequired()=='TRUE': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
385 clientXml.write('<conditional name="source'+str(j)+'">\n <param name="source' + str(j)+'_source" type="select" label="'+param.getName()+' Source"> \n <option value="cached" selected="true">Param value will be taken from previous step</option> \n <option value="user">User will enter the param value</option> \n </param>\n <when value="user">\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
386 if param.getOptionvalue().size()==0: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
387 clientXml.write(' <param format="text" size = "150" name = "user_param'+str(j)+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
388 if not param.getDefault1() == None: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
389 clientXml.write('value="'+param.getDefault1()+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
390 clientXml.write('type="text" label="Enter '+param.getName()+'" help="see tip below" />\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
391 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
392 else: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
393 clientXml.write(' <param name="user_param'+str(j)+'" type="select" label="Select'+param.getName()+'" help="see tip below">\n' ) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
394 for option in param.getOptionvalue(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
395 clientXml.write(' <option value="'+self.formatString(option)+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
396 if option == param.getDefault1(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
397 clientXml.write('selected="true"') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
398 clientXml.write('>'+option+'</option>\n ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
399 clientXml.write(' </param> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
400 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
401 clientXml.write(' </when>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
402 clientXml.write(' <when value="cached">\n <param name = "cached_param'+ str(j)+'" type="data" label="Choose the step from which to get the parameter ' + param.getName() + '"/> \n </when></conditional>') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
403 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
404 clientXml.write(' </when>\n </conditional>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
405 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
406 clientXml.write('</inputs>\n <outputs>\n <data format="tabular" name="output" />\n </outputs>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
407 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
408 clientXml.write(' <help>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
409 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
410 if param.getRequired()=='true' or param.getRequired()=='True' or param.getRequired()=='TRUE': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
411 clientXml.write('\n.. class:: infomark\n\n**TIP:** About '+ param.getName() +': type is ' + param.getType()) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
412 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
413 modelRef = sawPD.getCompleteModelReference(param) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
414 if not modelRef is None: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
415 paramClass = dataFactory.getOWLClass(IRI.create(modelRef)); |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
416 annotationSet = paramClass.getAnnotations(ontology,propertyComment) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
417 for annotation in annotationSet: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
418 if isinstance(annotation.getValue(),OWLLiteral): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
419 val = annotation.getValue() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
420 if val.isOWLStringLiteral() and not val.isOWLTypedLiteral(): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
421 print 'val.getLiteral()=' + val.getLiteral() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
422 clientXml.write(', description from ontology is "' + val.getLiteral()+'"') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
423 break |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
424 clientXml.write('\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
425 clientXml.write(' </help>\n</tool>') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
426 editor = editToolConfig() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
427 editor.addTool(clientName) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
428 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
429 ##later add help feature |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
430 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
431 def wsdlClient(self): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
432 ##parse wadl |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
433 javahome = os.environ.get('JAVA_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
434 galaxyhome=os.environ.get('GALAXY_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
435 classpath= galaxyhome + '/tools/WebServiceTool/WodenWSDLParser/bin' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
436 jarpath = galaxyhome + '/tools/WebServiceTool/WodenWSDLParser/lib/' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
437 machine = platform.machine() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
438 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
439 if machine == 'x86_64' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
440 print 'a' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
441 startJVM("%s/jre/lib/amd64/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
442 elif machine == 'i686' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
443 print 'b' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
444 startJVM("%s/jre/lib/i386/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
445 elif machine == 'sun4u' : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
446 startJVM("%s/jre/lib/sparc/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
447 else : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
448 print 'c' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
449 System.exit("Could not identify machine, please specify path to libjvm.so") |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
450 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
451 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
452 pkg=JPackage('lsdis') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
453 wsdlUrl = self.url |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
454 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
455 webserviceId = self.methodName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
456 resUrl = self.resourceName |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
457 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
458 urls = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
459 methods = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
460 params = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
461 paramTypes = [] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
462 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
463 WSDLParserDriver =pkg.WSDLParserDriver |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
464 wPD=WSDLParserDriver() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
465 wPD.parse(wsdlUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
466 methods = wPD.getCompleteMethodList() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
467 urls = wPD.getUrl() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
468 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
469 f=open(self.Ofile,'w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
470 f.write(wsdlUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
471 f.write('\n'+ resUrl) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
472 f.write('\n'+webserviceId) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
473 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
474 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
475 i=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
476 for method in methods: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
477 x = str(method.getName().getLocalPart()) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
478 if x == webserviceId : |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
479 wPD.getParameters(x) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
480 f.write('method matched') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
481 paramTypes = wPD.getParamTypeList() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
482 params = wPD.getParamList() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
483 break |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
484 i=i+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
485 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
486 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
487 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
488 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
489 ##generate client's xml |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
490 galaxyhome=os.environ.get('GALAXY_HOME') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
491 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
492 clientCountFile=open(galaxyhome+'/tools/WebServiceTool/clients/ClientCount.xml','r') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
493 clientCountFile.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
494 clientCountStr = clientCountFile.read(1) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
495 clientCount=string.atoi(clientCountStr) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
496 clientCount=clientCount+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
497 clientCountFile.close() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
498 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
499 clientCountFile=open(galaxyhome+'/tools/WebServiceTool/clients/ClientCount.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
500 clientCountFile.write('<count> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
501 clientCountFile.write(str(clientCount)) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
502 clientCountFile.write('</count> \n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
503 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
504 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
505 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
506 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
507 clientName = 'client_'+ str(clientCount) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
508 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
509 clientXml=open(galaxyhome+'/tools/WebServiceTool/clients/'+clientName+'.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
510 clientXml.seek(0,0) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
511 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
512 clientXml.write('<tool id="' + clientName+'" name="' + self.methodName +'">\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
513 clientXml.write(' <description> Client for method: '+self.methodName+' , Web service: '+self.url+' </description>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
514 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
515 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
516 clientXml.write(' <command interpreter="python">\n client_1.py \n'+' $output \n ' +resUrl+'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
517 ##write such that the parameters passed to client1.py(change name to clientName.py) are dependent on a for loop |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
518 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
519 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
520 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
521 clientXml.write(' '+self.formatString(param)+'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
522 clientXml.write(' $param' + str(j)+'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
523 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
524 clientXml.write('</command>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
525 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
526 ##write inputs depending on required or not. if not required den dont display |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
527 ##if required- den check default value, and if options exist.Depending on that |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
528 ##decide the type of parameter and options |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
529 clientXml.write(' <inputs>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
530 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
531 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
532 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
533 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
534 clientXml.write('type="text" label="'+param+'" help="see tip below" />\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
535 j=j+1 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
536 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
537 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
538 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
539 clientXml.write('</inputs>\n <outputs>\n <data format="tabular" name="output" />\n </outputs>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
540 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
541 clientXml.write(' <help>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
542 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
543 j=0 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
544 for param in params: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
545 clientXml.write('\n.. class:: infomark\n\n**TIP:** '+ param +' type is ' + paramTypes[j] +'\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
546 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
547 clientXml.write(' </help>\n</tool>') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
548 editor = editToolConfig() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
549 editor.addTool(clientName) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
550 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
551 ##later add help feature |