Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hicexplorer hicpca #2933

Merged
merged 6 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions modules/nf-core/hicexplorer/hicpca/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
47 changes: 47 additions & 0 deletions modules/nf-core/hicexplorer/hicpca/meta.yml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**
Expand Down
15 changes: 15 additions & 0 deletions tests/modules/nf-core/hicexplorer/hicpca/main.nf
Original file line number Diff line number Diff line change
@@ -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 )
}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/hicexplorer/hicpca/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

}
11 changes: 11 additions & 0 deletions tests/modules/nf-core/hicexplorer/hicpca/test.yml
Original file line number Diff line number Diff line change
@@ -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