Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions modules/nf-core/paraphrase/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- conda-forge::pip==26.0.1
- conda-forge::python=3.14.3
- pip:
- paraphrase==0.2.0
48 changes: 48 additions & 0 deletions modules/nf-core/paraphrase/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
process PARAPHRASE {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/bc/bc177b8e7e1d9bbdcbb64a6ad630c7ecc63a2229ce2b219408888bc2bb34cac3/data':
'community.wave.seqera.io/library/pip_paraphrase:59a4576966ee5f0b' }"

input:
tuple val(meta), path(jsons), val(samples)
tuple val(meta2), path(yaml)
val(tsv_output)

output:
tuple val(meta), path("*.json"), emit: json, optional: true
tuple val(meta), path("*.tsv"), emit: tsv, optional: true

tuple val("${task.process}"), val('paraphrase'), eval("paraphrase --version"), topic: versions, emit: versions_paraphrase

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def rules = yaml ? "--rules $yaml" : ''
def output_format = tsv_output ? 'tsv' : 'json'
"""
paraphrase \
$args \
--input ${jsons.join(' --input ')} \
--sample ${samples.join(' --sample ')} \
--output-format=${output_format} \
$rules \
> ${prefix}.${output_format}
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def output_format = tsv_output ? 'tsv' : 'json'
"""
echo $args

touch ${prefix}.${output_format}
"""
}
87 changes: 87 additions & 0 deletions modules/nf-core/paraphrase/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "paraphrase"
description: Parse and annotate paraphrase JSONs
keywords:
- long-read
- paraphrase
- annotate
tools:
- "paraphrase":
description: "Paraphase JSON parser"
homepage: "https://github.com/Clinical-Genomics/paraphrase"
documentation: "https://github.com/Clinical-Genomics/paraphrase/README.md"
tool_dev_url: "https://github.com/Clinical-Genomics/paraphrase"
licence: ["MIT"]

input:
- - meta:
type: map
description: Groovy Map containing sample information. e.g. `[ id:'sample1']`
- jsons:
type: file
description: "One or more JSON files from paraphase"
pattern: "*.json"
ontologies:
- edam: http://edamontology.org/format_3464 # JSON
- samples:
type: list
description: "Sample names corresponding to the JSON files. Must be in the same order as the JSON files."
- - meta2:
type: map
description: Groovy Map containing reference information.
- yaml:
type: file
description: "YAML file containing rules for annotation"
pattern: "*.yaml"
ontologies:
- edam: http://edamontology.org/format_3473 # YAML
- tsv_output:
type: boolean
description: "Whether to output in TSV format instead of JSON. Default is false (JSON output)."

output:
json:
- - meta:
type: map
description: Groovy Map containing sample information. e.g. `[ id:'sample1']`
- "*.json":
type: file
description: "Annotated output in JSON format"
pattern: "*.json"
ontologies:
- edam: http://edamontology.org/format_3464 # JSON
tsv:
- - meta:
type: map
description: Groovy Map containing sample information. e.g. `[ id:'sample1']`
- "*.tsv":
type: file
description: "Annotated output in TSV format"
pattern: "*.tsv"
ontologies:
- edam: http://edamontology.org/format_3475 # TSV
versions_paraphrase:
- - ${task.process}:
type: string
description: The name of the process
- paraphrase:
type: string
description: The name of the tool
- paraphrase --version:
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- paraphrase:
type: string
description: The name of the tool
- paraphrase --version:
type: eval
description: The expression to obtain the version of the tool
authors:
- "@fellen31"
maintainers:
- "@fellen31"
123 changes: 123 additions & 0 deletions modules/nf-core/paraphrase/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
nextflow_process {

name "Test Process PARAPHRASE"
script "../main.nf"
process "PARAPHRASE"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "tabix/bgzip"
tag "paraphase"
tag "paraphrase"

setup {
run("TABIX_BGZIP") {
script "../../tabix/bgzip/main.nf"
process {
"""
input[0] = [
[ id:'test_ref' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr22_chr22_KI270734v1_random/sequence/genome.fa.gz', checkIfExists: true),
]
"""
}
}
run("PARAPHASE") {
script "../../paraphase/main.nf"
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test.sorted.bam.bai', checkIfExists: true),
]
input[1] = TABIX_BGZIP.out.output
input[2] = [
[:],
[]
]
"""
}
}
}

test("no rules") {
Comment thread
fellen31 marked this conversation as resolved.
Outdated

when {
params {
module_args = '--gene PRODH'
}
process {
"""
input[0] = PARAPHASE.out.json.map { meta, json -> [meta, json, meta.id] }
input[1] = [[],[]]
input[2] = false
"""
}
}

then {
assert process.success
assertAll(
{ assert snapshot(process.out).match() }
Comment thread
fellen31 marked this conversation as resolved.
Outdated
)
}

}

test("rules") {
Comment thread
fellen31 marked this conversation as resolved.
Outdated

when {
params {
module_args = '--gene PRODH'
}
process {
"""
input[0] = PARAPHASE.out.json.map { meta, json -> [meta, json, meta.id] }
input[1] = [
[ id:'rules' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/yaml/rules.yaml', checkIfExists: true)
]
input[2] = false
"""
}
}

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

}

test("rules - tsv output") {
Comment thread
fellen31 marked this conversation as resolved.
Outdated

when {
params {
module_args = '--gene PRODH'
}
process {
"""
input[0] = PARAPHASE.out.json.map { meta, json -> [meta, json, meta.id] }
input[1] = [
[ id:'rules' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/yaml/rules.yaml', checkIfExists: true)
]
input[2] = true
"""
}
}

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

}

Comment thread
fellen31 marked this conversation as resolved.
}
Loading