Newer
Older
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
version = "2.17"
container_url = "lbmc/minimap2:${version}"
params.index_fasta = ""
params.index_fasta_out = ""
process index_fasta {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.index_fasta_out != "") {
publishDir "results/${params.index_fasta_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fasta)
output:
tuple val(file_id), path("${fasta}"), path("*.mmi*"), emit: index
script:
memory = "${task.memory}" - ~/\s*GB/
"""
minimap2 ${params.index_fasta} -t ${task.cpus} -I ${memory}G -d ${fasta.baseName}.mmi ${fasta}
"""
}
params.mapping_fastq = "-ax sr"
params.mapping_fastq_out = ""
process mapping_fastq {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.mapping_fastq_out != "") {
publishDir "results/${params.mapping_fastq_out}", mode: 'copy'
}
input:
tuple val(fasta_id), path(fasta), path(index)
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*.bam"), emit: bam
script:
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
memory = "${task.memory}" - ~/\s*GB/
memory = memory.toInteger() / (task.cpus + 1.0)
if (reads.size() == 2)
"""
minimap2 ${params.mapping_fastq} -t ${task.cpus} -K ${memory} ${fasta} ${reads[0]} ${reads[1]} |
samtools view -Sb - > ${pair_id}.bam
"""
else
"""
minimap2 ${params.mapping_fastq} -t ${task.cpus} -K ${memory} ${fasta} ${reads} |
samtools view -Sb - > ${pair_id}.bam
"""
}
params.mapping_hbv_transcriptome = "-ax map-ont"
process hbv_transcriptome {
container = "${container_url}"
label "big_mem_multi_cpus"
if (params.minimap2_transcriptome_out != "") {
publishDir "results/${params.minimap2_transcriptome_out}", mode: 'copy'
}
input:
path(fastq)
path(transcriptome)
output:
path("*"), emit: bam
script:
memory = "${task.memory}" - ~/\s*GB/
memory = memory.toInteger() / (task.cpus + 1.0)
"""
minimap2 ${params.mapping_hbv_transcriptome} -t ${task.cpus} -K ${memory} ${transcriptome} ${fastq} |
samtools view -Shb - > res.bam
"""
}
params.mapping_hbv_genome = "-ax splice --secondary=no -u n --splice-flank=no --eqx"
process hbv_genome {
container = "${container_url}"
label "big_mem_multi_cpus"
if (params.minimap2_genome_out != "") {
publishDir "results/${params.minimap2_genome_out}", mode: 'copy'
}
input:
tuple val(barcode), path("${barcode}/${barcode}_res.bam"), emit: bam
script:
memory = "${task.memory}" - ~/\s*GB/
memory = memory.toInteger() / (task.cpus + 1.0)
"""
mkdir ${barcode}
cd ${barcode}/
minimap2 ${params.mapping_hbv_genome} -t ${task.cpus} -K ${memory} ../${genome} ../${fastq} |
samtools view -Shb - > ${barcode}_res.bam