Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation + Submission Entrypoint (Issue #129) #131

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/test_bacteria_params.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ params {
run_submission = true
run_bakta = true
cleanup = true
run_annotation = true

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 2 additions & 1 deletion conf/test_virus_params.config
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ params {
ANNOTATION SUBWORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
run_submission = true
run_annotation = true
run_vadr = false

if ( params.variola ) {
Expand Down Expand Up @@ -134,6 +134,7 @@ params {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// general
run_submission = true
submission_output_dir = "submission_outputs"
submission_prod_or_test = 'test'
submission_wait_time = 'calc'
Expand Down
19 changes: 19 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
)
}
70 changes: 70 additions & 0 deletions subworkflows/entrypoints/no_annotation.nf
Original file line number Diff line number Diff line change
@@ -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'
)

}
}
99 changes: 52 additions & 47 deletions workflows/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ include { VADR_SUBMISSION } from "../subworkfl
include { BAKTA_SUBMISSION } from "../subworkflows/submission"
include { GENERAL_SUBMISSION } from "../subworkflows/submission"


/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MAIN WORKFLOW
Expand Down Expand Up @@ -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
Expand All @@ -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 ) {
Expand Down Expand Up @@ -183,7 +188,7 @@ workflow MAIN_WORKFLOW {
GET_WAIT_TIME.out
)
}

} else {

// all annotations are false, therefore first check if user annotations are provided
Expand Down
Loading