Skip to content

Commit

Permalink
Modify and adjust two scripts to add normalization and integrate FAST…
Browse files Browse the repository at this point in the history
…A support
  • Loading branch information
JC-Delmas committed May 16, 2024
1 parent d289261 commit c78af62
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion subworkflows/local/post_variantcalling/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ workflow POST_VARIANTCALLING {
versions = Channel.empty()

if (concatenate_vcfs){
CONCATENATE_GERMLINE_VCFS(vcfs)
CONCATENATE_GERMLINE_VCFS(vcfs, fasta)

vcfs = vcfs.mix(CONCATENATE_GERMLINE_VCFS.out.vcfs)
versions = versions.mix(CONCATENATE_GERMLINE_VCFS.out.versions)
Expand Down
47 changes: 29 additions & 18 deletions subworkflows/local/vcf_concatenate_germline/main.nf
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
//
// CONCATENATE Germline VCFs
//

// Concatenation of germline vcf-files
include { ADD_INFO_TO_VCF } from '../../../modules/local/add_info_to_vcf/main'
include { TABIX_BGZIPTABIX as TABIX_EXT_VCF } from '../../../modules/nf-core/tabix/bgziptabix/main'
include { BCFTOOLS_NORM as GERMLINE_VCFS_NORM } from '../../../modules/nf-core/bcftools/norm/main'
include { BCFTOOLS_CONCAT as GERMLINE_VCFS_CONCAT } from '../../../modules/nf-core/bcftools/concat/main'
include { BCFTOOLS_SORT as GERMLINE_VCFS_CONCAT_SORT } from '../../../modules/nf-core/bcftools/sort/main'
include { TABIX_TABIX as TABIX_GERMLINE_VCFS_CONCAT_SORT } from '../../../modules/nf-core/tabix/tabix/main'
include { ADD_INFO_TO_VCF } from '../../../modules/local/add_info_to_vcf/main'
include { TABIX_BGZIPTABIX as TABIX_EXT_VCF } from '../../../modules/nf-core/tabix/bgziptabix/main'
include { BCFTOOLS_NORM as GERMLINE_VCFS_NORM } from '../../../modules/nf-core/bcftools/norm/main'
include { BCFTOOLS_CONCAT as GERMLINE_VCFS_CONCAT } from '../../../modules/nf-core/bcftools/concat/main'
include { BCFTOOLS_SORT as GERMLINE_VCFS_CONCAT_SORT } from '../../../modules/nf-core/bcftools/sort/main'
include { TABIX_TABIX as TABIX_GERMLINE_VCFS_CONCAT_SORT } from '../../../modules/nf-core/tabix/tabix/main'

workflow CONCATENATE_GERMLINE_VCFS {

Expand All @@ -19,30 +17,43 @@ workflow CONCATENATE_GERMLINE_VCFS {
main:
versions = Channel.empty()

// Concatenate vcf-files
// Add additional information to VCF files
ADD_INFO_TO_VCF(vcfs)

// Compress the VCF files with bgzip
TABIX_EXT_VCF(ADD_INFO_TO_VCF.out.vcf)

// Normalize the VCF files with BCFTOOLS_NORM
GERMLINE_VCFS_NORM(vcf: ADD_INFO_TO_VCF.out.vcf, fasta: fasta)

// Compress the normalized VCF files with bgzip
TABIX_EXT_VCF(GERMLINE_VCFS_NORM.out.vcf)

// Index the compressed normalized VCF files
TABIX_GERMLINE_VCFS_CONCAT_SORT(TABIX_EXT_VCF.out.gz)

// Gather vcfs and vcf-tbis for concatenating germline-vcfs
germline_vcfs_with_tbis = TABIX_EXT_VCF.out.gz_tbi.map{ meta, vcf, tbi -> [ meta.subMap('id'), vcf, tbi ] }.groupTuple()
germline_vcfs_with_tbis = TABIX_GERMLINE_VCFS_CONCAT_SORT.out.map { meta, vcf, tbi -> [meta.subMap('id'), vcf, tbi] }.groupTuple()

// Concatenate the VCF files
GERMLINE_VCFS_CONCAT(germline_vcfs_with_tbis)

// Normalize vcf-files and concat
GERMLINE_VCFS_NORM(germline_vcfs_with_tbis, fasta)
GERMLINE_VCFS_CONCAT(GERMLINE_VCFS_NORM.out.vcf)
// Sort the concatenated VCF files
GERMLINE_VCFS_CONCAT_SORT(GERMLINE_VCFS_CONCAT.out.vcf)
TABIX_GERMLINE_VCFS_CONCAT_SORT(GERMLINE_VCFS_CONCAT_SORT.out.vcf)


// Index the sorted concatenated VCF files
TABIX_GERMLINE_VCFS_CONCAT_SORT(GERMLINE_VCFS_CONCAT_SORT.out.vcf)

// Gather versions of all tools used
versions = versions.mix(ADD_INFO_TO_VCF.out.versions)
versions = versions.mix(TABIX_EXT_VCF.out.versions)
versions = versions.mix(GERMLINE_VCFS_NORM.out.versions)
versions = versions.mix(GERMLINE_VCFS_CONCAT.out.versions)
versions = versions.mix(GERMLINE_VCFS_CONCAT.out.versions)
versions = versions.mix(GERMLINE_VCFS_CONCAT_SORT.out.versions)
versions = versions.mix(TABIX_GERMLINE_VCFS_CONCAT_SORT.out.versions)

emit:
vcfs = germline_vcfs_with_tbis // post processed vcfs

vcfs = TABIX_GERMLINE_VCFS_CONCAT_SORT.out.gz_tbi // post-processed VCFs
versions // channel: [ versions.yml ]
}

0 comments on commit c78af62

Please sign in to comment.