-
Notifications
You must be signed in to change notification settings - Fork 0
/
bsNameChange.nf
81 lines (61 loc) · 1.54 KB
/
bsNameChange.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
/*
nextflow run test.nf --expName Twist-PG-plexing --expDir capture --biosample $(echo PC-OM-GM-4P-{1..4} PC-OM-GM-8P-{1..8} PC-OM-GM-2P-{1..2}|tr ' ' ,)
*/
params.expDir = 'capture'
params.expName = 'tmp'
params.bpProject = 'Capture'
params.biosample = false
params.bamDir = false
params.validPairsDir = false
params.fastqDir = false
params.genome = 'hg38'
params.noPairTools = false
params.noJuicer = false
params.noCooler = false
params.noCoverage = false
Channel
.from(params.biosample)
.splitCsv()
.flatten()
.set { biosample_ch }
process get_bs_files {
cpus 1
memory '1G'
container 'mblanche/basespace-cli'
input:
val bs from biosample_ch.first()
output:
stdout into bs_id_ch
script:
"""
bs biosample content -n ${bs} -F Id -F FilePath -f csv | \
awk 'BEGIN{OFS =","} \
NR == 1 {print "biosample", \$0} \
NR > 1 {print "${bs}", \$0}'
"""
}
process get_bs_dataset {
echo true
label 'movers'
cpus 4
memory '2G'
container 'mblanche/basespace-cli'
publishDir "${HOME}/ebs/ref_push/${params.expDir}/${params.expName}/fastqs",
mode: 'copy'
input:
tuple bs, id, filePath from bs_id_ch
.splitCsv(header: true)
.map {row -> tuple(row.biosample,row.Id,row.FilePath) }
output:
path "*.fastq.gz" into fastq_ch
script:
"""
bs file download -i ${id} -o .
new_fq=\$(echo ${filePath}| perl -pe 's/.+?(_.+)/${bs}\$1/')
if [[ ${filePath} != \$new_fq ]]
then
mv ${filePath} \$new_fq
fi
"""
}
fastq_ch.view()