nextflow_generator module

exception nextflow_generator.ProcessError(value)[source]

Bases: Exception

exception nextflow_generator.ChannelError(p1, p2, t1, t2)[source]

Bases: Exception

class nextflow_generator.NextflowGenerator(process_list, nextflow_file, process_ids=None)[source]

Bases: object

Methods

build() Main pipeline builder
process_map = {'check_coverage': <class 'generator.Process.CheckCoverage'>, 'patho_typing': <class 'generator.Process.PathoTyping'>, 'seq_typing': <class 'generator.Process.SeqTyping'>, 'trace_compiler': <class 'generator.Process.TraceCompiler'>, 'mlst': <class 'generator.Process.Mlst'>, 'integrity_coverage': <class 'generator.Process.IntegrityCoverage'>, 'trimmomatic': <class 'generator.Process.Trimmomatic'>, 'fastqc': <class 'generator.Process.FastQC'>, 'status_compiler': <class 'generator.Process.StatusCompiler'>, 'abricate': <class 'generator.Process.Abricate'>, 'pilon': <class 'generator.Process.Pilon'>, 'assembly_mapping': <class 'generator.Process.AssemblyMapping'>, 'chewbbaca': <class 'generator.Process.Chewbbaca'>, 'fastqc_trimmomatic': <class 'generator.Process.FastqcTrimmomatic'>, 'spades': <class 'generator.Process.Spades'>, 'process_spades': <class 'generator.Process.ProcessSpades'>, 'prokka': <class 'generator.Process.Prokka'>}

dict: Maps the process ids to the corresponding template interface class

processes = None

list: Stores the process interfaces in the specified order

nf_file = None

str: Path to file where the pipeline will be generated

template = None

str: String that will harbour the pipeline code

secondary_channels = None

dict: Stores secondary channel links

status_channels = None

list: Stores the status channels from each process

_check_pipeline_requirements()[source]

Checks for some pipeline requirements before building

Currently, the only hard requirement is that the pipeline must start with the integrity_coverage process, in order to evaluate if the input FastQ are corrupt or not.

Besides this requirements, it checks for the existence the dependencies for all processes.

_build_header()[source]

Adds the header template to the master template string

_set_channels()[source]

Sets the main channels for the pipeline

The setup of the main channels follows four main steps for each process specified in the NextflowGenerator.processes attribute:

  • (If not the first process) Checks if the input of the current

process is compatible with the output of the previous process. - Checks if the current process has starts any secondary channels. If so, populate the NextflowGenerator.secondary_channels with the name of the link start, the process class and a list to harbour potential receiving ends. - Checks if the current process receives from any secondary channels. If a corresponding secondary link has been previously set, it will populate the NextflowGenerator.secondary_channels attribute with the receiving channels. - Sets the main channels by providing the process ID.

Notes

On the secondary channel setup: With this approach, there can only be one secondary link start for each type of secondary link. For instance, If there are two processes that start a secondary channel for the SIDE_max_len channel, only the last one will be recorded, and all receiving processes will get the channel from the latest process.

_set_secondary_channels()[source]

Sets the secondary channels for the pipeline

This will iterate over the NextflowGenerator.secondary_channels dictionary that is populated when executing NextflowGenerator._set_channels() method.

_set_status_channels()[source]

Compiles all status channels for the status compiler process

build()[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 channels and finally the status channels. When the pipeline is built, is writes the code to a nextflow file.

nextflow_generator.get_args()[source]
nextflow_generator.get_tuples(task)[source]
nextflow_generator.copy_project(path)[source]
Parameters:path
nextflow_generator.main(args)[source]