Skip to content

Commit

Permalink
Merge pull request #1236 from maxulysse/fix_annotation_unused
Browse files Browse the repository at this point in the history
FIX: remove check annotation folders existence when no annotation
  • Loading branch information
maxulysse authored Sep 15, 2023
2 parents a0c0cbd + e745db6 commit c6ec5dc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- [#1232](https://github.com/nf-core/sarek/pull/1232) - Fix Zenodo IDs in manifest
- [#1236](https://github.com/nf-core/sarek/pull/1236) - Fix annotation cache folder verification when no annotation

### Dependencies

Expand Down
43 changes: 25 additions & 18 deletions workflows/sarek.nf
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ def checkPathParamList = [
params.multiqc_config,
params.pon,
params.pon_tbi,
params.snpeff_cache,
params.spliceai_indel,
params.spliceai_indel_tbi,
params.spliceai_snv,
params.spliceai_snv_tbi,
params.vep_cache
params.spliceai_snv_tbi
]

// only check if we are using the tools
if (params.tools && params.tools.contains("snpeff")) checkPathParamList.add(params.snpeff_cache)
if (params.tools && params.tools.contains("vep")) checkPathParamList.add(params.vep_cache)

// Validate input parameters
WorkflowSarek.initialise(params, log)

Expand Down Expand Up @@ -288,19 +290,6 @@ if ((params.download_cache) && (params.snpeff_cache || params.vep_cache)) {
error("Please specify either `--download_cache` or `--snpeff_cache`, `--vep_cache`.\nhttps://nf-co.re/sarek/dev/usage#how-to-customise-snpeff-and-vep-annotation")
}

if ( params.vep_cache ) {
def vep_cache_dir = file("$params.vep_cache", type: 'dir') / "${params.vep_cache_version}_${params.vep_genome}"
if ( !vep_cache_dir.exists() || !vep_cache_dir.isDirectory() ) {
error("Files within --vep_cache invalid. Make sure there is a directory named ${params.vep_cache_version}_${params.vep_genome} in ${params.vep_cache}.\nhttps://nf-co.re/sarek/dev/usage#how-to-customise-snpeff-and-vep-annotation")
}
}

if ( params.snpeff_cache ) {
def snpeff_cache_dir = file("$params.snpeff_cache", type: 'dir') / "${params.snpeff_genome}.${params.snpeff_db}"
if ( !snpeff_cache_dir.exists() || !snpeff_cache_dir.isDirectory() ) {
error("Files within --snpeff_cache invalid. Make sure there is a directory named ${params.snpeff_genome}.${params.snpeff_db} in ${params.snpeff_cache}.\nhttps://nf-co.re/sarek/dev/usage#how-to-customise-snpeff-and-vep-annotation")
}
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT LOCAL MODULES/SUBWORKFLOWS
Expand Down Expand Up @@ -334,8 +323,26 @@ vep_genome = params.vep_genome ?: Channel.empty()
vep_species = params.vep_species ?: Channel.empty()

// Initialize files channels based on params, not defined within the params.genomes[params.genome] scope
snpeff_cache = params.snpeff_cache ? params.use_annotation_cache_keys ? Channel.fromPath("${params.snpeff_cache}/${params.snpeff_genome}.${params.snpeff_db}", checkIfExists: true).collect() : Channel.fromPath(params.snpeff_cache).collect() : []
vep_cache = params.vep_cache ? params.use_annotation_cache_keys ? Channel.fromPath("${params.vep_cache}/${params.vep_cache_version}_${params.vep_genome}", checkIfExists: true).collect() : Channel.fromPath(params.vep_cache).collect() : []
if (params.snpeff_cache && params.tools && params.tools.contains("snpeff")) {
def snpeff_annotation_cache_key = params.use_annotation_cache_keys ? "${params.snpeff_genome}.${params.snpeff_db}/" : ""
def snpeff_cache_dir = "${snpeff_annotation_cache_key}${params.snpeff_genome}.${params.snpeff_db}"
def snpeff_cache_path_full = file("$params.snpeff_cache/$snpeff_cache_dir", type: 'dir')
if ( !snpeff_cache_path_full.exists() || !snpeff_cache_path_full.isDirectory() ) {
error("Files within --snpeff_cache invalid. Make sure there is a directory named ${snpeff_cache_dir} in ${params.snpeff_cache}.\nhttps://nf-co.re/sarek/dev/usage#how-to-customise-snpeff-and-vep-annotation")
}
snpeff_cache = Channel.fromPath(file("${params.snpeff_cache}/${snpeff_annotation_cache_key}"), checkIfExists: true).collect()
.map{ cache -> [ [ id:"${params.snpeff_genome}.${params.snpeff_db}" ], cache ] }
} else snpeff_cache = []

if (params.vep_cache && params.tools && params.tools.contains("vep")) {
def vep_annotation_cache_key = params.use_annotation_cache_keys ? "${params.vep_cache_version}_${params.vep_genome}/" : ""
def vep_cache_dir = "${vep_annotation_cache_key}${params.vep_species}/${params.vep_cache_version}_${params.vep_genome}"
def vep_cache_path_full = file("$params.vep_cache/$vep_cache_dir", type: 'dir')
if ( !vep_cache_path_full.exists() || !vep_cache_path_full.isDirectory() ) {
error("Files within --vep_cache invalid. Make sure there is a directory named ${vep_cache_dir} in ${params.vep_cache}.\nhttps://nf-co.re/sarek/dev/usage#how-to-customise-snpeff-and-vep-annotation")
}
vep_cache = Channel.fromPath(file("${params.vep_cache}/${vep_annotation_cache_key}"), checkIfExists: true).collect()
} else vep_cache = []

vep_extra_files = []

Expand Down

0 comments on commit c6ec5dc

Please sign in to comment.