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

Method set_extra_inputs

flowcraft/generator/process.py:757–800  ·  view source on GitHub ↗

Sets the initial definition of the extra input channels. The ``channel_dict`` argument should contain the input type and destination channel of each parameter (which is the key):: channel_dict = { "param1": { "input_type": "fasta"

(self, channel_dict)

Source from the content-addressed store, hash-verified

755 **{"secondary_inputs": secondary_input_str}}
756
757 def set_extra_inputs(self, channel_dict):
758 """Sets the initial definition of the extra input channels.
759
760 The ``channel_dict`` argument should contain the input type and
761 destination channel of each parameter (which is the key)::
762
763 channel_dict = {
764 "param1": {
765 "input_type": "fasta"
766 "channels": ["abricate_2_3", "chewbbaca_3_4"]
767 }
768 }
769
770 Parameters
771 ----------
772 channel_dict : dict
773 Dictionary with the extra_input parameter as key, and a dictionary
774 as a value with the input_type and destination channels
775 """
776
777 extra_inputs = []
778
779 for param, info in channel_dict.items():
780
781 # Update the process' parameters with the raw input
782 raw_channel = self.RAW_MAPPING[info["input_type"]]
783 self.params[param] = {
784 "default": raw_channel["default_value"],
785 "description": raw_channel["description"]
786 }
787
788 channel_name = "IN_{}_extraInput".format(param)
789 channel_str = self.RAW_MAPPING[info["input_type"]]["channel_str"]
790 extra_inputs.append("{} = {}".format(channel_name,
791 channel_str.format(param)))
792
793 op = "set" if len(info["channels"]) == 1 else "into"
794 extra_inputs.append("{}.{}{{ {} }}".format(
795 channel_name, op, ";".join(info["channels"])))
796
797 self._context = {
798 **self._context,
799 **{"extra_inputs": "\n".join(extra_inputs)}
800 }
801
802
803class StatusCompiler(Compiler):

Callers 1

_set_init_processMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected