Skip to content
Closed
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
27 changes: 27 additions & 0 deletions UMCUGenetics/pgscatalog/combine/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
process PGSCATALOG_COMBINE {
tag "${meta.id}"

container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
? 'https://depot.galaxyproject.org/singularity/pgscatalog-utils:1.4.4--pyhdfd78af_0'
: 'biocontainers/pgscatalog-utils:1.4.4--pyhdfd78af_0'}"

input:
tuple val(meta), path(scoring_file)
val assembly_version

output:
tuple val(meta), path("*_normalised.txt.gz"), emit: normalised_model
path "versions.yml", emit: versions

script:
def prefix = task.ext.prefix ?: meta.id
"""
pgscatalog-combine \\
-s ${scoring_file} \\
-t ${assembly_version} \\
-o ${prefix}_normalised.txt.gz


echo "pgscatalog-combine: 1.4.4" > versions.yml
"""
}
27 changes: 27 additions & 0 deletions UMCUGenetics/pgscatalog/combine/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
nextflow_process {
name "Test Process PGScatalog-combine"
script "../main.nf"
process "PGSCATALOG_COMBINE"

tag "modules/local"


test("Test Correct model formatting "){
when{
process{
"""
input[0] = [[id: 'model'],
file("${projectDir}/assets/models/BCAC_313_PRS_GRCh38.txt",
checkifExists: true)]
input[1] = channel.value("GRCh38")
"""
}

then {
assertAll(
{assert process.success},
)
}
}
}
}
42 changes: 42 additions & 0 deletions UMCUGenetics/pgscatalog/match/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
process PGSCATALOG_MATCH {
tag "${meta.id}"

container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
? 'https://depot.galaxyproject.org/singularity/pgscatalog-utils:1.4.4--pyhdfd78af_0'
: 'biocontainers/pgscatalog-utils:1.4.4--pyhdfd78af_0'}"

input:
tuple val(meta), path(pvar)
tuple val(meta2), path(scoring_file)


output:
tuple val(meta), path("*_summary.csv"), emit: summary
tuple val(meta), path("*.scorefile.gz"), emit: scorefile
tuple val(meta), path("*_log.csv.gz"), emit: log
path "versions.yml", emit: versions

script:
def prefix = task.ext.prefix ?: meta.id
def args = task.ext.args ?: ""
"""
pgscatalog-match \\
${args} \\
--dataset ${prefix} \\
--scorefiles ${scoring_file} \\
--target ${pvar} \\
--outdir ./

echo "pgscatalog-match: 1.4.4" > versions.yml
"""

stub:
def prefix = task.ext.prefix ?: "Cohort"
"""
touch ${prefix}_summary.csv
touch ${prefix}.scorefile.gz
touch ${prefix}_log.csv.gz

echo "pgscatalog-match: 1.4.4" > versions.yml
"""
}
58 changes: 58 additions & 0 deletions UMCUGenetics/pgscatalog/match/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
nextflow_process {
name "Test Process PGScatalog-match"
script "../main.nf"
process "PGSCATALOG_MATCH"



tag "modules/local"

test("Test SNV ambiguity detection"){
setup{
run("PLINK2_VCF") {
script "../../../../nf-core/plink2/vcf/main.nf"

process{
"""
input[0] = [[id: "vcf"], file("${projectDir}/assets/test-data/test.vcf",checkIfExists: true)]
"""
}
}
}

when {
process {
"""
input[0] = [[id: "model"],
file(
"${projectDir}/assets/test-data/norm_test_model_subworkflow.txt.gz",
checkIfExists: true)]
input[1] = PLINK2_VCF.out.pvar_zst

"""
}
}
then {
// Analysing the csv is necessary as the snapshots do not always match
// (row order differs)
def csv = path(process.out.summary[0][1]).csv().table
def matched = csv.stringColumn("match_status").isEqualTo("matched")

def n_ambiguous_SNV = csv.where(
csv.booleanColumn("ambiguous").isTrue().and(matched)
).row(0).getInt("count")

def n_unambiguous_SNV = csv.where(
csv.booleanColumn("ambiguous").isFalse().and(matched)
).row(0).getInt("count")

assertAll (
{assert process.success},
{assert n_ambiguous_SNV == 1},
{assert n_unambiguous_SNV == 3}
)
}


}
}