-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.nf
65 lines (53 loc) · 1.95 KB
/
main.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
nextflow.enable.dsl=2
include { assembleGenome } from './modules/assembly.nf'
include { evaluateChromosome } from './modules/evaluation.nf'
include { validateParams } from './assemble.nf'
include { getCondaEnv } from './commons.nf'
// parameter validation
validateParams()
// processes and workflows
process findReadyToEvaluate {
conda "${getCondaEnv(params.mainEnv)}"
input:
path assemblyFa
output:
path 'assembly_for_eval.fa', optional: true, emit: ready
path 'assembly_not_for_eval.fa', optional: true, emit: notReady
script:
"""
numberOfContigs=`number_of_contigs.py $assemblyFa`
if [[ ! \$numberOfContigs =~ ^[0-9]+\$ ]]; then
echo "Error in number_of_contigs.py:"
echo \$numberOfContigs
exit 1
fi
if [[ \$numberOfContigs == 1 ]]; then
ln -s $assemblyFa assembly_for_eval.fa
else
ln -s $assemblyFa assembly_not_for_eval.fa
fi
"""
}
process handleNotReadyAssembly {
input:
path notReadyAssembly
exec:
log.info """
Assembly contains multiple contigs. Assembly evaluation will not be carried out.
Decide how you want to split the contigs and perform evaluation manually using evaluateChromosome.nf and evaluatePlasmid.nf.
"""
}
workflow {
rawIllumina1Fq = file(params.illumina1)
rawIllumina2Fq = file(params.illumina2)
rawLongReadsFq = file(params.pacbio == null ? params.nanopore : params.pacbio)
longReadType = params.pacbio == null ? LongRead.NANOPORE : LongRead.PACBIO
assembleGenome(rawIllumina1Fq, rawIllumina2Fq, rawLongReadsFq, longReadType)
findReadyToEvaluate(assembleGenome.out.assembly)
evaluateChromosome('evaluation',
findReadyToEvaluate.out.ready,
assembleGenome.out.cleanedShortReads1,
assembleGenome.out.cleanedShortReads2,
assembleGenome.out.cleanedLongReads)
handleNotReadyAssembly(findReadyToEvaluate.out.notReady)
}