// Import generic module functions include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions' params.options = [:] options = initOptions(params.options) process HICAP { tag "$meta.id" label 'process_low' publishDir "${params.outdir}", mode: params.publish_dir_mode, saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) } conda (params.enable_conda ? "bioconda::hicap=1.0.3" : null) if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "https://depot.galaxyproject.org/singularity/hicap:1.0.3--py_0" } else { container "quay.io/biocontainers/hicap:1.0.3--py_0" } input: tuple val(meta), path(fasta) path database_dir path model_fp output: tuple val(meta), path("*.gbk"), emit: gbk, optional: true tuple val(meta), path("*.svg"), emit: svg, optional: true tuple val(meta), path("*.tsv"), emit: tsv, optional: true path "versions.yml" , emit: versions script: def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def database_args = database_dir ? "--database_dir ${database_dir}" : "" def model_args = model_fp ? "--model_fp ${model_fp}" : "" def is_compressed = fasta.getName().endsWith(".gz") ? true : false def fasta_name = fasta.getName().replace(".gz", "") """ if [ "$is_compressed" == "true" ]; then gzip -c -d $fasta > $fasta_name fi hicap \\ --query_fp $fasta_name \\ $database_args \\ $model_args \\ $options.args \\ --threads $task.cpus \\ -o ./ cat <<-END_VERSIONS > versions.yml ${getProcessName(task.process)}: ${getSoftwareName(task.process)}: \$( echo \$( hicap --version 2>&1 ) | sed 's/^.*hicap //' ) END_VERSIONS """ }