-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
366 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- "bioconda::trgt=1.2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
process TRGT_PLOT { | ||
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/trgt:1.2.0--h9ee0642_0': | ||
'biocontainers/trgt:1.2.0--h9ee0642_0' }" | ||
|
||
input: | ||
tuple val(meta) , path(bam), path(bai), path(vcf), path(tbi), val(repeat_id) | ||
tuple val(meta2), path(fasta) | ||
tuple val(meta3), path(fai) | ||
tuple val(meta4), path(repeats) | ||
|
||
output: | ||
tuple val(meta), path("*.{png,pdf,svg}"), emit: plot | ||
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}_${repeat_id}" | ||
// If user didn't specify an output path, plot to PNG | ||
def output_arg = args.contains("--image") || args.contains("-o") ? "" : "--image ${prefix}.png" | ||
|
||
""" | ||
trgt plot \\ | ||
$args \\ | ||
--genome ${fasta} \\ | ||
--repeats ${repeats} \\ | ||
--spanning-reads ${bam} \\ | ||
--vcf ${vcf} \\ | ||
--repeat-id ${repeat_id} \\ | ||
$output_arg | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
trgt: \$(trgt --version |& sed '1!d ; s/trgt //') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
touch ${prefix}.png | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
trgt: \$(trgt --version |& sed '1!d ; s/trgt //') | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
name: "trgt_plot" | ||
description: Visualize tandem repeats genotyped by TRGT | ||
keywords: | ||
- trgt | ||
- repeat expansion | ||
- plotting | ||
- pacbio | ||
- genomics | ||
tools: | ||
- "trgt": | ||
description: "Tandem repeat genotyping and visualization from PacBio HiFi data" | ||
homepage: "https://github.com/PacificBiosciences/trgt" | ||
documentation: "https://github.com/PacificBiosciences/trgt/blob/main/docs/tutorial.md" | ||
tool_dev_url: "https://github.com/PacificBiosciences/trgt" | ||
doi: "10.1038/s41587-023-02057-3" | ||
licence: | ||
["Pacific Biosciences Software License (https://github.com/PacificBiosciences/trgt/blob/main/LICENSE.md)"] | ||
|
||
input: | ||
- - meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- bam: | ||
type: file | ||
description: "Sorted reads spanning tandem repeat from TRGT output" | ||
pattern: "*.bam" | ||
- bai: | ||
type: file | ||
description: "Index for reads" | ||
pattern: "*.bai" | ||
- vcf: | ||
type: file | ||
description: "Sorted tandem repeat genotypes called by TRGT" | ||
pattern: "*.vcf.gz" | ||
- tbi: | ||
type: file | ||
description: "Index for genotypes" | ||
pattern: "*.{tbi,csi}" | ||
- repeat_id: | ||
type: string | ||
description: "ID of tandem repeat to plot" | ||
- - meta2: | ||
type: map | ||
description: | | ||
Groovy map containing reference information | ||
e.g. `[ id: 'genome' ]` | ||
- fasta: | ||
type: file | ||
description: "FASTA reference file" | ||
pattern: "*.{fasta,fa,fna}" | ||
- - meta3: | ||
type: map | ||
description: | | ||
Groovy map containing reference information | ||
e.g. `[ id: 'genome' ]` | ||
- fai: | ||
type: file | ||
description: "Index for FASTA file" | ||
pattern: "*.fai" | ||
- - meta4: | ||
type: map | ||
description: | | ||
Groovy map containing repeat information | ||
e.g. `[ id: 'repeats' ]` | ||
- repeats: | ||
type: file | ||
description: "BED file with repeat coordinates and structure" | ||
pattern: "*.bed" | ||
|
||
output: | ||
- plot: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- "*.{png,pdf,svg}": | ||
type: file | ||
description: "Plot of region and reads spanning tandem repeat" | ||
pattern: "*.{png,pdf,svg}" | ||
- versions: | ||
- "versions.yml": | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
authors: | ||
- "@Schmytzi" | ||
maintainers: | ||
- "@Schmytzi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
// nf-core modules test trgt/plot | ||
nextflow_process { | ||
|
||
name "Test Process TRGT_PLOT" | ||
script "../main.nf" | ||
process "TRGT_PLOT" | ||
config "./nextflow.config" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "trgt" | ||
tag "trgt/plot" | ||
tag "trgt/genotype" | ||
tag "samtools/faidx" | ||
tag "samtools/sort" | ||
tag "samtools/index" | ||
tag "bcftools/sort" | ||
tag "gunzip" | ||
|
||
setup { | ||
run("GUNZIP"){ | ||
script "../../../gunzip/main.nf" | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id : 'chr22' ], | ||
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr22_chr22_KI270734v1_random/sequence/genome.fa.gz', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
run("SAMTOOLS_FAIDX"){ | ||
script "../../../samtools/faidx/main.nf" | ||
process { | ||
""" | ||
input[0] = GUNZIP.out.gunzip | ||
input[1] = [[],[]] | ||
""" | ||
} | ||
} | ||
run("TRGT_GENOTYPE"){ | ||
script "../../genotype/main.nf" | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], | ||
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), | ||
'XX' | ||
] | ||
input[1] = GUNZIP.out.gunzip | ||
input[2] = SAMTOOLS_FAIDX.out.fai | ||
input[3] = Channel.of('chr22\t18890357\t18890451\tID=TEST;MOTIFS=AT;STRUC=(AT)n') | ||
.collectFile(name : 'repeats.bed', newLine: false) | ||
.map { file -> [ [ id : 'chr22' ], file ] } | ||
""" | ||
} | ||
} | ||
run("SAMTOOLS_SORT"){ | ||
script "../../../samtools/sort/main.nf" | ||
process { | ||
""" | ||
input[0] = TRGT_GENOTYPE.out.bam | ||
input[1] = [[],[]] | ||
""" | ||
} | ||
} | ||
run("SAMTOOLS_INDEX"){ | ||
script "../../../samtools/index/main.nf" | ||
process { | ||
""" | ||
input[0] = SAMTOOLS_SORT.out.bam | ||
""" | ||
} | ||
} | ||
run("BCFTOOLS_SORT"){ | ||
script "../../../bcftools/sort/main.nf" | ||
process { | ||
""" | ||
input[0] = TRGT_GENOTYPE.out.vcf | ||
""" | ||
} | ||
} | ||
} | ||
|
||
test("homo sapiens - [bam, bai, vcf, TEST], fasta, fai, bed") { | ||
when { | ||
process { | ||
""" | ||
input[0] = SAMTOOLS_SORT.out.bam | ||
.join(SAMTOOLS_INDEX.out.bai) | ||
.join(BCFTOOLS_SORT.out.vcf) | ||
.join(BCFTOOLS_SORT.out.tbi) | ||
.map { tuple -> tuple + 'TEST' } | ||
input[1] = GUNZIP.out.gunzip | ||
input[2] = SAMTOOLS_FAIDX.out.fai | ||
input[3] = Channel.of('chr22\t18890357\t18890451\tID=TEST;MOTIFS=AT;STRUC=(AT)n') | ||
.collectFile(name : 'repeats.bed', newLine: false) | ||
.map { file -> [ [ id : 'chr22' ], file ] } | ||
""" | ||
} | ||
} | ||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("homo sapiens - [bam, bai, vcf, TEST], fasta, fai, bed - stub") { | ||
options "-stub" | ||
when { | ||
process { | ||
""" | ||
input[0] = SAMTOOLS_SORT.out.bam | ||
.join(SAMTOOLS_INDEX.out.bai) | ||
.join(BCFTOOLS_SORT.out.vcf) | ||
.join(BCFTOOLS_SORT.out.tbi) | ||
.map { tuple -> tuple + 'TEST' } | ||
input[1] = GUNZIP.out.gunzip | ||
input[2] = SAMTOOLS_FAIDX.out.fai | ||
input[3] = Channel.of('chr22\t18890357\t18890451\tID=TEST;MOTIFS=AT;STRUC=(AT)n') | ||
.collectFile(name : 'repeats.bed', newLine: false) | ||
.map { file -> [ [ id : 'chr22' ], file ] } | ||
""" | ||
} | ||
} | ||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"homo sapiens - [bam, bai, vcf, TEST], fasta, fai, bed - stub": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.png:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,24cc939a0b88728bae8a2102feaf542c" | ||
], | ||
"plot": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.png:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,24cc939a0b88728bae8a2102feaf542c" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-11-14T16:10:13.150678363" | ||
}, | ||
"homo sapiens - [bam, bai, vcf, TEST], fasta, fai, bed": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_TEST.png:md5,32a2b217628e72817d7ec848a648029d" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,24cc939a0b88728bae8a2102feaf542c" | ||
], | ||
"plot": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_TEST.png:md5,32a2b217628e72817d7ec848a648029d" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,24cc939a0b88728bae8a2102feaf542c" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-11-14T16:11:37.679432214" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
process { | ||
withName: "BCFTOOLS_SORT" { | ||
ext.args = "--write-index=tbi --output-type z" | ||
ext.prefix = "sorted_" | ||
} | ||
} |