diff --git a/modules/nf-core/hicexplorer/hicpca/main.nf b/modules/nf-core/hicexplorer/hicpca/main.nf new file mode 100644 index 00000000000..6e0477c36da --- /dev/null +++ b/modules/nf-core/hicexplorer/hicpca/main.nf @@ -0,0 +1,56 @@ +process HICEXPLORER_HICPCA { + tag "$meta.id" + label 'process_medium' + + conda "bioconda::hicexplorer=3.7.2 numpy=1.23.5" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hicexplorer:3.7.2--pyhdfd78af_1': + 'biocontainers/hicexplorer:3.7.2--pyhdfd78af_1' }" + + input: + tuple val(meta), path(matrix) + + output: + tuple val(meta), path("${prefix}_*") , emit:results + tuple val(meta), path("${prefix}_pca1.$format"), emit:pca1 + tuple val(meta), path("${prefix}_pca2.$format"), emit:pca2 + path("versions.yml") , emit:versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + args = args.tokenize() + def idx = args.findIndexOf{ it == '--format' | it == '-f' } + format = 'bigwig' + if (idx>=0) { + format = args[idx+1] + args.remove(idx+1) + args.remove(idx) + } + idx = args.indexOf('--whichEigenvectors') + eigenvectors = '1 2' + if(idx>=0) { + eigenvectors = args[idx + 1] + args.remove(idx+1) + args.remove(idx) + } + outfilenames = eigenvectors.tokenize() + .collect{"${prefix}_pca${it}.${format}"}.join(' ') + args = args.join(' ') + """ + hicPCA \\ + -m $matrix \\ + $args \\ + --format $format \\ + --whichEigenvectors $eigenvectors \\ + --outputFileName $outfilenames + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hicexplorer: \$(hicPCA --version 2>&1 | sed 's/hicPCA //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/hicexplorer/hicpca/meta.yml b/modules/nf-core/hicexplorer/hicpca/meta.yml new file mode 100644 index 00000000000..a796b570de2 --- /dev/null +++ b/modules/nf-core/hicexplorer/hicpca/meta.yml @@ -0,0 +1,47 @@ +name: "hicexplorer_hicpca" +description: Computes PCA eigenvectors for a Hi-C matrix. +keywords: + - eigenvectors + - PCA + - hicPCA +tools: + - "hicexplorer": + description: "Set of programs to process, analyze and visualize Hi-C and capture Hi-C data" + homepage: "https://hicexplorer.readthedocs.io" + documentation: "https://hicexplorer.readthedocs.io" + tool_dev_url: "https://github.com/deeptools/HiCExplorer" + doi: "10.1038/s41467-017-02525-w" + licence: "['GPL v3']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', bin:50000 ] + - matrix: + type: file + description: HiCExplorer matrix in h5 format + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', bin:50000 ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - results: + type: file + description: Outputs of hicPCA + - pca1: + type: file + description: PCA1 file + - pca2: + type: file + description: PCA2 file + +authors: + - "@jianhong" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 05ef422c91d..c9a870d826e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1550,6 +1550,10 @@ hicap: - modules/nf-core/hicap/** - tests/modules/nf-core/hicap/** +hicexplorer/hicpca: + - modules/nf-core/hicexplorer/hicpca/** + - tests/modules/nf-core/hicexplorer/hicpca/** + hifiasm: - modules/nf-core/hifiasm/** - tests/modules/nf-core/hifiasm/** diff --git a/tests/modules/nf-core/hicexplorer/hicpca/main.nf b/tests/modules/nf-core/hicexplorer/hicpca/main.nf new file mode 100644 index 00000000000..1e9d6d6244e --- /dev/null +++ b/tests/modules/nf-core/hicexplorer/hicpca/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { HICEXPLORER_HICPCA } from '../../../../../modules/nf-core/hicexplorer/hicpca/main.nf' + +workflow test_hicexplorer_hicpca { + + input = [ + [ id:'test' ], // meta map + file('https://github.com/deeptools/HiCExplorer/raw/master/hicexplorer/test/test_data/hicPCA/mm9_reduced_chr1.cool', checkIfExists: true) + ] + + HICEXPLORER_HICPCA ( input ) +} diff --git a/tests/modules/nf-core/hicexplorer/hicpca/nextflow.config b/tests/modules/nf-core/hicexplorer/hicpca/nextflow.config new file mode 100644 index 00000000000..50f50a7a357 --- /dev/null +++ b/tests/modules/nf-core/hicexplorer/hicpca/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/nf-core/hicexplorer/hicpca/test.yml b/tests/modules/nf-core/hicexplorer/hicpca/test.yml new file mode 100644 index 00000000000..29440747392 --- /dev/null +++ b/tests/modules/nf-core/hicexplorer/hicpca/test.yml @@ -0,0 +1,11 @@ +- name: hicexplorer hicpca test_hicexplorer_hicpca + command: nextflow run ./tests/modules/nf-core/hicexplorer/hicpca -entry test_hicexplorer_hicpca -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/hicexplorer/hicpca/nextflow.config + tags: + - hicexplorer + - hicexplorer/hicpca + files: + - path: output/hicexplorer/test_pca1.bigwig + md5sum: e228fde481bedea641bcd0204bb663a4 + - path: output/hicexplorer/test_pca2.bigwig + md5sum: 109c0d3cc70ecaf3647f3293504a9683 + - path: output/hicexplorer/versions.yml