Newer
Older
#!/usr/bin/env nextflow
// Path to an input file, or a pattern for multiple inputs
// Note - $baseDir is the location of this workflow file main.nf
// Define Input variables
params.fastq = "$baseDir/../test_data/*.fastq.gz"
params.designFile = "$baseDir/../test_data/design.csv"
params.genome = 'GRCh38'
params.genomes = []
params.ref = params.genome ? params.genomes[ params.genome ].ref ?: false : false
println params.genome
println params.genomes[ params.genome ].ref
println params.ref
.fromPath(params.ref)
.ifEmpty { exit 1, "referene not found: ${params.ref}" }
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
}
// Define List of Files
fastqList = Channel
.fromPath(params.fastq)
.flatten()
.map { file -> [ file.getFileName().toString(), file.toString() ].join("\t") }
.collectFile(name: 'fileList.tsv', newLine: true)
// Define regular variables
expectCells = params.expectCells
forceCells = params.forceCells
process checkDesignFile {
publishDir "$baseDir/output", mode: 'copy'
input:
params.designFile
file fastqList
output:
file("design.csv") into designPaths
script:
"""
module load python/3.6.1-2-anaconda
python3 $baseDir/scripts/check_design.py -d $params.designFile -f $fastqList
"""
}
// Parse design file
samples = designPaths
.splitCsv (sep: ',', header: true)
.map { row -> [ row.Sample, file(row.fastq_R1), file(row.fastq_R2) ] }
.groupTuple()
//.subscribe { println it }
process count {
tag "$sample"
publishDir "$baseDir/output", mode: 'copy'
input:
set sample, file("${sample}_S1_L00?_R1_001.fastq.gz"), file("${sample}_S1_L00?_R2_001.fastq.gz") from samples
file ref from refLocation.first()
expectCells
forceCells
output:
file("**/outs/**") into outPaths
script:
"""
module load cellranger/2.1.1
"""
"""
cellranger count --id="$sample" --transcriptome="$ref" --fastqs=. --sample="$sample" --expect-cells=$expectCells
"""
} else {
"""
cellranger count --id="$sample" --transcriptome="$ref" --fastqs=. --sample="$sample" --force-cells=$forceCells