diff nf/subworkflows/ncbi/gnomon/gnomon_training/main.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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nf/subworkflows/ncbi/gnomon/gnomon_training/main.nf	Sat Aug 03 11:16:53 2024 +0000
@@ -0,0 +1,47 @@
+#!/usr/bin/env nextflow
+nextflow.enable.dsl=2
+
+include { merge_params } from '../../utilities'
+
+workflow gnomon_training {
+    take:
+        genome_asn
+        models_file
+        max_intron1 // max intron length, name modified from max_intron to pacify stupid Nextflow compiler
+        parameters  // Map : extra parameter and parameter update
+    main:
+        default_params = "-b -asn -maxintron 1200000"
+        effective_params = merge_params(default_params, parameters, 'gnomon_training')
+        run_gnomon_training(genome_asn, models_file, max_intron1, effective_params)
+    emit:
+        hmm_params_file = run_gnomon_training.out.hmm_params_file
+}
+
+
+process run_gnomon_training {
+    input:
+        path genome_asn, stageAs: 'indexed/*'
+        path models_file
+        val max_intron1
+        val parameters
+    output:
+        path ('output/hmm_params.asn'), emit: 'hmm_params_file'
+
+    script:
+    // Substitute -maxintron with correct value coming from max_intron
+    def dummy = ["dummy" : "-maxintron ${max_intron1}"]
+    parameters = merge_params(parameters, dummy, "dummy")
+    """
+    mkdir -p output
+    lds2_indexer -source indexed -db ./indexed_lds
+    gnomon_training ${parameters} -nogenbank -lds2 ./indexed_lds  -input ${models_file} -out output/hmm_params.asn 
+    """
+    stub:
+    def dummy = ["dummy" : "-maxintron ${max_intron1}"]
+    parameters = merge_params(parameters, dummy, "dummy")
+    println("Gnomon training parameters: ${parameters}")
+    """
+    mkdir -p output
+    touch  output/hmm_params.asn
+    """
+}