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

FIX: remove check annotation folders existence when no annotation #1236

Merged
merged 8 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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 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
32 changes: 22 additions & 10 deletions workflows/sarek.nf
Original file line number Diff line number Diff line change
Expand Up @@ -288,19 +288,26 @@ 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 && params.tools && params.tools.contains("snpeff")) {
def snpeff_cache_dir = params.use_annotation_cache_keys ?
"${params.snpeff_genome}.${params.snpeff_db}/${params.snpeff_genome}.${params.snpeff_db}" :
"${params.snpeff_genome}.${params.snpeff_db}"
def snpeff_cache_path_full = file("$params.snpeff_cache", type: 'dir') / snpeff_cache_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")
}
}

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")
if (params.vep_cache && params.tools && params.tools.contains("vep")) {
def vep_cache_dir = params.use_annotation_cache_keys ?
"${params.vep_cache_version}_${params.vep_genome}/${params.vep_species}/${params.vep_cache_version}_${params.vep_genome}" :
"${params.vep_species}/${params.vep_cache_version}_${params.vep_genome}"
def vep_cache_path_full = file("$params.vep_cache", type: 'dir') / vep_cache_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")
}
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT LOCAL MODULES/SUBWORKFLOWS
Expand Down Expand Up @@ -334,8 +341,13 @@ 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() : []
snpeff_cache = params.snpeff_cache ? params.use_annotation_cache_keys ?
Channel.fromPath("${params.snpeff_cache}/${params.snpeff_genome}.${params.snpeff_db}", checkIfExists: true).collect().map{ cache -> [[id:"${params.snpeff_genome}.${params.snpeff_db}"], cache]} :
Channel.fromPath(params.snpeff_cache).collect().map{ cache -> [[id:"${params.snpeff_genome}.${params.snpeff_db}"], cache]} : []

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() : []
maxulysse marked this conversation as resolved.
Show resolved Hide resolved

vep_extra_files = []

Expand Down