Esempio n. 1
0
    def rename_command(self):
        tmp = []
        for _, this_template in self.template.items():
            for parameter in util.alwayslist(this_template):
                if isinstance(parameter.f, RenamedTemplateFile):
                    tmp.append(parameter.f.rename_command())

        return ' && '.join(tmp)
Esempio n. 2
0
    def assign(self, snakemake_input):
        for key, filenames in self._input_reader(snakemake_input):
            if key not in self.rule_keys:
                raise exception.RuleInputException(
                    'Unexpected input rule key: %s' % key)

            this_template = util.alwayslist(self.template[key])
            for filename, parameter in zip(filenames, this_template):
                parameter.f.assign(filename)
Esempio n. 3
0
    def get_options(self):
        options = []
        for _, this_template in self.template.items():
            for parameter in util.alwayslist(this_template):
                if not parameter.used:
                    continue

                fname, priority = parameter.f.infer_raw_name(
                ), parameter.priority
                if parameter.option is not None:
                    option = ' '.join([parameter.option, fname])
                    options.append((option, priority))
                else:
                    options.append((fname, priority))

        return options
Esempio n. 4
0
 def _input_reader(self, snakemake_input):
     for key, filenames in snakemake_input.items():
         yield key, util.alwayslist(filenames)
Esempio n. 5
0
 def redirect_command(self):
     for _, this_template in self.template.items():
         for parameter in util.alwayslist(this_template):
             if parameter.redirected:
                 return '> ' + parameter.f.infer_raw_name()
     return ''