Skip to content

Commit

Permalink
Allow user-defined panels
Browse files Browse the repository at this point in the history
  • Loading branch information
scwatts committed Mar 19, 2024
1 parent 9285ccc commit 29ddb75
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/Constants.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Constants {
static List GENOMES_SUPPORTED = ['GRCh37_hmf', 'GRCh38_hmf']
static List GENOMES_DEFINED = Constants.GENOMES_VERSION_37 + Constants.GENOMES_VERSION_38

static List PANELS_DEFINED = ['tso500']
static List PANELS_SUPPORTED = ['tso500']


static String HMF_DATA_37_PATH = 'https://pub-29f2e5b2b7384811bdbbcba44f8b5083.r2.dev/hmf_reference_data/hmftools/5.34_37--2.tar.gz'
Expand Down
9 changes: 1 addition & 8 deletions lib/Utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class Utils {
}

// Apply some required restrictions to targeted mode
if (run_config.mode === Constants.RunMode.TARGETED) {
if (run_config.mode === Constants.RunMode.TARGETED && !run_config.force_panel) {

// Do not allow normal DNA
if (Utils.hasNormalDna(meta)) {
Expand All @@ -281,13 +281,6 @@ class Utils {
System.exit(1)
}

// Restrict tumor RNA inputs to the TSO500 panel
if (Utils.hasTumorRnaBam(meta) && run_config.panel != 'tso500') {
def panel = run_config.panel.toUpperCase()
"Only the TSO500 panel supports tumor RNA analysis"
System.exit(1)
}

}

// Do not allow normal DNA only
Expand Down
34 changes: 19 additions & 15 deletions lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -276,24 +276,27 @@ class WorkflowMain {
if (run_mode === Constants.RunMode.TARGETED) {

if (!params.containsKey('panel')) {

def panels = Constants.PANELS_DEFINED.join('\n - ')
log.error "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" A panel is required to be set using the --panel CLI argument or in a \n" +
" configuration file.\n" +
" Currently, the available panels are:\n" +
" - ${panels}\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
log.error "\n A panel is required to be set using the --panel CLI argument or in configuration " +
"file.\n Currently, the available panels are:\n" +
" - ${Constants.PANELS_SUPPORTED.join('\n - ')}"
System.exit(1)

} else if (!Constants.PANELS_DEFINED.contains(params.panel)) {
} else if (!Constants.PANELS_SUPPORTED.contains(params.panel)) {
if (params.containsKey('force_panel') && !params.force_panel) {
log.error "\n The ${params.panel} panel is not supported but you can force run the analysis using " +
"this panel by setting --force_panel.\n Currently, the supported panels are:\n" +
" - ${Constants.PANELS_SUPPORTED.join('\n - ')}"
System.exit(1)
} else {
log.warn "got unsupported ${params.panel} panel but forcing to proceed"
}

def panels = Constants.PANELS_DEFINED.join('\n - ')
log.error "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" The ${params.panel} is not defined. Currently, the available panels are:\n" +
" - ${panels}\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
System.exit(1)
if (!params.panel_data_paths.containsKey(params.panel)) {
log.error "\n The ${params.panel} panel is used but no filepaths were set in " +
"params.panel_data_paths.\n Currently, panels with defined filepaths are:\n" +
" - ${params.panel_data_paths.keySet().join('\n - ')}"
System.exit(1)
}

}

Expand All @@ -315,6 +318,7 @@ class WorkflowMain {
return [
mode: run_mode,
panel: run_mode === Constants.RunMode.TARGETED ? params.panel : null,
force_panel: params.containsKey('force_panel') ? params.force_panel : false,
stages: stages,
has_dna: inputs.any { Utils.hasTumorDna(it) },
has_rna: inputs.any { Utils.hasTumorRna(it) },
Expand Down
7 changes: 6 additions & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@
},
"force_genome": {
"type": "boolean",
"description": "Skip check for restricted genome.",
"description": "Force use of unsupported genome.",
"fa_icon": "fas fa-palette"
},
"force_panel": {
"type": "boolean",
"description": "Force use of unsupported panel.",
"fa_icon": "fas fa-palette"
},
"processes_manual": {
Expand Down

0 comments on commit 29ddb75

Please sign in to comment.