-
Notifications
You must be signed in to change notification settings - Fork 0
/
annotate_reference_contigs.nf
73 lines (62 loc) · 1.91 KB
/
annotate_reference_contigs.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
#!/usr/bin/env nextflow
// vim: syntax=groovy expandtab
/****************************************
* Annotate reference contigs using TIGRFAM
* Copyright (c) Authors 2017
* Authors:
* Fredrik Boulund <[email protected]>
* Luisa Hugerth <[email protected]>
****************************************/
Channel
.fromPath(params.input_contigs)
.ifEmpty{ exit 1, "Found no input contigs, did you specify --input_contigs? I got: '${params.input_contigs}'"}
.set {input_contigs_mgm}
/****************************************
* TIGRFAMs
****************************************/
process orf_prediction {
tag {file_id}
publishDir "${params.outdir}/metagenemark", mode: 'copy'
input:
file(contigs) from input_contigs_mgm
output:
set file_id, file("${file_id}.predicted_proteins.fasta") into input_proteins_tigrfam
file "${file_id}.predicted_nucleotides.fasta"
file "${file_id}.gmhmmp.lst"
script:
file_id = contigs.baseName
"""
gmhmmp \
-r \
-m ${params.mgm_model} \
-o ${file_id}.gmhmmp.lst \
-A ${file_id}.predicted_proteins.fasta \
-D ${file_id}.predicted_nucleotides.fasta \
${contigs}
"""
}
process hmmsearch_tigrfam {
tag {file_id}
publishDir "${params.outdir}/hmmsearch_tigrfam", mode: 'copy'
input:
set file_id, file(proteins) from input_proteins_tigrfam
output:
file "${file_id}.tbl.txt"
file "${file_id}.hmmsearch.stdout"
file "${file_id}.tigrfam_counts.tsv"
script:
"""
hmmsearch \
--cpu ${task.cpus} \
--seed 1337 \
--tblout ${file_id}.tbl.txt \
${params.tigrfams_lib} \
${proteins} \
> ${file_id}.hmmsearch.stdout \
&& \
count_tigrfam_annotations.py \
--tbl ${file_id}.tbl.txt \
--cutoffs ${params.tigrfam_cutoffs} \
--output ${file_id}.tigrfam_counts.tsv
"""
}