-
Notifications
You must be signed in to change notification settings - Fork 1
/
hack2.nf
140 lines (93 loc) · 2.64 KB
/
hack2.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* pipeline input parameters
*/
folderIN = "$baseDir/data/0_fastq"
reads = "$folderIN/*_R{1,2}_*.fastq"
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
dir : ${params.dir}
genome : ${params.genome}
"""
.stripIndent()
folderOUT = "$baseDir/data/1_fastqc"
Channel.fromFilePairs(reads).into{reads_ch1; reads_ch2}
process fastqc {
publishDir folderOUT, mode: 'copy'
input:
tuple val(sample_id), file(reads_file) from reads_ch1
output:
file("fastqc_${sample_id}_logs") into fastqc_ch
script:
"""
mkdir -p "fastqc_${sample_id}_logs"
fastqc -o fastqc_${sample_id}_logs -f fastq -q $folderIN/${reads_file}
"""
}
folderOUT = "$baseDir/data/2_cutadapt"
process cutadapt {
container 'dceoy/cutadapt' //pegi3s/cutadapt'
echo true
publishDir "$folderOUT", pattern: '*.fastq', mode: 'copy'
input:
tuple val(sample_id), file(reads_file) from reads_ch2
output:
tuple val(sample_id), file ("${sample_id}_*.fastq") into res_cutadapt_ch1
script:
"""
echo process cutadapt : $sample_id ${reads_file[0]} ${reads_file[1]}
mkdir -p $folderOUT
cutadapt --quiet -o ${sample_id}_R1.fastq ${reads_file[0]}
cutadapt --quiet -o ${sample_id}_R2.fastq ${reads_file[1]}
"""
}
res_cutadapt_ch2 = Channel.fromFilePairs("$folderOUT/*_R{1,2}.fastq")
folderOUT = "$baseDir/data/3_fastqc"
process fastqc2 {
publishDir folderOUT, mode: 'copy'
input:
tuple val(sample_id), file(reads_file) from res_cutadapt_ch1
output:
file("fastqc_${sample_id}_logs")
script:
"""
mkdir -p "fastqc_${sample_id}_logs"
fastqc -o fastqc_${sample_id}_logs -f fastq -q ${reads_file}
"""
}
index_ch = Channel.fromPath("$folderIN/idx/Homo_sapiens/NCBI/GRCh38/Sequence/BWAIndex")
folderOUT = "$baseDir/data/4_bwa"
process bwa {
container 'dceoy/bwa'
publishDir folderOUT, mode: 'copy'
input:
file(index) from index_ch
tuple val(sample_id), file(reads_file) from res_cutadapt_ch2
// output:
// file("${sample_id}.sam")
script:
"""
bwa mem -M -t 5 $index ${reads_file[0]} ${reads_file[1]} > ${sample_id}.sam
"""
}
/*
process index {
input:
path transcriptome from params.transcriptome
output:
path 'index' into index_ch
script:
if( params.aligner == 'salmon' )
"""
salmon index --threads $task.cpus -t $transcriptome -i index
"""
else if( params.aligner == 'kalisto' )
"""
mkdir index
kalisto index -i index/transcriptome.idx $transcriptome
"""
else
throw new IllegalArgumentException("Unknown aligner $params.aligner")
}
params.aligner = "kalisto"
*/