Mercurial > repos > ganjoo > webservice_toolsuite
annotate WebServiceToolWorkflow/edit_tool_conf1.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 os |
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 class editToolConfig1(object): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
4 def addTool(self,toolName): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
5 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
|
6 f1=open(galaxyhome+'/tool_conf.xml','r') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
7 f1.seek(0,0) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
8 f2=open(galaxyhome+'/tool_conf_backup.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
9 f2.seek(0,0) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
10 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
11 #copy everything from tool_conf.xml upto the section 'Web Service Tools' into another file f2 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
12 line = f1.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
13 f2.write(line) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
14 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
15 lineStripped=line.lstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
16 lineStripped=lineStripped.rstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
17 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
18 #add the one-time Web service invocation tool under Web Service Tools section |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
19 while not lineStripped == '<section name="Web Service Tools" id="WebServices">': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
20 line = f1.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
21 f2.write(line) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
22 lineStripped = line.lstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
23 lineStripped=lineStripped.rstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
24 else: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
25 print line |
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 f2.write(' <tool file="WebServiceToolWorkflow/clients/'+toolName + '.xml"/>\n') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
28 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
29 #copy rest of tool_conf.xml file f2 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
30 while not lineStripped == '</toolbox>': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
31 line = f1.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
32 f2.write(line) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
33 lineStripped = line.lstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
34 lineStripped=lineStripped.rstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
35 else: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
36 print line |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
37 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
38 ##close f1 and f2 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
39 f1.close() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
40 f2.close() |
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 ##interchange modes of f1 and f2 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
43 f1=open(galaxyhome+'/tool_conf.xml','w') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
44 f1.seek(0,0) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
45 f2=open(galaxyhome+'/tool_conf_backup.xml','r') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
46 f2.seek(0,0) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
47 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
48 line = f2.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
49 f1.write(line) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
50 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
51 lineStripped=line.lstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
52 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
53 ##write entire f2 into f1 (reverse roles) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
54 while not lineStripped == '</toolbox>\n': |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
55 line = f2.readline() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
56 f1.write(line) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
57 lineStripped = line.lstrip() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
58 else: |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
59 print line |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
60 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
61 f1.close() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
62 f2.close() |