view nf/subworkflows/ncbi/target_proteins/paf2asn/main.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
line wrap: on
line source

#!/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}
    """
}