Skip to content
Snippets Groups Projects
Verified Commit ed5b729c authored by Mia Croiset's avatar Mia Croiset
Browse files

bypass validation error for bin_size and co

parent c441cecd
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,11 @@ class WorkflowHic { ...@@ -18,6 +18,11 @@ class WorkflowHic {
Nextflow.error "Unknown digestion protocol. Currently, the available digestion options are ${params.digest.keySet().join(", ")}. Please set manually the '--restriction_site' and '--ligation_site' parameters." Nextflow.error "Unknown digestion protocol. Currently, the available digestion options are ${params.digest.keySet().join(", ")}. Please set manually the '--restriction_site' and '--ligation_site' parameters."
} }
checkParamIntList(params.bin_size, log)
checkParamIntList(params.res_dist_decay, log)
checkParamIntList(params.res_tads, log)
checkParamIntList(params.res_compartments, log)
// Check Digestion or DNase Hi-C mode // Check Digestion or DNase Hi-C mode
//if (!params.dnase && !params.ligation_site) { //if (!params.dnase && !params.ligation_site) {
// Nextflow.error "Ligation motif not found. Please either use the `--digestion` parameters or specify the `--restriction_site` and `--ligation_site`. For DNase Hi-C, please use '--dnase' option" // Nextflow.error "Ligation motif not found. Please either use the `--digestion` parameters or specify the `--restriction_site` and `--ligation_site`. For DNase Hi-C, please use '--dnase' option"
...@@ -82,4 +87,16 @@ class WorkflowHic { ...@@ -82,4 +87,16 @@ class WorkflowHic {
Nextflow.error(error_string) Nextflow.error(error_string)
} }
} }
// Check the params 'list of Integer' or Integer (ex bin_size)
public static void checkParamIntList(def param2check, log) {
if (param2check instanceof Integer || (param2check instanceof String && param2check ==~ /(\d+)(,\d+)*/)){
//good format, do nothing
}
else {
println "\n"
log.error "ERROR: ${param2check} must be integer or list of integer"
Nextflow.error('Exiting!')
}
}
} }
...@@ -114,7 +114,7 @@ params { ...@@ -114,7 +114,7 @@ params {
version = false version = false
validate_params = true validate_params = true
show_hidden_params = false show_hidden_params = false
schema_ignore_params = 'genomes,digest' schema_ignore_params = 'genomes,digest,bin_size,res_dist_decay,res_tads,res_compartments'
// Config options // Config options
custom_config_version = 'master' custom_config_version = 'master'
......
...@@ -41,14 +41,22 @@ if (params.digestion){ ...@@ -41,14 +41,22 @@ if (params.digestion){
//**************************************** //****************************************
// Combine all maps resolution for downstream analysis // Combine all maps resolution for downstream analysis
ch_map_res = Channel.from( params.bin_size ).splitCsv().flatten().toInteger() if (params.bin_size instanceof Integer) {
ch_map_res = Channel.from( params.bin_size ).toInteger()
}
else {
ch_map_res = Channel.from( params.bin_size ).splitCsv().flatten().toInteger()
}
if (params.res_zoomify){ if (params.res_zoomify){
ch_zoom_res = Channel.from( params.res_zoomify ).splitCsv().flatten().toInteger() ch_zoom_res = Channel.from( params.res_zoomify ).splitCsv().flatten().toInteger()
ch_map_res = ch_map_res.concat(ch_zoom_res) ch_map_res = ch_map_res.concat(ch_zoom_res)
} }
if (params.res_tads && !params.skip_tads){ if (params.res_tads && !params.skip_tads && params.res_tads instanceof Integer){
ch_tads_res = Channel.from( "${params.res_tads}" ).toInteger()
ch_map_res = ch_map_res.concat(ch_tads_res)
}else if (params.res_tads && !params.skip_tads){
ch_tads_res = Channel.from( "${params.res_tads}" ).splitCsv().flatten().toInteger() ch_tads_res = Channel.from( "${params.res_tads}" ).splitCsv().flatten().toInteger()
ch_map_res = ch_map_res.concat(ch_tads_res) ch_map_res = ch_map_res.concat(ch_tads_res)
}else{ }else{
...@@ -58,7 +66,10 @@ if (params.res_tads && !params.skip_tads){ ...@@ -58,7 +66,10 @@ if (params.res_tads && !params.skip_tads){
} }
} }
if (params.res_dist_decay && !params.skip_dist_decay){ if (params.res_dist_decay && !params.skip_dist_decay && params.res_dist_decay instanceof Integer){
ch_ddecay_res = Channel.from( "${params.res_dist_decay}" ).toInteger()
ch_map_res = ch_map_res.concat(ch_ddecay_res)
}else if (params.res_dist_decay && !params.skip_dist_decay){
ch_ddecay_res = Channel.from( "${params.res_dist_decay}" ).splitCsv().flatten().toInteger() ch_ddecay_res = Channel.from( "${params.res_dist_decay}" ).splitCsv().flatten().toInteger()
ch_map_res = ch_map_res.concat(ch_ddecay_res) ch_map_res = ch_map_res.concat(ch_ddecay_res)
}else{ }else{
...@@ -68,7 +79,10 @@ if (params.res_dist_decay && !params.skip_dist_decay){ ...@@ -68,7 +79,10 @@ if (params.res_dist_decay && !params.skip_dist_decay){
} }
} }
if (params.res_compartments && !params.skip_compartments){ if (params.res_compartments && !params.skip_compartments && params.res_compartments instanceof Integer){
ch_comp_res = Channel.from( "${params.res_compartments}" ).toInteger()
ch_map_res = ch_map_res.concat(ch_comp_res)
}else if (params.res_compartments && !params.skip_compartments){
ch_comp_res = Channel.from( "${params.res_compartments}" ).splitCsv().flatten().toInteger() ch_comp_res = Channel.from( "${params.res_compartments}" ).splitCsv().flatten().toInteger()
ch_map_res = ch_map_res.concat(ch_comp_res) ch_map_res = ch_map_res.concat(ch_comp_res)
}else{ }else{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment