Mercurial > repos > galaxyp > maxquant
diff mqparam.py @ 6:2133b0be850a draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 4e77eeda8a112fb50af00325a5164b986c16fc5c"
author | galaxyp |
---|---|
date | Wed, 06 May 2020 13:35:51 -0400 |
parents | dcd39bcc7481 |
children | d253b379322b |
line wrap: on
line diff
--- a/mqparam.py Wed Apr 15 11:17:42 2020 -0400 +++ b/mqparam.py Wed May 06 13:35:51 2020 -0400 @@ -308,6 +308,23 @@ .format(key)) node.text = str(value) + def set_list_param(self, key, values): + """Set a list parameter. + Args: + key: (string) XML tag of the parameter + values: the lit of values of the parameter XML node + Returns: + None + """ + node = self._root.find(key) + if node is None: + raise ValueError('Element {} not found in parameter file' + .format(key)) + node.clear() + node.tag = key + for e in values: + et_add_child(node, name='string', text=e) + def _from_yaml(self, conf): """Read a yaml config file. Args: @@ -317,6 +334,7 @@ """ with open(conf) as f: conf_dict = yaml.safe_load(f.read()) + paramGroups = conf_dict.pop('paramGroups') self.add_infiles([pg.pop('files') for pg in paramGroups]) for i, pg in enumerate(paramGroups): @@ -339,7 +357,10 @@ else: raise Exception('No fasta files provided.') for key in conf_dict: - self.set_simple_param(key, conf_dict[key]) + if key in ['restrictMods']: + self.set_list_param(key, conf_dict[key]) + else: + self.set_simple_param(key, conf_dict[key]) def write(self, mqpar_out): """Write pretty formatted xml parameter file.