main.nf 1.26 KB
Newer Older
Gervaise Henry's avatar
Gervaise Henry committed
1
2
3
4
5
6
#!/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
Venkat Malladi's avatar
Venkat Malladi committed
7
params.bcl = "$baseDir/../test_data/*.tar.gz"
Gervaise Henry's avatar
Gervaise Henry committed
8
params.designFile = "$baseDir/../test_data/design.csv"
9

Gervaise Henry's avatar
Gervaise Henry committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

// Define List of Files
tarList = Channel.fromPath( params.bcl )


// Define regular variables


process checkDesignFile {

  publishDir "$baseDir/output/design", mode: 'copy'

  input:

  params.designFile

  output:

  file("design.csv") into designPaths

  script:

  """
Venkat Malladi's avatar
Venkat Malladi committed
33
  module load python/3.6.1-2-anaconda
34
  python3 $baseDir/scripts/check_design.py -d $params.designFile
Gervaise Henry's avatar
Gervaise Henry committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  """
}


process untarBCL {
  tag "$tar"

  publishDir "$baseDir/output/bcl", mode: 'copy'

  input:

  file tar from tarList

  output:

  file("*") into bclPaths

  script:

  """
55
56
  module load pigz/2.4
  tar -xvf $tar -I pigz
Gervaise Henry's avatar
Gervaise Henry committed
57
58
59
60
61
62
63
  """
}


process mkfastq {

  tag "${bcl.baseName}"
64
  publishDir "$baseDir/output/fastq/${bcl.baseName}", mode: 'copy'
Gervaise Henry's avatar
Gervaise Henry committed
65
66
67
68
69
70
71
72
73
74
75
76
77

  input:

  val bcl from bclPaths
  file designPaths

  output:

  file("**/outs/fastq_path/**/*") into fastqPaths

  script:

  """
Venkat Malladi's avatar
Venkat Malladi committed
78
79
  module load cellranger/2.1.1
  module load bcl2fastq/2.17.1.14
Gervaise Henry's avatar
Gervaise Henry committed
80
81
82
  cellranger mkfastq --id="${bcl.baseName}" --run=$bcl --csv=$designPaths
  """
}