Skip to content

Commit

Permalink
feat: Create single boolean parameter allowing users to control how a…
Browse files Browse the repository at this point in the history
…lignment files are saved for CellRanger and STAR
  • Loading branch information
kopichris committed Nov 1, 2024
1 parent c749bf2 commit 36eeee3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
25 changes: 19 additions & 6 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ if(params.aligner == "cellranger") {
path: "${params.outdir}/${params.aligner}/count",
mode: params.publish_dir_mode
]
ext.args = {"--chemistry ${meta.chemistry} --create-bam ${params.cellranger_create_bam}" + " " + (meta.expected_cells ? "--expect-cells ${meta.expected_cells}" : '')}
ext.args = {"--chemistry ${meta.chemistry} --create-bam ${params.save_align_intermeds}" + " " + (meta.expected_cells ? "--expect-cells ${meta.expected_cells}" : '')}
time = { check_max( 240.h * task.attempt, 'time' ) }
}
}
Expand Down Expand Up @@ -186,11 +186,24 @@ if (params.aligner == "star") {
enabled: params.save_reference
]
}
withName: STAR_ALIGN {
publishDir = [
path: { "${params.outdir}/${params.aligner}/${meta.id}" },
mode: params.publish_dir_mode
]

if(params.save_align_intermeds) {
withName: 'STAR_ALIGN' {
publishDir = [
path: { "${params.outdir}/${params.aligner}/${meta.id}" },
mode: params.publish_dir_mode
]
}
}
else {
withName: 'STAR_ALIGN' {
publishDir = [
path: { "${params.outdir}/${params.aligner}/${meta.id}" },
mode: params.publish_dir_mode,
pattern: '*',
saveAs: { it.endsWith('.bam') ? null : it }
]
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ params {
aligner = 'alevin'
input = null
save_reference = false
save_align_intermeds = true
protocol = 'auto'

// reference files
Expand Down Expand Up @@ -43,7 +44,6 @@ params {
// Cellranger parameters
skip_cellranger_renaming = false
cellranger_index = null
cellranger_create_bam = true

// Cellranger ARC parameters
motifs = null
Expand All @@ -66,7 +66,6 @@ params {
vdj_inner_enrichment_primers = null
gex_barcode_sample_assignment = null
cellranger_multi_barcodes = null
cellranger_multi_create_bam = true


// Template Boilerplate options
Expand Down
15 changes: 5 additions & 10 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@
"description": "Specify this parameter to save the indices created (STAR, Kallisto, Salmon) to the results.",
"fa_icon": "fas fa-bookmark"
},
"save_align_intermeds": {
"type": "boolean",
"description": "Specify this parameter to save the intermediate alignment files (STAR, CellRanger) to the results.",
"fa_icon": "fas fa-bookmark"
},
"igenomes_base": {
"type": "string",
"format": "directory-path",
Expand Down Expand Up @@ -270,11 +275,6 @@
"skip_cellranger_renaming": {
"type": "boolean",
"description": "Should it skip the automatic renaming included in cellranger-related modules?"
},
"cellranger_create_bam": {
"type": "boolean",
"description": "Create BAM alignment file. Note: Using the default value of true will increase computational resources and disk space. Please see the [10x documentation about create-bam parameter](https://kb.10xgenomics.com/hc/en-us/articles/24292856143885-Understanding-the-create-bam-Parameter-in-Cell-Ranger-v8-0) for more information.",
"default": true
}
}
},
Expand Down Expand Up @@ -371,11 +371,6 @@
"exists": true,
"mimetype": "text/csv",
"description": "Additional samplesheet to provide information about multiplexed samples. See the 'Usage' section for more details."
},
"cellranger_multi_create_bam": {
"type": "boolean",
"description": "Create BAM alignment file. Note: Using the default value of true will increase computational resources and disk space. Please see the [10x documentation about create-bam parameter](https://kb.10xgenomics.com/hc/en-us/articles/24292856143885-Understanding-the-create-bam-Parameter-in-Cell-Ranger-v8-0) for more information.",
"default": true
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ workflow SCRNASEQ {
// add cellranger options that are currently handled by pipeline, coming from samplesheet
// the module parses them from the 'gex' options
if (meta.feature_type.toString() == 'gex') {
parsed_meta.options['create-bam'] = params.cellranger_multi_create_bam // force bam creation -- param required by cellranger multi
parsed_meta.options['create-bam'] = params.save_align_intermeds // force bam creation -- param required by cellranger multi
if (meta.expected_cells) { parsed_meta.options['expected-cells'] = meta.expected_cells }
}

Expand Down

0 comments on commit 36eeee3

Please sign in to comment.