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

Add validation for required inputs types and display error_messages #60

Conversation

ZaahidShaik
Copy link
Contributor

@ZaahidShaik ZaahidShaik commented Aug 16, 2024

Changes :

  • This PR is to add validation for required inputs for missing entries and wrong file type.
  • In favor of Issue-#49

Testing :

  • Happy Case : All inputs are provided.
output: 
 N E X T F L O W   ~  version 24.04.2

Launching `./main.nf` [lethal_ptolemy] DSL2 - revision: 1e18d4b88b
executor >  local (15)
[skipped  ] process > BUILD_REFERENCE_INDEX      [100%] 1 of 1, stored: 1 ✔
[5a/d40650] process > INDEX_VCF                  [100%] 1 of 1 ✔
[85/740ee0] process > VCF_PRE_PROCESS_PART1      [100%] 1 of 1 ✔
[fa/a621cb] process > VCF_PRE_PROCESS_PART2      [100%] 1 of 1 ✔
[7d/6af2f5] process > ANNOT_PHRANK               [100%] 1 of 1 ✔
[c4/e3440c] process > ANNOT_ENSMBLE              [100%] 1 of 1 ✔
[2f/22a7ee] process > TO_GENE_SYM                [100%] 1 of 1 ✔
[a2/999273] process > PHRANK_SCORING             [100%] 1 of 1 ✔
[96/43a78f] process > HPO_SIM                    [100%] 1 of 1 ✔
[c7/2a9923] process > REMOVE_MITO_AND_UNKOWN_CHR [100%] 1 of 1 ✔
[3c/658a8c] process > FILTER_BED                 [100%] 1 of 1 ✔
[cf/d007e8] process > FILTER_PROBAND             [100%] 1 of 1 ✔
[57/d09add] process > VEP_ANNOTATE               [100%] 1 of 1 ✔
[5f/e3fd9d] process > FEATURE_ENGINEERING_PART1  [100%] 1 of 1 ✔
[3e/de0210] process > FEATURE_ENGINEERING_PART2  [100%] 1 of 1 ✔
[dc/9cee66] process > PREDICTION                 [100%] 1 of 1 ✔
Completed at: 16-Aug-2024 21:02:07
Duration    : 21m 39s
CPU hours   : 5.8
Succeeded   : 15
  • Missing fields: In case of params are not provided,

WARN: Access to undefined parameter `input_vcf` -- Initialise it to a default value eg. `params.input_vcf = some_value`
WARN: Access to undefined parameter `input_hpo` -- Initialise it to a default value eg. `params.input_hpo = some_value`
Input parameter 'input_vcf' not specified or is null!

  To see usage and available parameters run `nextflow run main.nf --help`
  • Wrong file Type : In case the params file provided doesn't fix the required file extension
Launching `./main.nf` [marvelous_swartz] DSL2 - revision: 83978dd9e8

Error: '--input_vcf' value '/home/sample/' should be a VCF file (.vcf) or (.vcf.gz)
  
  To see usage and available parameters run `nextflow run main.nf --help`

Launching `./main.nf` [naughty_boltzmann] DSL2 - revision: 83978dd9e8

Error: '--input_hpo' value '/home/sample/sample.vcf.gz' should be an HPO file (.hpo) or (.txt)

  To see usage and available parameters run `nextflow run main.nf --help`
  
  • When ref_dir is not a directory,

Launching `./main.nf` [loving_kay] DSL2 - revision: 5369268806

Error: '--ref_dir' value 'sample_vcf_for_n/smaple.vcf.gz' should be an directory.

  To see usage and available parameters run `nextflow run main.nf --help`

  • Mismatch string for ref_ver
Launching `./main.nf` [pensive_cajal] DSL2 - revision: 9fa2503416

Error: '--ref_ver' value 'hg1' should be either set to 'hg19' or 'hg38'.

  To see usage and available parameters run `nextflow run main.nf --help`
  

@ZaahidShaik ZaahidShaik self-assigned this Aug 16, 2024
Copy link
Contributor

@hyunhwan-bcm hyunhwan-bcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Just a tiny change.

main.nf Outdated
}
exit 0
}
}

def VALIDATE() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! can you put this on above of BUILD_REFERENCE_INDEX()

@ZaahidShaik ZaahidShaik force-pushed the groovy_add_params_validation branch from 284c6fd to 5349efc Compare August 16, 2024 21:07
Copy link
Contributor

@hyunhwan-bcm hyunhwan-bcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@hyunhwan-bcm hyunhwan-bcm merged commit 73c5aed into LiuzLab:nextflow_conversion Aug 16, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants