Mercurial > repos > devteam > emboss_5
annotate emboss_format_corrector.py @ 20:21a9fb508031 draft default tip
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit e0d4688a59e6eeba33adcfe803ac43d0bc2863e7"
author | iuc |
---|---|
date | Tue, 31 Aug 2021 08:05:39 +0000 |
parents | c2228166c035 |
children |
rev | line source |
---|---|
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
1 # EMBOSS format corrector |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
2 import operator |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
3 |
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
4 |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
5 # Properly set file formats before job run |
18
c2228166c035
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 4812c313fd8762b11f7fd002436e3a93b4c67f00"
iuc
parents:
11
diff
changeset
|
6 def exec_before_job(app, inp_data=None, out_data=None, tool=None, param_dict=None): |
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
7 # why isn't items an ordered list? |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
8 items = out_data.items() |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
9 items = sorted(items, key=operator.itemgetter(0)) |
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
10 |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
11 # normal filetype correction |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
12 data_count = 1 |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
13 for name, data in items: |
18
c2228166c035
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 4812c313fd8762b11f7fd002436e3a93b4c67f00"
iuc
parents:
11
diff
changeset
|
14 outputType = param_dict.get('out_format' + str(data_count), None) |
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
15 if outputType is not None: |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
16 if outputType == 'ncbi': |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
17 outputType = "fasta" |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
18 elif outputType == 'excel': |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
19 outputType = "tabular" |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
20 elif outputType == 'text': |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
21 outputType = "txt" |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
22 data = app.datatypes_registry.change_datatype(data, outputType) |
18
c2228166c035
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 4812c313fd8762b11f7fd002436e3a93b4c67f00"
iuc
parents:
11
diff
changeset
|
23 app.model.context.add(data) |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
24 app.model.context.flush() |
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
25 data_count += 1 |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
26 |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
27 # html filetype correction |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
28 data_count = 1 |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
29 for name, data in items: |
18
c2228166c035
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 4812c313fd8762b11f7fd002436e3a93b4c67f00"
iuc
parents:
11
diff
changeset
|
30 wants_plot = param_dict.get('html_out' + str(data_count), None) |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
31 ext = "html" |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
32 if wants_plot == "yes": |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
33 data = app.datatypes_registry.change_datatype(data, ext) |
18
c2228166c035
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 4812c313fd8762b11f7fd002436e3a93b4c67f00"
iuc
parents:
11
diff
changeset
|
34 app.model.context.add(data) |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
35 app.model.context.flush() |
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
36 data_count += 1 |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
37 |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
38 # png file correction |
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
39 data_count = 1 |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
40 for name, data in items: |
18
c2228166c035
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 4812c313fd8762b11f7fd002436e3a93b4c67f00"
iuc
parents:
11
diff
changeset
|
41 wants_plot = param_dict.get('plot' + str(data_count), None) |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
42 ext = "png" |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
43 if wants_plot == "yes": |
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
44 data = app.datatypes_registry.change_datatype(data, ext) |
18
c2228166c035
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 4812c313fd8762b11f7fd002436e3a93b4c67f00"
iuc
parents:
11
diff
changeset
|
45 app.model.context.add(data) |
10
9b98d3d903c6
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
devteam
parents:
diff
changeset
|
46 app.model.context.flush() |
11
0e2484b6829b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit b583bbeb8fc90cd4b1e987a56982e7cf4aed1a68
iuc
parents:
10
diff
changeset
|
47 data_count += 1 |