-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAeaeg-subsample.nf
53 lines (37 loc) · 1.15 KB
/
Aeaeg-subsample.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
#!/usr/bin/env nextflow
// Params from config files (system-dependent)
input=params.input
output=params.output
work=params.work
aux=params.aux
huge=params.huge
big=params.big
small=params.small
// Global Params
params.dir = null
if( !params.dir ) error "Missing dir parameter"
println "dir: $params.dir"
params.rlen = null
if( !params.rlen ) error "Missing length (average read length) parameter"
println "rlen: $params.rlen"
////////////////////////////////////////////////
// ** - Pull in fq files
////////////////////////////////////////////////
Channel.fromFilePairs(input + "/${params.dir}/*_R{1,2}_001.f[a-z]*q.gz", flat: true)
.set { fqs }
////////////////////////////////////////////////
// ** - Subsample reads
////////////////////////////////////////////////
process sample_reads {
publishDir "${output}/${params.dir}_sub", mode: 'copy'
cpus small
tag { id }
input:
tuple val(id), file(forward), file(reverse) from fqs
output:
tuple id, file("${id}_R1.fq.gz"), file("${id}_R2.fq.gz") into subsampled_fqs
"""
seqtk sample -s 10 $forward 10000 > ${id}_R1.fq.gz
seqtk sample -s 10 $reverse 10000 > ${id}_R2.fq.gz
"""
}