Skip to content
New issue

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

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

Already on GitHub? # to your account

Module phylowgs parser #48

Merged
merged 16 commits into from
Mar 11, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches: [main]
pull_request:
branches: [main, develop]
branches: [main, develop, neoantigen]
merge_group:
types: [checks_requested]
branches: [main]
Expand Down Expand Up @@ -286,6 +286,8 @@ jobs:
tags: snppileup
- profile: "conda"
tags: mutect1
- profile: "conda"
tags: phylowgsparsecnvs
env:
NXF_ANSI_LOG: false
SENTIEON_LICENSE_BASE64: ${{ secrets.SENTIEON_LICENSE_BASE64 }}
Expand Down
9 changes: 9 additions & 0 deletions modules/msk/phylowgsparsecnvs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "phylowgsparsecnvs"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "PHYLOWGS"
46 changes: 46 additions & 0 deletions modules/msk/phylowgsparsecnvs/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
process PHYLOWGSPARSECNVS {
tag "$meta.id"
label 'process_low'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'docker://mskcc/phylowgs:v1.4-msk':
'docker.io/mskcc/phylowgs:v1.4-msk' }"

input:
tuple val(meta), path(facetsgenelevel)

output:
tuple val(meta), path("cnvs.txt"), emit: cnv
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}"

"""
python2 \\
/usr/bin/parser/parse_cnvs.py \\
${args} \\
${facetsgenelevel}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
phylowgsparsecnvs: \$PHYLOWGS_TAG
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch cnvs.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
phylowgsparsecnvs: \$PHYLOWGS_TAG
END_VERSIONS
"""
}
49 changes: 49 additions & 0 deletions modules/msk/phylowgsparsecnvs/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "phylowgsparsecnvs"
description: parse cnvs from FACETS for input to phylowgs
keywords:
- phylowgs
- CNVs
- FACETs
tools:
- "phylowgsparsecnvs":
description: "parser to convert FACETs output to phylowgs expected input"
homepage: "https://genomebiology.biomedcentral.com/articles/10.1186/s13059-015-0602-8"
tool_dev_url: "https://github.com/mskcc/phylowgs"

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- facetsgenelevel:
type: file
description: single sample facets gene level output
pattern: "*.{txt}"

## TODO nf-core: Add a description of all of the variables used as output
output:
#Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
## TODO nf-core: Delete / customise this example output
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"

authors:
- "@pintoa1-mskcc"
maintainers:
- "@pintoa1-mskcc"
37 changes: 37 additions & 0 deletions modules/msk/phylowgsparsecnvs/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "modules_msk"
tag "phylowgsparsecnvs"

test("phylowgsparsecnvs - txt") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data_mskcc['neoantigen']['facets_gene_level_txt'], checkIfExists: true)
]
"""
}
}

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

)
}

}


}
37 changes: 37 additions & 0 deletions modules/msk/phylowgsparsecnvs/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"phylowgsparsecnvs - txt": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"cnvs.txt:md5,a2073057a3fe3ffa83ae3c6a6f00d4ab"
]
],
"1": [
"versions.yml:md5,59b3e223572b67b72eb21c625003973d"
],
"cnv": [
[
{
"id": "test",
"single_end": false
},
"cnvs.txt:md5,a2073057a3fe3ffa83ae3c6a6f00d4ab"
]
],
"versions": [
"versions.yml:md5,59b3e223572b67b72eb21c625003973d"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-03-06T14:35:27.270866"
}
}
10 changes: 10 additions & 0 deletions modules/msk/phylowgsparsecnvs/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
params {
enable_conda = false
}

process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: 'PHYLOWGSPARSECNVS' {
ext.args = '-c 0 -f facets'
}
}
2 changes: 2 additions & 0 deletions modules/msk/phylowgsparsecnvs/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
phylowgsparsecnvs:
- "modules/msk/phylowgsparsecnvs/**"
3 changes: 3 additions & 0 deletions tests/config/test_data.config
Original file line number Diff line number Diff line change
Expand Up @@ -723,5 +723,8 @@ params {
dbsnp_138_b37_chr17_vcf_gz = "${params.test_data_base_msk}/hg37/genomic_reference/GRCH37/vcf/dbsnp_138.b37.chr17.vcf.gz"
dbsnp_138_b37_chr17_vcf_gz_tbi = "${params.test_data_base_msk}/hg37/genomic_reference/GRCH37/vcf/dbsnp_138.b37.chr17.vcf.gz.tbi"
}
'neoantigen' {
facets_gene_level_txt = "${params.test_data_base_msk}/neoantigen/neoantigen/facets_gene_level.txt"
}
}
}
Loading