Mercurial > repos > galaxyp > openms_proteinquantifier
comparison fill_ctd.py @ 10:8a45fd5a608a draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/openms commit 6e8b69ee3aff3c93f745a5de11cc9169130f2e5e"
author | galaxyp |
---|---|
date | Thu, 24 Sep 2020 11:58:12 +0000 |
parents | f874f2998576 |
children | d426affe977c |
comparison
equal
deleted
inserted
replaced
9:f874f2998576 | 10:8a45fd5a608a |
---|---|
148 | 148 |
149 model = CTDModel(from_file=input_ctd) | 149 model = CTDModel(from_file=input_ctd) |
150 | 150 |
151 # transform values from json that correspond to | 151 # transform values from json that correspond to |
152 # - old style booleans (string + restrictions) -> transformed to a str | 152 # - old style booleans (string + restrictions) -> transformed to a str |
153 # - new style booleans that get a string (happens for hidden parameters [-test]) | |
154 # are transformed to a bool | |
153 # - unrestricted ITEMLIST which are represented as strings | 155 # - unrestricted ITEMLIST which are represented as strings |
154 # ("=quoted and space separated) in Galaxy -> transform to lists | 156 # ("=quoted and space separated) in Galaxy -> transform to lists |
155 # - optional data input parameters that have defaults and for which no | 157 # - optional data input parameters that have defaults and for which no |
156 # value is given -> overwritte with the default | 158 # value is given -> overwritte with the default |
157 for p in model.get_parameters(): | 159 for p in model.get_parameters(): |
162 try: | 164 try: |
163 getFromDict(args, p.get_lineage(name_only=True)) | 165 getFromDict(args, p.get_lineage(name_only=True)) |
164 except KeyError: | 166 except KeyError: |
165 # few tools use dashes in parameters which are automatically replaced | 167 # few tools use dashes in parameters which are automatically replaced |
166 # by underscores by Galaxy. in these cases the dictionary needs to be | 168 # by underscores by Galaxy. in these cases the dictionary needs to be |
167 # updated | 169 # updated (better: then dash and the underscore variant are in the dict) |
168 # TODO might be removed later https://github.com/OpenMS/OpenMS/pull/4529 | 170 # TODO might be removed later https://github.com/OpenMS/OpenMS/pull/4529 |
169 try: | 171 try: |
170 lineage = [_.replace("-", "_") for _ in p.get_lineage(name_only=True)] | 172 lineage = [_.replace("-", "_") for _ in p.get_lineage(name_only=True)] |
171 val = getFromDict(args, lineage) | 173 val = getFromDict(args, lineage) |
172 except KeyError: | 174 except KeyError: |
173 continue | 175 continue |
174 else: | 176 else: |
175 setInDict(args, lineage, val) | 177 setInDict(args, p.get_lineage(name_only=True), val) |
176 | 178 |
177 if p.type is str and type(p.restrictions) is _Choices and set(p.restrictions.choices) == set(["true", "false"]): | 179 if p.type is str and type(p.restrictions) is _Choices and set(p.restrictions.choices) == set(["true", "false"]): |
178 v = getFromDict(args, p.get_lineage(name_only=True)) | 180 v = getFromDict(args, p.get_lineage(name_only=True)) |
179 setInDict(args, p.get_lineage(name_only=True), str(v).lower()) | 181 setInDict(args, p.get_lineage(name_only=True), str(v).lower()) |
180 | 182 elif p.type is bool: |
183 v = getFromDict(args, p.get_lineage(name_only=True)) | |
184 if isinstance(v, str): | |
185 v = (v.lower() == "true") | |
186 setInDict(args, p.get_lineage(name_only=True), v) | |
181 elif p.is_list and (p.restrictions is None or type(p.restrictions) is _NumericRange): | 187 elif p.is_list and (p.restrictions is None or type(p.restrictions) is _NumericRange): |
182 v = getFromDict(args, p.get_lineage(name_only=True)) | 188 v = getFromDict(args, p.get_lineage(name_only=True)) |
183 if type(v) is str: | 189 if type(v) is str: |
184 setInDict(args, p.get_lineage(name_only=True), qstring2list(v)) | 190 setInDict(args, p.get_lineage(name_only=True), qstring2list(v)) |
185 elif p.type is _InFile and not (p.default is None or type(p.default) is _Null): | 191 elif p.type is _InFile and not (p.default is None or type(p.default) is _Null): |