flowcraft.generator.engine module

class flowcraft.generator.engine.NextflowGenerator(process_connections, nextflow_file, process_map, pipeline_name='flowcraft', ignore_dependencies=False, auto_dependency=True, merge_params=True, export_params=False)[source]

Bases: object

Methods

build(self) Main pipeline builder
dag_to_file(self, dict_viz[, output_file]) Writes dag to output file
export_directives(self) Export pipeline directives as a JSON to stdout
export_params(self) Export pipeline params as a JSON to stdout
fetch_docker_tags(self) Export all dockerhub tags associated with each component given by the -t flag.
render_pipeline(self) Write pipeline attributes to json
write_configs(self, project_root) Wrapper method that writes all configuration files to the pipeline directory
process_map = None

dict: Maps the nextflow template name to the corresponding Process class of the component.

processes = None

list: Stores the process interfaces in the specified order

lanes = None

int: Stores the number of lanes in the pipelines

export_parameters = None

bool: Determines whether the build mode is only for the export of parameters in JSON format. Setting to True will disabled some checks, such as component dependency requirements

nf_file = None

str: Path to file where the pipeline will be generated

pipeline_name = None

str: Name of the pipeline, for customization and help purposes.

template = None

str: String that will harbour the pipeline code

secondary_channels = None

dict: Stores secondary channel links

main_raw_inputs = None

list: Stores the main raw inputs from the user parameters into the first process(es).

merge_params = None

bool: Determines whether the params of the pipeline should be merged (i.e., the same param name in multiple components is merged into one) or if they should be unique and specific to each component.

extra_inputs = None
status_channels = None

list: Stores the status channels from each process

skip_class = None

list: Stores the Process classes that should be skipped when iterating over the processes list.

resources = None

str: Stores the resource directives string for each nextflow process. See NextflowGenerator._get_resources_string().

containers = None

str: Stores the container directives string for each nextflow process. See NextflowGenerator._get_container_string().

params = None

str: Stores the params directives string for the nextflow pipeline. See NextflowGenerator._get_params_string()

config = None

str: Stores de configuration for the nextflow pipeline. See NextflowGenerator._get_config_string()

user_config = None

str: Stores the user configuration file placeholder. This is an empty configuration file that is only added the first time to a project directory. If the file already exists, it will not overwrite it.

compilers = None

dict: Maps the information about each available compiler process in flowcraft. The key of each entry is the name/signature of the compiler process. The value is a json/dict object that contains two key:pair values:

  • cls: The reference to the compiler class object.
  • template: The nextflow template file of the process.
dag_to_file(self, dict_viz, output_file='.treeDag.json')[source]

Writes dag to output file

Parameters:
dict_viz: dict

Tree like dictionary that is used to export tree data of processes to html file and here for the dotfile .treeDag.json

render_pipeline(self)[source]

Write pipeline attributes to json

This function writes the pipeline and their attributes to a json file, that is intended to be read by resources/pipeline_graph.html to render a graphical output showing the DAG.

write_configs(self, project_root)[source]

Wrapper method that writes all configuration files to the pipeline directory

export_params(self)[source]

Export pipeline params as a JSON to stdout

This run mode iterates over the pipeline processes and exports the params dictionary of each component as a JSON to stdout.

export_directives(self)[source]

Export pipeline directives as a JSON to stdout

fetch_docker_tags(self)[source]

Export all dockerhub tags associated with each component given by the -t flag.

build(self)[source]

Main pipeline builder

This method is responsible for building the NextflowGenerator.template attribute that will contain the nextflow code of the pipeline.

First it builds the header, then sets the main channels, the secondary inputs, secondary channels and finally the status channels. When the pipeline is built, is writes the code to a nextflow file.