annotate nf/subworkflows/ncbi/only_gnomon.nf @ 8:1680e72e27be draft default tip

planemo upload for repository https://github.com/ncbi/egapx commit bdbe05027c2c40e217a2ff0c9e0556450c443e54
author fubar
date Mon, 05 Aug 2024 03:56:41 +0000
parents d9c5c5b87fec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
1 #!/usr/bin/env nextflow
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
2 // gnomon-only nextflow script for EGAPx execution
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
3 // route data to subworkflows
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
4
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
5 nextflow.enable.dsl=2
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
6
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
7 include { setup_genome; setup_proteins } from './setup/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
8 include { get_hmm_params; run_get_hmm } from './default/get_hmm_params/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
9 include { chainer_wnode as chainer } from './gnomon/chainer_wnode/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
10 include { gnomon_wnode } from './gnomon/gnomon_wnode/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
11 include { prot_gnomon_prepare } from './gnomon/prot_gnomon_prepare/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
12 include { annot_builder } from './default/annot_builder/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
13 include { annotwriter } from './default/annotwriter/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
14 include { run_align_sort} from './default/align_sort_sa/main'
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
15
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
16 params.intermediate = false
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
17
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
18 workflow only_gnomon {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
19 take:
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
20 genome // path to genome
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
21 proteins // path to proteins, optional
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
22 // Alternative groups of parameters, one of them should be set
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
23 rnaseq_alignments // path to rnaseq_collapse'ed alignments
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
24 protein_alignments // path to miniprot, filtered, sorted, alignments
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
25
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
26 organelles // path to organelle list
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
27 // Alternative parameters, one of them should be set
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
28 // tax_id - NCBI tax id of the closest taxon to the genome
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
29 // hmm_params - HMM parameters
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
30 tax_id // NCBI tax id of the closest taxon to the genome
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
31 hmm_params // HMM parameters
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
32 hmm_taxid // NCBI tax id of the taxon of the HMM
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
33 //
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
34 softmask // softmask for GNOMON, optional
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
35 task_params // task parameters for every task
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
36 main:
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
37
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
38 def (scaffolds, gencoll_asn, unpacked_genome, genome_asn) = setup_genome(genome, organelles, task_params.get('setup', [:]))
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
39
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
40 // Protein alignments
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
41 def unpacked_proteins
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
42 def proteins_asn = []
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
43 if (proteins) {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
44 // miniprot plane
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
45 (unpacked_proteins, proteins_asn) = setup_proteins(proteins, task_params.get('setup', [:]))
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
46 }
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
47
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
48 // Combine RNASeq and protein alignments
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
49
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
50 def alignments
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
51 if (protein_alignments && rnaseq_alignments) {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
52 print(rnaseq_alignments.getClass())
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
53 print(rnaseq_alignments)
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
54 print(protein_alignments.getClass())
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
55 print(protein_alignments)
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
56 alignments = Channel.of(rnaseq_alignments).combine(Channel.of(protein_alignments))
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
57 } else if (protein_alignments) {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
58 alignments = protein_alignments
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
59 } else if (rnaseq_alignments) {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
60 alignments = rnaseq_alignments
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
61 } else {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
62 print("error")
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
63 }
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
64
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
65 // GNOMON
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
66
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
67 def effective_hmm
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
68 if (hmm_params) {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
69 effective_hmm = hmm_params
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
70 } else {
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
71 tmp_hmm = run_get_hmm(tax_id)
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
72 b = tmp_hmm | splitText( { it.split('\n') } ) | flatten
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
73 c = b | last
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
74 effective_hmm = c
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
75 }
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
76
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
77 chainer(alignments, effective_hmm, /* evidence_denylist */ [], /* gap_fill_allowlist */ [], scaffolds, /* trusted_genes */ [], genome_asn, proteins_asn, task_params.get('chainer', [:]))
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
78
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
79 gnomon_wnode(scaffolds, chainer.out.chains, chainer.out.chains_slices, effective_hmm, [], softmask, genome_asn, proteins_asn, task_params.get('gnomon', [:]))
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
80 def models = gnomon_wnode.out.outputs
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
81
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
82 // prot_gnomon_prepare(models, task_params.get('prot_gnomon_prepare', [:]))
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
83
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
84 // actual gnomon end but whatever
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
85
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
86
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
87 annot_builder(gencoll_asn, models, genome_asn, task_params.get('annot_builder', [:]))
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
88 def accept_asn = annot_builder.out.accept_asn
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
89
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
90 annotwriter(accept_asn, [:])
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
91 annotwriter.out.annoted_file
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
92 emit:
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
93 out_files = annotwriter.out.annoted_file
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
94 evidence = annot_builder.out.outputs
d9c5c5b87fec planemo upload for repository https://github.com/ncbi/egapx commit 8173d01b08d9a91c9ec5f6cb50af346edc8020c4
fubar
parents:
diff changeset
95 }