Skip to content

Commit 7d6f8b6

Browse files
authored
Merge pull request #182 from uclahs-cds/nzeltser-remove-tempdir
Remove temp_dir parameter and replace with work_dir
2 parents 29f1440 + 062fe78 commit 7d6f8b6

10 files changed

+15
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1414
- Update index file extension from all processes to .bam.bai
1515
- Standardize config files
1616
- Remove spark_temp_dir parameter from config template
17+
- Replace temp_dir parameter with work_dir parameter
1718

1819
### Added
1920
- Intermediate file removal

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ After marking dup BAM files, the BAM files are then indexed by utilizing Picard
160160
| `aligner` | yes | list | Which aligners to use as strings in list format. Current options: `BWA-MEM2, HISAT2`. |
161161
| `reference_genome_version` | no | string | The genome build version. This is only used when the output files are directly saved to the Boutros Lab data storage registry, by setting `blcds_registered_dataset_output = true`. |
162162
| `output_dir` | yes | path | Absolute path to the directory where the output files to be saved. This is ignored if the output files are directly saved to the Boutros Lab data storage registry, by setting `blcds_registered_dataset_output = true` |
163-
| `temp_dir` | yes | path | Absolute path to the directory where the nextflow's intermediate files are saved. If your cluster worker node has the `/scratch` set up, this can be set to it. |
164163
| `save_intermediate_files` | yes | boolean | Save intermediate files. If yes, not only the final BAM, but also the unmerged, unsorted, and duplicates unmarked BAM files will also be saved. |
165164
| `cache_intermediate_pipeline_steps` | yes | boolean | Enable cahcing to resume pipeline and the end of the last successful process completion when a pipeline fails (if true the default submission script must be modified). |
166165
| `mark_duplicates` | no | boolean | Disable processes which mark duplicates. When false, the pipeline stops at the sorting step, outputting a sorted, indexed, unmerged BAM with unmarked duplicates. Recommended for high coverage targeted panel sequencing datasets. Defaults as true to mark duplicates as usual.|

pipeline/align-DNA.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ log.info """\
2121
reference_fasta_index_files_hisat2: ${params.aligner.contains("HISAT2") ? params.reference_fasta_index_files_hisat2 : "None"}
2222
2323
- output:
24-
temp_dir: ${params.temp_dir}
24+
work_dir: ${params.work_dir}
2525
output_dir: ${params.output_dir}
2626
bam_output_dir: ${params.bam_output_dir}
2727
bam_output_filename: ${params.bam_output_filename}

pipeline/config/methods.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,12 @@ methods {
237237
// If work_dir was specified as a param and exists or can be created, set workDir. Otherwise, let Nextflow's default behavior dictate workDir
238238
if (params.containsKey('work_dir') && params.work_dir && methods.check_workdir_permissions(params.work_dir)) {
239239
workDir = params.work_dir
240+
} else {
241+
params.work_dir = "${launchDir}/work"
240242
}
241243

242244
// If spark_temp_dir was specified as a param and exists or can be created, set as spark tempdir. Otherwise, set as workDir.
243-
params.spark_temp_dir = (params.containsKey('spark_temp_dir') && params.spark_temp_dir && methods.check_workdir_permissions(params.spark_temp_dir)) ? params.spark_temp_dir : workDir
245+
params.spark_temp_dir = (params.containsKey('spark_temp_dir') && params.spark_temp_dir && methods.check_workdir_permissions(params.spark_temp_dir)) ? params.spark_temp_dir : "${launchDir}/work"
244246
}
245247
}
246248

pipeline/config/template.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ params {
2626

2727
// input/output locations
2828
output_dir = "where/to/save/outputs/${SAMPLE}"
29-
temp_dir = "/local/disk/for/temp/file/dir/"
3029

3130
// options
3231
save_intermediate_files = false

pipeline/modules/align_DNA_BWA_MEM2.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ workflow align_DNA_BWA_MEM2_workflow {
124124
validate_output_file(
125125
och_bam.mix(
126126
och_bam_index,
127-
Channel.from(params.temp_dir, params.output_dir)
127+
Channel.from(params.work_dir, params.output_dir)
128128
),
129129
aligner_log_dir
130130
)

pipeline/modules/align_DNA_HISAT2.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ workflow align_DNA_HISAT2_workflow {
125125
validate_output_file(
126126
och_bam.mix(
127127
och_bam_index,
128-
Channel.from(params.temp_dir, params.output_dir)
128+
Channel.from(params.work_dir, params.output_dir)
129129
),
130130
aligner_log_dir
131131
)

pipeline/modules/mark_duplicate_picardtools.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// mark duplicates with picard
33
process run_MarkDuplicate_Picard {
44
container params.docker_image_picardtools
5-
containerOptions "--volume ${params.temp_dir}:/temp_dir"
5+
containerOptions "--volume ${params.work_dir}:/temp_dir"
66

77
publishDir path: "${bam_output_dir}",
88
pattern: "*.{bam,bai}",

pipeline/modules/mark_duplicates_spark.nf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
process run_MarkDuplicatesSpark_GATK {
1111
container params.docker_image_gatk
12-
containerOptions "--volume ${params.temp_dir}:/temp_dir --volume ${params.spark_temp_dir}:/spark_temp_dir -u nobody"
12+
containerOptions "--volume ${params.work_dir}:/temp_dir --volume ${params.spark_temp_dir}:/spark_temp_dir -u nobody"
1313

1414
publishDir path: "${bam_output_dir}",
1515
pattern: "*.bam{,.bai}",
@@ -43,14 +43,14 @@ process run_MarkDuplicatesSpark_GATK {
4343

4444
//Update tempdir permissions for user 'nobody'
4545
beforeScript "chmod 777 `pwd`; \
46-
if [[ ! -d ${params.temp_dir} ]]; \
46+
if [[ ! -d ${params.work_dir} ]]; \
4747
then \
48-
mkdir -p ${params.temp_dir}; \
49-
chmod 777 ${params.temp_dir}; \
48+
mkdir -p ${params.work_dir}; \
49+
chmod 777 ${params.work_dir}; \
5050
else \
51-
if [[ ! `stat -c %a ${params.temp_dir}` == 777 ]]; \
51+
if [[ ! `stat -c %a ${params.work_dir}` == 777 ]]; \
5252
then \
53-
chmod 777 ${params.temp_dir}; \
53+
chmod 777 ${params.work_dir}; \
5454
fi; \
5555
fi; \
5656
if [[ ! -d ${params.spark_temp_dir} ]]; \

pipeline/modules/sort_bam_picardtools.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// sort coordinate or queryname order with picard
33
process run_SortSam_Picard {
44
container params.docker_image_picardtools
5-
containerOptions "--volume ${params.temp_dir}:/temp_dir"
5+
containerOptions "--volume ${params.work_dir}:/temp_dir"
66

77
publishDir path: "${intermediate_output_dir}/${task.process.split(':')[1].replace('_', '-')}",
88
enabled: params.save_intermediate_files && params.mark_duplicates,

0 commit comments

Comments
 (0)