Skip to content

Commit

Permalink
updated input, output and test after review
Browse files Browse the repository at this point in the history
  • Loading branch information
aidaanva committed Jul 28, 2023
1 parent 526ce85 commit 9a79d31
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 12 deletions.
21 changes: 17 additions & 4 deletions modules/nf-core/topas/gencons/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,27 @@ process TOPAS_GENCONS {

input:
tuple val(meta), path(vcf)
tuple val(meta), path(vcf_indels)
tuple val(meta), path(reference)
tuple val(meta), path(fai)
val(vcf_output)

output:
tuple val(meta), path("*.fasta.gz"), emit: fasta
tuple val(meta), path("*.ccf") , emit: ccf
tuple val(meta), path("*.log") , emit: log
path "versions.yml" , emit: versions
tuple val(meta), path("*.vcf.gz") , emit: vcf , optional: true
tuple val(meta), path("*.ccf") , emit: ccf
tuple val(meta), path("*.log") , emit: log
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}"
def optionalvcfindels = vcf_indels ? "-indels ${vcf_indels}" : ''
def optionalfai = fai ? "-fai ${fai}" : ''
def vcfoutput = vcf_output ? "-vcf_out ${prefix}.vcf" : ""
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

"""
Expand All @@ -32,9 +39,15 @@ process TOPAS_GENCONS {
$args \\
-o ${prefix}.fasta \\
-snps $vcf \\
$optionalvcfindels \\
$vcfoutput \\
-ref $reference
gzip ${prefix}.fasta
gzip -n ${prefix}.fasta
if [[ -f ${prefix}.vcf ]];then
gzip -n ${prefix}.vcf
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
23 changes: 21 additions & 2 deletions modules/nf-core/topas/gencons/meta.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "topas_gencons"
description: Create fasta consensus with TOPAS toolkit
description: Create fasta consensus with TOPAS toolkit with options to penalize substitutions for typical DNA damage present in ancient DNA
keywords:
- consensus
- fasta
Expand All @@ -22,14 +22,28 @@ input:
- vcf:
type: file
description: compressed vcf file containing the called snps
description: Gzipped compressed vcf file generated with GATK UnifiedGenotyper containing the called snps
pattern: "*.vcf.gz"

- vcf_indels:
type: file
description: Optional gzipped compressed vcf file generated with GATK UnifiedGenotyper containing the called indels
pattern: "*.vcf.gz"

- reference:
type: file
description: Fasta file of reference genome
pattern: "*.fasta"

- fai:
type: file
description: Optional index for the fasta file of reference genome
pattern: "*.fai"

- vcf_output:
type: boolean
description: Boolean value to indicate if a compressed vcf file with the consensus calls included as SNPs should be produced

output:
- meta:
type: map
Expand All @@ -47,6 +61,11 @@ output:
description: Gzipped consensus fasta file with bases under threshold replaced with Ns
pattern: "*.fasta.gz"

- vcf:
type: file
description: Gzipped vcf file with updated calls for the SNPs used in the consensus generation and for bases under threshold replaced with Ns
pattern: "*.vcf.gz"

- ccf:
type: file
description: Statistics file containing information about the consensus calls in the fasta file
Expand Down
74 changes: 70 additions & 4 deletions tests/modules/nf-core/topas/gencons/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

nextflow.enable.dsl = 2

include { GATK_UNIFIEDGENOTYPER } from '../../../../modules/nf-core/gatk/unifiedgenotyper/main.nf'
include { GATK_UNIFIEDGENOTYPER as GATK_UNIFIEDGENOTYPERSNPS } from '../../../../modules/nf-core/gatk/unifiedgenotyper/main.nf'
include { GATK_UNIFIEDGENOTYPER as GATK_UNIFIEDGENOTYPERINDELS } from '../../../../modules/nf-core/gatk/unifiedgenotyper/main.nf'
include { TOPAS_GENCONS } from '../../../../../modules/nf-core/topas/gencons/main.nf'

workflow test_topas_gencons {
Expand All @@ -24,13 +25,78 @@ workflow test_topas_gencons {
file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true)
]

GATK_UNIFIEDGENOTYPER ( input_gatk, fasta, fai, dict, [[],[]], [[],[]], [[],[]], [[],[]])
GATK_UNIFIEDGENOTYPERSNPS ( input_gatk, fasta, fai, dict, [[],[]], [[],[]], [[],[]], [[],[]])

gencons_vcf = GATK_UNIFIEDGENOTYPER.out.vcf
gencons_vcf = GATK_UNIFIEDGENOTYPERSNPS.out.vcf
gencons_vcf_indels = [[],[]]
gencons_fasta =[ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
gencons_vcf_output = false

TOPAS_GENCONS ( gencons_vcf, gencons_vcf_indels, gencons_fasta, [[],[]], gencons_vcf_output)
}

workflow test_topas_gencons_fai {

input_gatk = [ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true),
]
fasta = [
[id: 'test'],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
fai = [
[id: 'test'],
file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
]
dict = [
[id: 'test'],
file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true)
]

GATK_UNIFIEDGENOTYPERSNPS ( input_gatk, fasta, fai, dict, [[],[]], [[],[]], [[],[]], [[],[]])

gencons_vcf = GATK_UNIFIEDGENOTYPERSNPS.out.vcf
gencons_vcf_indels = [[],[]]
gencons_fasta =[ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
gencons_vcf_output = false

TOPAS_GENCONS ( gencons_vcf, gencons_vcf_indels, gencons_fasta, fai, gencons_vcf_output)
}

workflow test_topas_gencons_indels {

input_gatk = [ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true),
]
fasta = [
[id: 'test'],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
fai = [
[id: 'test'],
file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
]
dict = [
[id: 'test'],
file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true)
]

GATK_UNIFIEDGENOTYPERSNPS ( input_gatk, fasta, fai, dict, [[],[]], [[],[]], [[],[]], [[],[]])
GATK_UNIFIEDGENOTYPERINDELS ( input_gatk, fasta, fai, dict, [[],[]], [[],[]], [[],[]], [[],[]])


gencons_vcf = GATK_UNIFIEDGENOTYPERSNPS.out.vcf
gencons_vcf_indels = GATK_UNIFIEDGENOTYPERINDELS.out.vcf
gencons_fasta =[ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
gencons_vcf_output = true

TOPAS_GENCONS ( gencons_vcf, gencons_fasta )
TOPAS_GENCONS ( gencons_vcf, gencons_vcf_indels, gencons_fasta, [[],[]], gencons_vcf_output)
}
8 changes: 7 additions & 1 deletion tests/modules/nf-core/topas/gencons/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

withName: GATK_UNIFIEDGENOTYPER {
withName: GATK_UNIFIEDGENOTYPERSNPS {
ext.args = "--genotype_likelihoods_model SNP -stand_call_conf 30 --sample_ploidy 2 -dcov 250 --output_mode EMIT_ALL_SITES"
ext.prefix = { "${meta.id}_snps" }
}

withName: GATK_UNIFIEDGENOTYPERINDELS {
ext.args = "--genotype_likelihoods_model INDEL -stand_call_conf 30 --sample_ploidy 2 -dcov 250 --output_mode EMIT_ALL_SITES"
ext.prefix = { "${meta.id}_indels" }
}

}
34 changes: 33 additions & 1 deletion tests/modules/nf-core/topas/gencons/test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
- name: topas gencons test_topas_gencons
command: nextflow run ./tests/modules/nf-core/topas/gencons -entry test_topas_gencons -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/topas/gencons/nextflow.config
tags:
- topas
- topas/gencons
files:
- path: output/topas/[].fasta.ccf
md5sum: 794d4231ee35302a9816df2c1f595041
- path: output/topas/[].fasta.gz
md5sum: 1f219a39d28eed85be8a48cb167d5879
- path: output/topas/[].fasta.log
contains:
- "Use -? for help"
- path: output/topas/versions.yml

- name: topas gencons test_topas_gencons_fai
command: nextflow run ./tests/modules/nf-core/topas/gencons -entry test_topas_gencons_fai -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/topas/gencons/nextflow.config
tags:
- topas
- topas/gencons
files:
- path: output/topas/test.fasta.ccf
md5sum: ed5d5767d014d76d5ba904017d937cd5
md5sum: 794d4231ee35302a9816df2c1f595041
- path: output/topas/test.fasta.gz
md5sum: 1f219a39d28eed85be8a48cb167d5879
- path: output/topas/test.fasta.log
contains:
- "Use -? for help"
- path: output/topas/versions.yml

- name: topas gencons test_topas_gencons_indels
command: nextflow run ./tests/modules/nf-core/topas/gencons -entry test_topas_gencons_indels -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/topas/gencons/nextflow.config
tags:
- topas
- topas/gencons
files:
- path: output/topas/[].fasta.ccf
md5sum: f7337d6e701ab7c5b3c8654742e5116a
- path: output/topas/[].fasta.gz
md5sum: 1f219a39d28eed85be8a48cb167d5879
- path: output/topas/[].fasta.log
contains:
- "Use -? for help"
- path: output/topas/[].vcf.gz
md5sum: 91806432f141a2a7a071283aa962488d
- path: output/topas/versions.yml

0 comments on commit 9a79d31

Please sign in to comment.