diff --git a/conf/test_bacteria_params.config b/conf/test_bacteria_params.config index cb3144f4..bb8e2901 100644 --- a/conf/test_bacteria_params.config +++ b/conf/test_bacteria_params.config @@ -35,6 +35,7 @@ params { run_submission = true run_bakta = true cleanup = true + run_annotation = true /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/conf/test_virus_params.config b/conf/test_virus_params.config index a78aa273..b3a4b63e 100644 --- a/conf/test_virus_params.config +++ b/conf/test_virus_params.config @@ -43,7 +43,7 @@ params { ANNOTATION SUBWORKFLOW ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - run_submission = true + run_annotation = true run_vadr = false if ( params.variola ) { @@ -134,6 +134,7 @@ params { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ // general + run_submission = true submission_output_dir = "submission_outputs" submission_prod_or_test = 'test' submission_wait_time = 'calc' diff --git a/main.nf b/main.nf index 9751f2ba..efe125ff 100644 --- a/main.nf +++ b/main.nf @@ -63,6 +63,7 @@ include { RUN_SUBMISSION } from "$projectDir/subworkflows/entrypoints/submission include { RUN_INITIAL_SUBMISSION } from "$projectDir/subworkflows/entrypoints/initial_submission_entry" include { RUN_UPDATE_SUBMISSION } from "$projectDir/subworkflows/entrypoints/update_submission_entry" include { RUN_BAKTA } from "$projectDir/subworkflows/entrypoints/bakta_entry.nf" +include { RUN_VALIDATION_AND_SUBMISSION } from "$projectDir/subworkflows/entrypoints/no_annotation" workflow only_validate_params { main: @@ -148,4 +149,22 @@ workflow only_update_submission { main: // run subworkflow for update submission entrypoint RUN_UPDATE_SUBMISSION () +} + +workflow only_validation_and_submission { + main: + // calls subworkflow to run only validation and submission + RUN_VALIDATION_AND_SUBMISSION ( + 'dummy utility signal', + false + ) +} + +workflow only_validation_and_initial_submission { + main: + // calls subworkflow to run only validation and submission + RUN_VALIDATION_AND_SUBMISSION ( + 'dummy utility signal', + true + ) } \ No newline at end of file diff --git a/subworkflows/entrypoints/no_annotation.nf b/subworkflows/entrypoints/no_annotation.nf new file mode 100644 index 00000000..f0b64a63 --- /dev/null +++ b/subworkflows/entrypoints/no_annotation.nf @@ -0,0 +1,70 @@ +#!/usr/bin/env nextflow + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + SUBWORKFLOW FOR VALIDATION --> SUBMISSION +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +include { INITIALIZE_FILES } from "../../modules/general_util/initialize_files/main" +include { GET_WAIT_TIME } from "../../modules/general_util/get_wait_time/main" +include { METADATA_VALIDATION } from "../../modules/metadata_validation/main" +include { SUBMISSION } from "../../modules/submission/main" +include { GENERAL_SUBMISSION } from "../submission" + + +workflow RUN_VALIDATION_AND_SUBMISSION { + + // Get the channel for the annotation files + if (!params.final_annotated_files_path.isEmpty()) { + annotationCh = Channel.fromPath("$params.final_annotated_files_path/*.gff") + } + + take: + utility_signal + is_it_only_initial + + main: + + // initialize files (stage and change names for files) + INITIALIZE_FILES ( + utility_signal + ) + + // run metadata validation process + METADATA_VALIDATION ( + utility_signal, + params.meta_path + ) + + if ( is_it_only_initial == false ) { + + // pre submission process + get wait time (parallel) + GET_WAIT_TIME ( + METADATA_VALIDATION.out.tsv_Files.collect() + ) + + // call the general submission workflow + GENERAL_SUBMISSION ( + METADATA_VALIDATION.out.tsv_Files.sort().flatten(), + INITIALIZE_FILES.out.fasta_files.sort().flatten(), + annotationCh, + params.submission_config, + params.req_col_config, + GET_WAIT_TIME.out + ) + + } else { + + // call submission process directly + SUBMISSION ( + METADATA_VALIDATION.out.tsv_Files.sort().flatten(), + INITIALIZE_FILES.out.fasta_files.sort().flatten(), + annotationCh, + params.submission_config, + params.req_col_config, + 'entry' + ) + + } +} \ No newline at end of file diff --git a/workflows/main.nf b/workflows/main.nf index f82315e4..b8603591 100644 --- a/workflows/main.nf +++ b/workflows/main.nf @@ -35,6 +35,7 @@ include { VADR_SUBMISSION } from "../subworkfl include { BAKTA_SUBMISSION } from "../subworkflows/submission" include { GENERAL_SUBMISSION } from "../subworkflows/submission" + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAIN WORKFLOW @@ -70,59 +71,63 @@ workflow MAIN_WORKFLOW { params.meta_path ) - // run liftoff annotation process - if ( params.run_liftoff == true ) { - LIFTOFF ( - params.meta_path, - INITIALIZE_FILES.out.fasta_dir, - params.ref_fasta_path, - params.ref_gff_path - ) - } - - // run liftoff annotation process + repeatmasker - if ( params.run_repeatmasker_liftoff == true ) { + // check if the user wants to skip annotation or not + if ( params.run_annotation == true ) { - // run repeatmasker annotation on files - RUN_REPEATMASKER_LIFTOFF ( - RUN_UTILITY.out, - fastaCh - ) - } + // run liftoff annotation process + if ( params.run_liftoff == true ) { + LIFTOFF ( + params.meta_path, + INITIALIZE_FILES.out.fasta_dir, + params.ref_fasta_path, + params.ref_gff_path + ) + } - // run vadr processes - if ( params.run_vadr == true ) { - RUN_VADR ( - RUN_UTILITY.out, - INITIALIZE_FILES.out.fasta_files.sort().flatten() - ) - } + // run liftoff annotation process + repeatmasker + if ( params.run_repeatmasker_liftoff == true ) { - // run bakta annotation process - if ( params.run_bakta == true ) { - - if ( params.download_bakta_db ) { - BAKTADBDOWNLOAD ( RUN_UTILITY.out ) - BAKTA ( - RUN_UTILITY.out, - BAKTADBDOWNLOAD.out.db, + // run repeatmasker annotation on files + RUN_REPEATMASKER_LIFTOFF ( + RUN_UTILITY.out, fastaCh ) + } - } else { + // run vadr processes + if ( params.run_vadr == true ) { + RUN_VADR ( + RUN_UTILITY.out, + INITIALIZE_FILES.out.fasta_files.sort().flatten() + ) + } + + // run bakta annotation process + if ( params.run_bakta == true ) { + + if ( params.download_bakta_db ) { + BAKTADBDOWNLOAD ( RUN_UTILITY.out ) + BAKTA ( + RUN_UTILITY.out, + BAKTADBDOWNLOAD.out.db, + fastaCh + ) + + } else { - BAKTA ( - RUN_UTILITY.out, - params.bakta_db_path, + BAKTA ( + RUN_UTILITY.out, + params.bakta_db_path, + fastaCh + ) + } + + BAKTA_POST_CLEANUP ( + BAKTA.out.bakta_results, + params.meta_path, fastaCh - ) + ) } - - BAKTA_POST_CLEANUP ( - BAKTA.out.bakta_results, - params.meta_path, - fastaCh - ) } // run submission for the annotated samples @@ -133,8 +138,8 @@ workflow MAIN_WORKFLOW { METADATA_VALIDATION.out.tsv_Files.collect() ) - // check if all annotations are set to false - if ([params.run_bakta, params.run_liftoff, params.run_vadr, params.run_repeatmasker_liftoff].any { it }) { + // check if all annotations are set to false + if ( params.run_annotation == true ) { // call the submission workflow for liftoff if ( params.run_liftoff == true ) { @@ -183,7 +188,7 @@ workflow MAIN_WORKFLOW { GET_WAIT_TIME.out ) } - + } else { // all annotations are false, therefore first check if user annotations are provided