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