diff nf/subworkflows/ncbi/target_proteins/paf2asn/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/target_proteins/paf2asn/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 paf2asn {
+    take:
+        genome_asn_file   //path: genome asn file
+        proteins_asn_file //path: protein asn file
+        paf_file          //path: paf alignment file from miniprot
+        parameters        // Map : extra parameter and parameter update
+    main:
+        default_params = ""
+        effective_params = merge_params(default_params, parameters, 'paf2asn')
+        run_paf2asn(genome_asn_file, proteins_asn_file, paf_file, effective_params)
+
+    emit:
+        asn_file = run_paf2asn.out.asn_file
+}
+
+
+process run_paf2asn {
+    label 'long_job'
+    input:
+        path genome,  stageAs: 'LDS_Index/genome.asnt'
+        path proteins,  stageAs: 'LDS_Index/proteins.asnt'
+        path paf_file  // list of PAF files to convert
+        val parameters
+    output:
+        path 'output/*.asn', emit: 'asn_file'
+    script:
+        def asn_name = paf_file.baseName.toString() + ".asn"    
+    """
+    mkdir -p output
+    lds2_indexer -source LDS_Index
+    echo "${paf_file.join('\n')}" > input.mft
+    paf2asn ${parameters}  -lds2 LDS_Index/lds2.db  -nogenbank -input-manifest input.mft -o output/${asn_name}
+    """
+    stub:
+        def asn_name = paf_file.baseName.toString() + ".asn"    
+    """
+    mkdir -p output
+    touch output/${asn_name}
+    """
+}