-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvdj.nf
92 lines (74 loc) · 2.41 KB
/
vdj.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env nextflow
// Enable DSL 2 syntax
nextflow.enable.dsl = 2
// Import the process used to identify samples from the FASTQ files in a folder
include { sample_list } from './modules/general'
// Define the process used to run cellranger vdj
process cellranger_vdj {
// Load the appropriate dependencies
label "cellranger"
// Copy all output files to the folder specified by the user with --output
publishDir "${params.output}/", mode: 'copy', overwrite: true
input:
// Run the process once per sample
val sample
// Stage the FASTQ folder (by symlink) in the working directory
path "FASTQ_DIR"
// Stage the reference transcriptome (by symlink) in the working directory
path "REF"
output:
// Capture any created files in the output directory
path "*"
script:
// Run the code defined in templates/vdj.sh
template "vdj.sh"
}
workflow {
log.info"""
Parameters:
output: ${params.output}
fastq_dir: ${params.fastq_dir}
vdj_dir: ${params.vdj_dir}
dryrun: ${params.dryrun}
cellranger_version: ${params.cellranger_version}
"""
// Check that the user specified the output parameter
if("${params.output}" == "false"){
error "Parameter 'output' must be specified"
}
// Check that the user specified the fastq_dir parameter
if("${params.fastq_dir}" == "false"){
error "Parameter 'fastq_dir' must be specified"
}
// Check that the user specified the vdj_dir parameter
if("${params.vdj_dir}" == "false"){
error "Parameter 'vdj_dir' must be specified"
}
// Get the sample list either from the sample_whitelist or the fastq_dir
sample_list()
// Point to the FASTQ directory
fastq_dir = file(
"${params.fastq_dir}",
checkIfExists: true,
type: "dir",
glob: false
)
// Point to the reference vdj
ref_dir = file(
"${params.vdj_dir}",
checkIfExists: true,
type: "dir",
glob: false
)
// If the user has not set the `dryrun` parameter
if("${params.dryrun}" == "false"){
// Analyze each sample independently
cellranger_vdj(sample_list.out, fastq_dir, ref_dir)
}else{
// Log the samples which have been detected
sample_list.out
.view {
"Sample: ${it}"
}
}
}