Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions conf/bagel_species.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
params {
bagel_gene_sets = [
human: [
core: '/opt2/bagel-2.0-115/CEGv2.txt',
noncore: '/opt2/bagel-2.0-115/NEGv1.txt'
],
mouse: [
core: '/opt2/bagel-2.0-115/CEG_mouse.txt',
noncore: '/opt2/bagel-2.0-115/NEG_mouse.txt'
]
]
}
15 changes: 8 additions & 7 deletions docs/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ Define where the pipeline should find input data and save output data.

## crispr options

| Parameter | Description | Type | Default | Required | Hidden |
| ---------------------------- | ------------- | --------- | ----------------------------- | -------- | ------ |
| `drugz_remove_genes` | comma-sep str | `string` | | | |
| `drugz_half_window_size` | | `integer` | 500 | | |
| `bagel_core_essential_genes` | | `string` | /opt2/bagel-2.0-115/CEGv2.txt | | |
| `bagel_non_essential_genes` | | `string` | /opt2/bagel-2.0-115/NEGv1.txt | | |
| `bagel_test_columns` | | `string` | | | |
| Parameter | Description | Type | Default | Required | Hidden |
| ---------------------------- | ------------------------------------------------------------------------------------------ | --------- | ----------------------------- | -------- | ------ |
| `drugz_remove_genes` | comma-sep str | `string` | | | |
| `drugz_half_window_size` | | `integer` | 500 | | |
| `bagel_species` | Species for BAGEL analysis; determines default essential and non-essential gene set files. | `string` | human | | |
| `bagel_core_essential_genes` | | `string` | /opt2/bagel-2.0-115/CEGv2.txt | | |
| `bagel_non_essential_genes` | | `string` | /opt2/bagel-2.0-115/NEGv1.txt | | |
| `bagel_test_columns` | | `string` | | | |

## Docker containers

Expand Down
38 changes: 34 additions & 4 deletions modules/local/bagel.nf
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@

// Nextflow v2 strict parser compliant: Helper method for species-specific gene sets
def get_bagel_gene_sets(String species) {
if (!params.bagel_gene_sets.containsKey(species)) {
error("Unsupported bagel_species '${species}'. Supported species: ${params.bagel_gene_sets.keySet().join(', ')}")
}

return params.bagel_gene_sets[species]
}

// Helper to resolve gene set file paths based on species or explicit params
def resolve_bagel_genes() {
Map genes = get_bagel_gene_sets(params.bagel_species)

// Allow explicit params to override species defaults
String core_genes = params.bagel_core_essential_genes
String noncore_genes = params.bagel_non_essential_genes

// If using default species-based path, apply species-specific path
if (core_genes == '/opt2/bagel-2.0-115/CEGv2.txt') {
core_genes = genes.core
}
if (noncore_genes == '/opt2/bagel-2.0-115/NEGv1.txt') {
noncore_genes = genes.noncore
}

return [core: core_genes, noncore: noncore_genes]
}

process FOLD_CHANGE {
label 'bagel'
container "${params.container_bagel}"
Expand Down Expand Up @@ -39,12 +67,13 @@ process BAYES_FACTOR {
path("*.bf"), emit: bf

script:
def bagel_genes = resolve_bagel_genes()
"""
BAGEL.py bf \\
-i ${fold_change} \\
-o ${fold_change.getBaseName(2)}.bf \\
-e ${params.bagel_core_essential_genes} \\
-n ${params.bagel_non_essential_genes} \\
-e ${bagel_genes.core} \\
-n ${bagel_genes.noncore} \\
-c ${params.bagel_test_columns}
"""

Expand All @@ -64,12 +93,13 @@ process PRECISION_RECALL {
path("*.pr"), emit: pr

script:
def bagel_genes = resolve_bagel_genes()
"""
BAGEL.py pr \\
-i ${bayes_factor} \\
-o ${bayes_factor.getBaseName(2)}.pr \\
-e ${params.bagel_core_essential_genes} \\
-n ${params.bagel_non_essential_genes}
-e ${bagel_genes.core} \\
-n ${bagel_genes.noncore}
"""

stub:
Expand Down
3 changes: 3 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ params {
drugz_half_window_size = 500 // same as default in drugZ https://github.com/hart-lab/drugz/blob/eb15d34e4dd172965e618d5bb662c053066da799/drugz.py#L305-L306

bagel_run = true
bagel_species = 'human'
bagel_core_essential_genes = '/opt2/bagel-2.0-115/CEGv2.txt' // in Docker container
bagel_non_essential_genes = '/opt2/bagel-2.0-115/NEGv1.txt' // in Docker container
bagel_test_columns = null

}


includeConfig 'conf/bagel_species.config'
includeConfig 'conf/base.config'

profiles {
Expand Down
6 changes: 6 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@
"type": "integer",
"default": 500
},
"bagel_species": {
"type": "string",
"default": "human",
"enum": ["human", "mouse"],
"description": "Species for BAGEL analysis; determines default essential and non-essential gene set files."
},
"bagel_core_essential_genes": {
"type": "string",
"default": "/opt2/bagel-2.0-115/CEGv2.txt",
Expand Down
Loading