MCPcopy Create free account
hub / github.com/assemblerflow/flowcraft / set_raw_inputs

Method set_raw_inputs

flowcraft/generator/process.py:687–737  ·  view source on GitHub ↗

Sets the main input channels of the pipeline and their forks. The ``raw_input`` dictionary input should contain one entry for each input type (fastq, fasta, etc). The corresponding value should be a dictionary/json with the following key:values: - ``channel``: Name

(self, raw_input)

Source from the content-addressed store, hash-verified

685 self.status_channels = []
686
687 def set_raw_inputs(self, raw_input):
688 """Sets the main input channels of the pipeline and their forks.
689
690 The ``raw_input`` dictionary input should contain one entry for each
691 input type (fastq, fasta, etc). The corresponding value should be a
692 dictionary/json with the following key:values:
693
694 - ``channel``: Name of the raw input channel (e.g.: channel1)
695 - ``channel_str``: The nextflow definition of the channel and
696 eventual checks (e.g.: channel1 = Channel.fromPath(param))
697 - ``raw_forks``: A list of channels to which the channel name will
698 for to.
699
700 Each new type of input parameter is automatically added to the
701 :attr:`params` attribute, so that they are automatically collected
702 for the pipeline description and help.
703
704 Parameters
705 ----------
706 raw_input : dict
707 Contains an entry for each input type with the channel name,
708 channel string and forks.
709 """
710
711 logger.debug("Setting raw inputs using raw input dict: {}".format(
712 raw_input))
713
714 primary_inputs = []
715
716 for input_type, el in raw_input.items():
717
718 primary_inputs.append(el["channel_str"])
719
720 # Update the process' parameters with the raw input
721 raw_channel = self.RAW_MAPPING[input_type]
722 self.params[input_type] = {
723 "default": raw_channel["default_value"],
724 "description": raw_channel["description"]
725 }
726
727 op = "set" if len(el["raw_forks"]) == 1 else "into"
728
729 self.forks.append("\n{}.{}{{ {} }}\n".format(
730 el["channel"], op, ";".join(el["raw_forks"])
731 ))
732
733 logger.debug("Setting raw inputs: {}".format(primary_inputs))
734 logger.debug("Setting forks attribute to: {}".format(self.forks))
735 self._context = {**self._context,
736 **{"forks": "\n".join(self.forks),
737 "main_inputs": "\n".join(primary_inputs)}}
738
739 def set_secondary_inputs(self, channel_dict):
740 """ Adds secondary inputs to the start of the pipeline.

Callers 4

_set_init_processMethod · 0.80

Calls

no outgoing calls

Tested by 3