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