main.nf 1.33 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

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


// Define regular variables


process checkDesignFile {

20
  publishDir "$outDir/${task.process}", mode: 'copy'
Gervaise Henry's avatar
Gervaise Henry committed
21
22
23
24
25
26
27
28
29
30
31
32

  input:

  params.designFile

  output:

  file("design.csv") into designPaths

  script:

  """
33
34
  hostname
  ulimit -a
Venkat Malladi's avatar
Venkat Malladi committed
35
  module load python/3.6.1-2-anaconda
36
  python3 $baseDir/scripts/check_design.py -d $params.designFile
Gervaise Henry's avatar
Gervaise Henry committed
37
38
39
40
41
42
43
  """
}


process untarBCL {
  tag "$tar"

44
  publishDir "$outDir/${task.process}", mode: 'copy'
Gervaise Henry's avatar
Gervaise Henry committed
45
46
47
48
49
50
51
52
53
54
55
56

  input:

  file tar from tarList

  output:

  file("*") into bclPaths

  script:

  """
57
58
  hostname
  ulimit -a
59
60
  module load pigz/2.4
  tar -xvf $tar -I pigz
Gervaise Henry's avatar
Gervaise Henry committed
61
62
63
64
65
66
  """
}


process mkfastq {
  tag "${bcl.baseName}"
67
68

  publishDir "$outDir/${task.process}/${bcl.baseName}", mode: 'copy'
Gervaise Henry's avatar
Gervaise Henry committed
69
70
71
72
73
74
75
76
77
78
79
80
81

  input:

  val bcl from bclPaths
  file designPaths

  output:

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

  script:

  """
82
83
84
85
  hostname
  ulimit -a
  module load cellranger/3.0.2
  module load bcl2fastq/2.19.1
Gervaise Henry's avatar
Gervaise Henry committed
86
87
88
  cellranger mkfastq --id="${bcl.baseName}" --run=$bcl --csv=$designPaths
  """
}