@@ -399,8 +399,8 @@ process ConcatVCF {
399399 file(genomeIndex) from Channel . value(referenceMap. genomeIndex)
400400
401401 output:
402- set variantCaller, idPatient, idSampleNormal, idSampleTumor, file(" *.vcf.gz" ) into vcfConcatenated
403- file( " *.vcf.gz.tbi " ) into vcfConcatenatedTbi
402+ set variantCaller, idPatient, idSampleNormal, idSampleTumor, file(" *.vcf.gz" ), file( " *.vcf.gz.tbi " ) into vcfConcatenated
403+
404404
405405 when: ( ' haplotypecaller' in tools || ' mutect1' in tools || ' mutect2' in tools || ' freebayes' in tools ) && ! params. onlyQC
406406
@@ -453,8 +453,9 @@ process ConcatVCF {
453453
454454if (params. verbose) vcfConcatenated = vcfConcatenated. view {
455455 " Variant Calling output:\n \
456- Tool : ${ it[0]} \t ID : ${ it[1]} \t Sample: [${ it[3]} , ${ it[2]} ]\n \
457- File : ${ it[4].fileName} "
456+ Tool : ${ it[0]} \t ID : ${ it[1]} \t Sample: ${ it[2]} \n \
457+ Files : ${ it[4].fileName} \n \
458+ Index : ${ it[5].fileName} "
458459}
459460
460461process RunSingleStrelka {
@@ -549,7 +550,11 @@ if (params.verbose) singleMantaOutput = singleMantaOutput.view {
549550 Index : ${ it[4].fileName} "
550551}
551552
552- vcfForBCFtools = Channel . empty(). mix(
553+ vcfForQC = Channel . empty(). mix(
554+ vcfConcatenated. map {
555+ variantcaller, idPatient, idSampleNormal, idSampleTumor, vcf, tbi ->
556+ [variantcaller, vcf]
557+ },
553558 singleStrelkaOutput. map {
554559 variantcaller, idPatient, idSample, vcf, tbi ->
555560 [variantcaller, vcf[1 ]]
@@ -559,6 +564,8 @@ vcfForBCFtools = Channel.empty().mix(
559564 [variantcaller, vcf[2 ]]
560565 })
561566
567+ (vcfForBCFtools, vcfForVCFtools) = vcfForQC. into(2 )
568+
562569process RunBcftoolsStats {
563570 tag {vcf}
564571
@@ -585,6 +592,49 @@ if (params.verbose) bcfReport = bcfReport.view {
585592
586593bcfReport. close()
587594
595+ process RunVcftools {
596+ tag {vcf}
597+
598+ publishDir directoryMap. vcftools, mode: ' link'
599+
600+ input:
601+ set variantCaller, file(vcf) from vcfForVCFtools
602+
603+ output:
604+ file (" ${ vcf.baseName} .*" ) into vcfReport
605+
606+ when: ! params. noReports
607+
608+ script:
609+ """
610+ vcftools \
611+ --gzvcf ${ vcf} \
612+ --relatedness2 \
613+ --out ${ vcf.baseName}
614+
615+ vcftools \
616+ --gzvcf ${ vcf} \
617+ --TsTv-by-count \
618+ --out ${ vcf.baseName}
619+
620+ vcftools \
621+ --gzvcf ${ vcf} \
622+ --TsTv-by-qual \
623+ --out ${ vcf.baseName}
624+
625+ vcftools \
626+ --gzvcf ${ vcf} \
627+ --FILTER-summary \
628+ --out ${ vcf.baseName}
629+ """
630+ }
631+
632+ if (params. verbose) vcfReport = vcfReport. view {
633+ " VCFTools stats report:\n \
634+ File : [${ it.fileName} ]"
635+ }
636+
637+ vcfReport. close()
588638/*
589639================================================================================
590640= F U N C T I O N S =
@@ -646,10 +696,11 @@ def defineDirectoryMap() {
646696 ' bamQC' : " ${ params.outDir} /Reports/bamQC" ,
647697 ' bcftoolsStats' : " ${ params.outDir} /Reports/BCFToolsStats" ,
648698 ' samtoolsStats' : " ${ params.outDir} /Reports/SamToolsStats" ,
699+ ' vcftools' : " ${ params.outDir} /Reports/VCFTools" ,
649700 ' ascat' : " ${ params.outDir} /VariantCalling/Ascat" ,
650701 ' freebayes' : " ${ params.outDir} /VariantCalling/FreeBayes" ,
651- ' haplotypecaller' : " ${ params.outDir} /VariantCalling/HaplotypeCaller" ,
652702 ' gvcf-hc' : " ${ params.outDir} /VariantCalling/HaplotypeCallerGVCF" ,
703+ ' haplotypecaller' : " ${ params.outDir} /VariantCalling/HaplotypeCaller" ,
653704 ' manta' : " ${ params.outDir} /VariantCalling/Manta" ,
654705 ' mutect1' : " ${ params.outDir} /VariantCalling/MuTect1" ,
655706 ' mutect2' : " ${ params.outDir} /VariantCalling/MuTect2" ,
0 commit comments