Skip to content

Commit

Permalink
Leviosam2 index (nf-core#5316)
Browse files Browse the repository at this point in the history
* first version

* improvments

* whitespaces

* whitespaces

* whitespaces

* prettier

---------

Co-authored-by: zxBIB Grochowalski,Lukasz (GCBDS) EXTERNAL <[email protected]>
  • Loading branch information
2 people authored and Alexander Nater committed Mar 21, 2024
1 parent 5703812 commit 74b91ef
Show file tree
Hide file tree
Showing 6 changed files with 248 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/nf-core/leviosam2/index/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: "leviosam2_index"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::leviosam2=0.4.2"
49 changes: 49 additions & 0 deletions modules/nf-core/leviosam2/index/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process LEVIOSAM2_INDEX {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/leviosam2:0.4.2--h4ac6f70_0':
'biocontainers/leviosam2:0.4.2--h4ac6f70_0' }"

input:
tuple val(meta), path(fai)
path(chain)

output:
tuple val(meta), path("*.clft"), emit: clft
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
leviosam2 \\
index \\
-c ${chain} \\
-p ${prefix} \\
-F ${fai}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
leviosam2: \$(leviosam2 --version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.clft
cat <<-END_VERSIONS > versions.yml
"${task.process}":
leviosam2: \$(leviosam2 --version)
END_VERSIONS
"""
}
45 changes: 45 additions & 0 deletions modules/nf-core/leviosam2/index/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: "leviosam2_index"
description: Index chain files for lift over
keywords:
- leviosam2
- index
- lift
tools:
- "leviosam2":
description: "Fast and accurate coordinate conversion between assemblies"
homepage: "https://github.com/milkschen/leviosam2/blob/main/workflow/README.md"
documentation: "https://github.com/milkschen/leviosam2/blob/main/workflow/README.md"
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'reference' ]`
- fai:
type: file
description: FAI (FASTA index) file of the target reference
pattern: "*.{fai}"
- chain:
type: file
description: Chain file to index.
pattern: "*.{chain}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'reference' ]`
- clft:
type: file
description: Clft file of indexed chain
pattern: "*.{clft}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@lgrochowalski"
maintainers:
- "@lgrochowalski"
75 changes: 75 additions & 0 deletions modules/nf-core/leviosam2/index/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
nextflow_process {

name "Test Process LEVIOSAM2_INDEX"
script "../main.nf"
process "LEVIOSAM2_INDEX"

tag "modules"
tag "modules_nfcore"
tag "leviosam2"
tag "leviosam2/index"
tag "gunzip"

test("index") {
setup {
run("GUNZIP") {
script "../../../gunzip/main.nf"
process {
"""
input[0] = [
[ id:'test' ],
file(params.test_data['homo_sapiens']['genome']['genome_chain_gz'], checkIfExists: true)
]
"""
}

}
}

when {
process {
"""
input[0] = [
[ id:'test' ],
file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
]
input[1] = GUNZIP.out.gunzip.map{ meta, gunzip -> gunzip }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("index - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
]
input[1] = file(params.test_data['homo_sapiens']['genome']['genome_chain_gz'], checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/leviosam2/index/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions modules/nf-core/leviosam2/index/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
leviosam2/index:
- "modules/nf-core/leviosam2/index/**"
- "modules/nf-core/gunzip/**"

0 comments on commit 74b91ef

Please sign in to comment.