Skip to content

Commit

Permalink
Merge pull request #1261 from maxulysse/annotation_merge
Browse files Browse the repository at this point in the history
FEAT: add merge to cache checks
  • Loading branch information
maxulysse authored Sep 29, 2023
2 parents ffda6bb + 50747d6 commit 28f9077
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- [#1248](https://github.com/nf-core/sarek/pull/1248) - Improve annotation-cache docs
- [#1261](https://github.com/nf-core/sarek/pull/1261) - Enable cache for annotation generation when using 'merge'

### Fixed

Expand Down
14 changes: 7 additions & 7 deletions workflows/sarek.nf
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def checkPathParamList = [
]

// 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)
if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge'))) checkPathParamList.add(params.snpeff_cache)
if (params.tools && (params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge'))) checkPathParamList.add(params.vep_cache)

// Validate input parameters
WorkflowSarek.initialise(params, log)
Expand Down Expand Up @@ -216,7 +216,7 @@ if (params.step == 'mapping' && params.aligner.contains("sentieon-bwamem") && pa
error("Sentieon BWA is currently not compatible with FGBio UMI handeling. Please choose a different aligner.")
}

if (params.tools && params.tools.contains("sentieon_haplotyper") && params.joint_germline && (!params.sentieon_haplotyper_emit_mode || !(params.sentieon_haplotyper_emit_mode.contains('gvcf')))) {
if (params.tools && params.tools.split(',').contains("sentieon_haplotyper") && params.joint_germline && (!params.sentieon_haplotyper_emit_mode || !(params.sentieon_haplotyper_emit_mode.contains('gvcf')))) {
error("When setting the option `--joint_germline` and including `sentieon_haplotyper` among the requested tools, please set `--sentieon_haplotyper_emit_mode` to include `gvcf`.")
}

Expand Down Expand Up @@ -323,7 +323,7 @@ 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
if (params.snpeff_cache && params.tools && params.tools.contains("snpeff")) {
if (params.snpeff_cache && params.tools && (params.tools.split(',').contains("snpeff") || params.tools.split(',').contains('merge'))) {
if (params.snpeff_cache == "s3://annotation-cache/snpeff_cache") {
def snpeff_annotation_cache_key = "${params.snpeff_genome}.${params.snpeff_db}/"
} else {
Expand All @@ -340,11 +340,11 @@ if (params.snpeff_cache && params.tools && params.tools.contains("snpeff")) {
}
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 if (params.tools && params.tools.contains("snpeff") && !params.download_cache) {
} else if (params.tools && (params.tools.split(',').contains("snpeff") || params.tools.split(',').contains('merge')) && !params.download_cache) {
error("No cache for SnpEff or automatic download of said cache has been detected.\nPlease refer to https://nf-co.re/sarek/docs/usage/#how-to-customise-snpeff-and-vep-annotation for more information.")
} else snpeff_cache = []

if (params.vep_cache && params.tools && params.tools.contains("vep")) {
if (params.vep_cache && params.tools && (params.tools.split(',').contains("vep") || params.tools.split(',').contains('merge'))) {
if (params.vep_cache == "s3://annotation-cache/vep_cache") {
def vep_annotation_cache_key = "${params.vep_cache_version}_${params.vep_genome}/"
} else {
Expand All @@ -360,7 +360,7 @@ if (params.vep_cache && params.tools && params.tools.contains("vep")) {
}
}
vep_cache = Channel.fromPath(file("${params.vep_cache}/${vep_annotation_cache_key}"), checkIfExists: true).collect()
} else if (params.tools && params.tools.contains("vep") && !params.download_cache) {
} else if (params.tools && (params.tools.split(',').contains("vep") || params.tools.split(',').contains('merge')) && !params.download_cache) {
error("No cache for VEP or automatic download of said cache has been detected.\nPlease refer to https://nf-co.re/sarek/docs/usage/#how-to-customise-snpeff-and-vep-annotation for more information.")
} else vep_cache = []

Expand Down

0 comments on commit 28f9077

Please sign in to comment.