diff --git a/README.md b/README.md index a0128e6..7858e81 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LOGAN 🔬 [![Docker Pulls](https://img.shields.io/docker/pulls/nciccbr/ccbr_wes_base)](https://hub.docker.com/r/nciccbr/ccbr_wes_base) [![GitHub issues](https://img.shields.io/github/issues/ccbr/LOGAN?color=brightgreen)](https://github.com/ccbr/LOGAN/issues) [![GitHub license](https://img.shields.io/github/license/ccbr/LOGAN)](https://github.com/ccbr/LOGAN/blob/master/LICENSE) -> **_LOGAN-whoLe genOme-sequencinG Analysis pipeliNe_**. This is the home of the LOGAN Pipeline. Accurately call germline and somatic variants, CNVs, and SVs and annotate variants! +> **_LOGAN-whoLe genOme-sequencinG Analysis pipeliNe_**. Call germline and somatic variants, CNVs, and SVs and annotate variants! ## Overview Welcome to LOGAN! Before getting started, we highly recommend reading through [LOGAN's documentation](https://ccbr.github.io/LOGAN). @@ -72,7 +72,10 @@ Adding flags determines SNV (germline and/or somatic), SV, and/or CNV calling mo `--vc`- Enables somatic CNV calling using FREEC, Sequenza, and Purple (hg38 only) +#### Optional Arguments +`--indelrealign` - Enables indel realignment when running alignment steps. May be helpful for certain callers (VarScan, VarDict) +`--callers`- Comma separated argument for callers, the default is to use all available. Example: `--callers mutect2,octopus,vardict,varscan` ## Running LOGAN Example of Tumor only calling mode @@ -87,7 +90,7 @@ logan run --mode local -profile ci_stub --genome hg38 --outdir out --fastq_input logan run --mode slurm -profile biowulf,slurm --genome hg38 --outdir out --fastq_input "*R{1,2}.fastq.gz" --vc --sv --cnv ``` -We currently support the hg38 and mm10 genomes. +We currently support the hg38, hg19 (in progress), and mm10 genomes. diff --git a/conf/genomes.config b/conf/genomes.config index 74d653b..3053157 100644 --- a/conf/genomes.config +++ b/conf/genomes.config @@ -7,8 +7,6 @@ params { genomedict= "/data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/genome/Homo_sapiens_assembly38.dict" wgsregion = "/data/CCBR_Pipeliner/Pipelines/LOGAN/resources/hg38/resources_broad_hg38_v0_wgs_calling_regions.hg38.interval_list" intervals= "${projectDir}/assets/hg38_v0_wgs_calling_regions.hg38.bed" - millsindel = "/data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/GATK_resource_bundle/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz" //Mills_and_1000G_gold_standard.indels.hg38.vcf.gz" - shapeitindel = "/data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/GATK_resource_bundle/ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz" //ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz" //file(params.gold_indels2) // INDELREF = "/data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/GATK_resource_bundle/ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz" //ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz" KNOWNINDELS = "-known /data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/GATK_resource_bundle/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz -known /data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/GATK_resource_bundle/ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz" KNOWNRECAL = '--known-sites /data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/GATK_resource_bundle/dbsnp_138.hg38.vcf.gz --known-sites /data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/GATK_resource_bundle/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz --known-sites /data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/GATK_resource_bundle/ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz' @@ -31,10 +29,39 @@ params { SEQUENZAGC = "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/SEQUENZA/hg38_gc50Base.txt.gz" chromosomes = ['chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrX','chrY','chrM'] } + + 'hg19' { + genome = "/data/CCBR_Pipeliner/db/PipeDB/lib/hg19.with_extra.fa" + genomefai = "/data/CCBR_Pipeliner/db/PipeDB/lib/hg19.with_extra.fa.fai" + bwagenome= "/data/CCBR_Pipeliner/db/PipeDB/lib/hs37d5.fa" + genomedict= "/data/CCBR_Pipeliner/db/PipeDB/lib/hs37d5.dict" + intervals= "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg19/hg19_noblacklistsort_vc.bed" + INDELREF = "/fdb/GATK_resource_bundle/b37/Mills_and_1000G_gold_standard.indels.b37.vcf" //ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz" + KNOWNINDELS = "-known /fdb/GATK_resource_bundle/b37/Mills_and_1000G_gold_standard.indels.b37.vcf -known /fdb/GATK_resource_bundle/b37/1000G_phase1.indels.b37.vcf" + KNOWNRECAL = '--known-sites /data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/GATK_resource_bundle/dbsnp_138.hg38.vcf.gz --known-sites /data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/GATK_resource_bundle/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz --known-sites /data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/GATK_resource_bundle/ALL.wgs.1000G_phase3.GRCh38.ncbi_remapper.20150424.shapeit2_indels.vcf.gz' + dbsnp = "/fdb/GATK_resource_bundle/hg19-2.8/dbsnp_138.hg19.vcf.gz" + gnomad = '--germline-resource /data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/GNOMAD/somatic-hg38-af-only-gnomad.hg38.vcf.gz' // /data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/GNOMAD/somatic-hg38-af-only-gnomad.hg38.vcf.gz + pon = "/data/CCBR_Pipeliner/db/PipeDB/lib/GRCh37.noCOSMIC_ClinVar.pon.vcf.gz" + kgp = "/fdb/GATK_resource_bundle/hg19-2.8/dbsnp_138.hg19.vcf.gz" + KRAKENBACDB = "/data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/kraken/20180907_standard_kraken2" + snpeff_genome = "GRCh37.75" + snpeff_config = "/usr/local/apps/snpEff/4.3t/snpEff.config" + snpeff_bundle = "/usr/local/apps/snpEff/4.3t/snpEff.confi" + sites_vcf= "/data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/somalier/sites.hg38.vcf.gz" + somalier_ancestrydb="/data/CCBR_Pipeliner/CCBR_Pipeliner_Legacy/Exome-seek/hg38/somalier/1kg-somalier" + vepcache = "/fdb/VEP/102/cache" + vepspecies = "homo_sapiens" + vepbuild = "GRCh37" + annotsvgenome = "GRCh37" + octopus_sforest= "--somatic-forest /data/CCBR_Pipeliner/Pipelines/LOGAN/resources/hg38/octopus/somatic.v0.7.4.forest" + octopus_gforest= "--forest /data/CCBR_Pipeliner/Pipelines/LOGAN/resources/hg38/octopus/germline.v0.7.4.forest" + SEQUENZAGC = "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/hg38/SEQUENZA/hg38_gc50Base.txt.gz" + chromosomes = ['chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrX','chrY','chrM'] + } 'mm10' { - genome = "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/mm10/genome/bwamem2index/genome.fa" // file(params.genome) - genomefai = "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/mm10/genome/bwamem2index/genome.fa.fai" // file(params.genome) + genome = "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/mm10/genome/bwamem2index/genome.fa" + genomefai = "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/mm10/genome/bwamem2index/genome.fa.fai" bwagenome= "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/mm10/genome/bwaindex/genome.fa" genomedict= "/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/mm10/genome/bwamem2index/genome.dict" intervals="/data/CCBR_Pipeliner/Pipelines/XAVIER/resources/mm10/genome/bwamem2index/mm10_wgsregions.bed" diff --git a/modules/local/splitbed.nf b/modules/local/splitbed.nf index 0ae2416..c39ee31 100644 --- a/modules/local/splitbed.nf +++ b/modules/local/splitbed.nf @@ -30,4 +30,10 @@ bedtools subtract -a GRCh38.primary_assembly.genome.bed -b ../hg38.blacklist.bed gatk BedToIntervalList -I GRCh38.primary_assembly.genome.interval.bed -O \ GRCh38.primary_assembly.genome.interval_list -SD GRCh38.primary_assembly.genome.dict + +#hg19 +awk -F '\t' '{printf("%s\t0\t%s\n",$1,$2);}' /data/CCBR_Pipeliner/db/PipeDB/lib/hg19.with_extra.fa.fai >hg19_all.bed +bedtools subtract -a hg19_all.bed -b hg19-blacklist.v2.bed > hg19_noblacklist.bed +bedtools sort -i hg19_noblacklist.bed -chrThenSizeD >hg19_noblacklistsort.bed +awk '/^chr[0-9,X,Y,M]*\t/ {printf("%s\t%s\t%s\n",$1,$2,$3);}' hg19_noblacklistsort.bed > hg19_noblacklistsort_vc.bed */ diff --git a/modules/local/variant_calling.nf b/modules/local/variant_calling.nf index f16c1be..804a7dd 100644 --- a/modules/local/variant_calling.nf +++ b/modules/local/variant_calling.nf @@ -472,6 +472,7 @@ process octopus_tn { $GERMLINE_FOREST \ $SOMATIC_FOREST \ --target-working-memory 64Gb \ + -B 64Gb \ -o ${tumorname}_vs_${normalname}_${bed.simpleName}.octopus.vcf.gz """ @@ -759,7 +760,7 @@ process somaticcombine { input: tuple val(tumorsample), val(normal), - val(callers), + val(caller), path(vcfs), path(vcfindex) output: @@ -768,14 +769,15 @@ process somaticcombine { path("${tumorsample}_vs_${normal}_combined.vcf.gz.tbi") script: - vcfin1=[callers, vcfs].transpose().collect { a, b -> a + " " + b } + vcfin1=[caller, vcfs].transpose().collect { a, b -> a + " " + b } vcfin2="-V:" + vcfin1.join(" -V:") + callerin=caller.join(",") """ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar \$GATK_JAR -T CombineVariants \ -R $GENOMEREF \ --genotypemergeoption PRIORITIZE \ - --rod_priority_list mutect2,strelka,octopus,muse,lofreq,vardict,varscan \ + --rod_priority_list $callerin \ --filteredrecordsmergetype KEEP_IF_ANY_UNFILTERED \ -o ${tumorsample}_vs_${normal}_combined.vcf.gz \ $vcfin2 @@ -783,9 +785,11 @@ process somaticcombine { """ stub: - vcfin1=[callers, vcfs].transpose().collect { a, b -> a + " " + b } + vcfin1=[caller, vcfs].transpose().collect { a, b -> a + " " + b } vcfin2="-V:" + vcfin1.join(" -V:") + callerin=caller.join(",") + """ touch ${tumorsample}_vs_${normal}_combined.vcf.gz touch ${tumorsample}_vs_${normal}_combined.vcf.gz.tbi diff --git a/modules/local/variant_calling_tonly.nf b/modules/local/variant_calling_tonly.nf index e36622d..59b4dd9 100644 --- a/modules/local/variant_calling_tonly.nf +++ b/modules/local/variant_calling_tonly.nf @@ -339,9 +339,11 @@ process octopus_tonly { octopus -R $GENOMEREF -C cancer -I ${tumor} \ --annotations AC AD DP \ --target-working-memory 64Gb \ + -B 64Gb \ -t ${bed} \ + --threads ${task.cpus}\ $SOMATIC_FOREST \ - -o ${tumorname}_${bed.simpleName}.tonly.octopus.vcf.gz --threads ${task.cpus} + -o ${tumorname}_${bed.simpleName}.tonly.octopus.vcf.gz """ stub: @@ -385,7 +387,7 @@ process somaticcombine_tonly { input: tuple val(tumorsample), - val(callers), + val(caller), path(vcfs), path(vcfindex) output: @@ -394,20 +396,27 @@ process somaticcombine_tonly { path("${tumorsample}_combined_tonly.vcf.gz.tbi") script: - vcfin1=[callers, vcfs].transpose().collect { a, b -> a + " " + b } + vcfin1=[caller, vcfs].transpose().collect { a, b -> a + " " + b } vcfin2="-V:" + vcfin1.join(" -V:") + callerin=caller.join(",").replaceAll("_tonly","") + """ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar \$GATK_JAR -T CombineVariants \ -R $GENOMEREF \ --genotypemergeoption PRIORITIZE \ - --rod_priority_list mutect2_tonly,octopus_tonly,vardict_tonly,varscan_tonly \ + --rod_priority_list $callerin \ --filteredrecordsmergetype KEEP_IF_ANY_UNFILTERED \ -o ${tumorsample}_combined_tonly.vcf.gz \ $vcfin2 """ stub: + + vcfin1=[caller, vcfs].transpose().collect { a, b -> a + " " + b } + vcfin2="-V:" + vcfin1.join(" -V:") + + callerin=caller.join(",").replaceAll("_tonly","") """ touch ${tumorsample}_combined_tonly.vcf.gz ${tumorsample}_combined_tonly.vcf.gz.tbi """ diff --git a/nextflow.config b/nextflow.config index b9afbd6..b317131 100644 --- a/nextflow.config +++ b/nextflow.config @@ -27,9 +27,10 @@ params { script_freecpaired = "${projectDir}/bin/make_freec_genome_paired.pl" freec_significance = "${projectDir}/bin/assess_significance.R" freec_plot = "${projectDir}/bin/makeGraph.R" + lofreq_convert = "${projectDir}/bin/add_gt_lofreq.sh" split_regions = "24" //Number of regions to split by - + vep_cache = "/fdb/VEP/102/cache" //SUB WORKFLOWS to SPLIT @@ -40,16 +41,15 @@ params { qc=null bam=null indelrealign=null + //Set all Inputs to null sample_sheet=null - fastq_file_input=null bam_file_input=null file_input=null fastq_input=null bam_input=null - BAMINPUT=null publish_dir_mode = 'symlink' diff --git a/subworkflows/local/workflows.nf b/subworkflows/local/workflows.nf index 5747067..153c230 100644 --- a/subworkflows/local/workflows.nf +++ b/subworkflows/local/workflows.nf @@ -1,7 +1,3 @@ -//All Worksflows in One Place -intervalbedin = Channel.fromPath(params.genomes[params.genome].intervals,checkIfExists: true,type: 'file') - - include {fc_lane; fastq_screen;kraken;qualimap_bamqc;fastqc; samtools_flagstats;vcftools;collectvariantcallmetrics; bcftools_stats;gatk_varianteval; @@ -101,6 +97,8 @@ workflow ALIGN { sample_sheet main: fastp(fastqinput) + + intervalbedin = Channel.fromPath(params.genomes[params.genome].intervals,checkIfExists: true,type: 'file') splitinterval(intervalbedin) bwamem2(fastp.out) @@ -165,49 +163,66 @@ workflow VC { sample_sheet_paired=sample_sheet|map{tu,no -> tuple ("${tu}_vs_${no}",tu, no)} bambyinterval=bamwithsample.combine(splitout.flatten()) - //Prep Pileupss - pileup_paired_t(bambyinterval) - pileup_paired_n(bambyinterval) - - pileup_paired_t.out.groupTuple(by:[0,1]) - | multiMap { samplename, normalname, pileups -> - tout: tuple( samplename, normalname, - pileups.toSorted{ it -> (it.name =~ /${samplename}_(.*?).tumor.pileup.table/)[0][1].toInteger() } ) - tonly: tuple( samplename, - pileups.toSorted{ it -> (it.name =~ /${samplename}_(.*?).tumor.pileup.table/)[0][1].toInteger() } ) - } - | set{pileup_paired_tout} - - - pileup_paired_n.out.groupTuple(by:[0,1]) - | multiMap { samplename, normalname, pileups-> - nout: tuple (samplename,normalname, - pileups.toSorted{ it -> (it.name =~ /${normalname}_(.*?).normal.pileup.table/)[0][1].toInteger() } ) - nonly: tuple (normalname, - pileups.toSorted{ it -> (it.name =~ /${normalname}_(.*?).normal.pileup.table/)[0][1].toInteger() } ) - } - | set{pileup_paired_nout} - - - pileup_paired_match=pileup_paired_tout.tout.join(pileup_paired_nout.nout,by:[0,1]) - contamination_paired(pileup_paired_match) - - pileup_all=pileup_paired_tout.tonly.concat(pileup_paired_nout.nonly) - contamination_tumoronly(pileup_all) - + bambyinterval + | multiMap {tumorname,tumor,tumorbai,normalname,normalbam,normalbai,bed -> + t1: tuple(tumorname,tumor,tumorbai,bed) + n1: tuple(normalname,normalbam,normalbai,bed) + } + | set{bambyinterval_tonly} + + bambyinterval_t=bambyinterval_tonly.t1 | + concat(bambyinterval_tonly.n1) |unique() + + //Prep Pileups + params.callers = "mutect2,octopus,muse,lofreq,vardict,varscan" + params.callist = params.callers.split(',') as List + + vc_all=Channel.empty() + vc_tonly=Channel.empty() + + //Common for Mutect2/Varscan + if ("mutect2" in params.callist | "varscan" in params.callist){ + pileup_paired_t(bambyinterval) + pileup_paired_n(bambyinterval) + + pileup_paired_t.out.groupTuple(by:[0,1]) + | multiMap { samplename, normalname, pileups -> + tout: tuple( samplename, normalname, + pileups.toSorted{ it -> (it.name =~ /${samplename}_(.*?).tumor.pileup.table/)[0][1].toInteger() } ) + tonly: tuple( samplename, + pileups.toSorted{ it -> (it.name =~ /${samplename}_(.*?).tumor.pileup.table/)[0][1].toInteger() } ) + } + | set{pileup_paired_tout} + + pileup_paired_n.out.groupTuple(by:[0,1]) + | multiMap { samplename, normalname, pileups-> + nout: tuple (samplename,normalname, + pileups.toSorted{ it -> (it.name =~ /${normalname}_(.*?).normal.pileup.table/)[0][1].toInteger() } ) + nonly: tuple (normalname, + pileups.toSorted{ it -> (it.name =~ /${normalname}_(.*?).normal.pileup.table/)[0][1].toInteger() } ) + } + | set{pileup_paired_nout} + + pileup_paired_match=pileup_paired_tout.tout.join(pileup_paired_nout.nout,by:[0,1]) + contamination_paired(pileup_paired_match) + + pileup_all=pileup_paired_tout.tonly.concat(pileup_paired_nout.nonly) + contamination_tumoronly(pileup_all) + } + if ("mutect2" in params.callist){ //Paired Mutect2 - mutect2(bambyinterval) - mutect2.out.groupTuple(by:[0,1]) - | multiMap { tumor,normal,vcfs,f1r2,stats -> - mut2out_lor: tuple("${tumor}_vs_${normal}", - f1r2.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).f1r2.tar.gz/)[0][1].toInteger() } ) - mut2out_mstats: tuple( "${tumor}_vs_${normal}", - stats.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).mut2.vcf.gz.stats/)[0][1].toInteger() }) - allmut2tn: tuple( "${tumor}_vs_${normal}", - vcfs.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).mut2.vcf.gz/)[0][1].toInteger() } ) - } - | set{mut2out} + mutect2(bambyinterval) + mutect2.out.groupTuple(by:[0,1]) + | multiMap { tumor,normal,vcfs,f1r2,stats -> + mut2out_lor: tuple("${tumor}_vs_${normal}", + f1r2.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).f1r2.tar.gz/)[0][1].toInteger() } ) + mut2out_mstats: tuple( "${tumor}_vs_${normal}", + stats.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).mut2.vcf.gz.stats/)[0][1].toInteger() }) + allmut2tn: tuple( "${tumor}_vs_${normal}", + vcfs.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).mut2.vcf.gz/)[0][1].toInteger() } ) + } + | set{mut2out} learnreadorientationmodel(mut2out.mut2out_lor) mergemut2stats(mut2out.mut2out_mstats) @@ -224,137 +239,171 @@ workflow VC { annotvep_tn_mut2(mutect2_in) //Mutect2 Tumor Only - bambyinterval - | multiMap {tumorname,tumor,tumorbai,normalname,normalbam,normalbai,bed -> - t1: tuple(tumorname,tumor,tumorbai,bed) - n1: tuple(normalname,normalbam,normalbai,bed) + mutect2_t_tonly(bambyinterval_t) + mutect2_t_tonly.out.groupTuple() + | multiMap { tumor,vcfs,f1r2,stats -> + mut2tout_lor: tuple(tumor, + f1r2.toSorted{ it -> (it.name =~ /${tumor}_(.*?).f1r2.tar.gz/)[0][1].toInteger() } ) + mut2tonly_mstats: tuple( tumor, + stats.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz.stats/)[0][1].toInteger() }) + allmut2tonly: tuple(tumor, + vcfs.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz/)[0][1].toInteger() } ) } - | set{bambyinterval_tonly} - bambyinterval_t=bambyinterval_tonly.t1.concat(bambyinterval_tonly.n1) - - mutect2_t_tonly(bambyinterval_t) - mutect2_t_tonly.out.groupTuple() - | multiMap { tumor,vcfs,f1r2,stats -> - mut2tout_lor: tuple(tumor, - f1r2.toSorted{ it -> (it.name =~ /${tumor}_(.*?).f1r2.tar.gz/)[0][1].toInteger() } ) - mut2tonly_mstats: tuple( tumor, - stats.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz.stats/)[0][1].toInteger() }) - allmut2tonly: tuple(tumor, - vcfs.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz/)[0][1].toInteger() } ) + | set{mut2tonlyout} + + learnreadorientationmodel_tonly(mut2tonlyout.mut2tout_lor) + mergemut2stats_tonly(mut2tonlyout.mut2tonly_mstats) + + mutect2_in_tonly=mut2tonlyout.allmut2tonly + | join(mergemut2stats_tonly.out) + | join(learnreadorientationmodel_tonly.out) + | join(contamination_tumoronly.out) + | mutect2filter_tonly + | join(sample_sheet) + | map{tumor,markedvcf,markedindex,normvcf,normindex,stats,normal -> tuple(tumor,"mutect2_tonly",normvcf,normindex)} + annotvep_tonly_mut2(mutect2_in_tonly) + + + vc_all=vc_all|concat(mutect2_in) + vc_tonly=vc_tonly|concat(mutect2_in_tonly) + } - | set{mut2tonlyout} - - - learnreadorientationmodel_tonly(mut2tonlyout.mut2tout_lor) - mergemut2stats_tonly(mut2tonlyout.mut2tonly_mstats) - - mutect2_in_tonly=mut2tonlyout.allmut2tonly - | join(mergemut2stats_tonly.out) - | join(learnreadorientationmodel_tonly.out) - | join(contamination_tumoronly.out) - | mutect2filter_tonly - | join(sample_sheet) - | map{tumor,markedvcf,markedindex,normvcf,normindex,stats,normal -> tuple(tumor,"mutect2_tonly",normvcf,normindex)} - annotvep_tonly_mut2(mutect2_in_tonly) - - //Strelka TN - strelka_in=strelka_tn(bambyinterval) | groupTuple(by:[0,1]) - | map { tumor,normal,vcfs,vcfindex,indels,indelindex -> tuple("${tumor}_vs_${normal}", - vcfs.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).somatic.snvs.vcf.gz/)[0][1].toInteger() },vcfindex, - indels.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).somatic.indels.vcf.gz/)[0][1].toInteger() } ,indelindex)} - | combineVariants_strelka | join(sample_sheet_paired) - | map{sample,markedvcf,markedindex,finalvcf,finalindex,tumor,normal -> tuple(tumor,normal,"strelka",finalvcf,finalindex)} - annotvep_tn_strelka(strelka_in) - - - //Vardict TN - vardict_in=vardict_tn(bambyinterval) | groupTuple(by:[0,1]) - | map{tumor,normal,vcf-> tuple("${tumor}_vs_${normal}",vcf.toSorted{it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).vardict.vcf/)[0][1].toInteger()},"vardict")} - | combineVariants_vardict | join(sample_sheet_paired) - | map{sample,marked,markedindex,normvcf,normindex,tumor,normal ->tuple(tumor,normal,"vardict",normvcf,normindex)} - annotvep_tn_vardict(vardict_in) - - //VarDict TOnly - vardict_in_tonly=vardict_tonly(bambyinterval_t) - | groupTuple() - | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.vardict.vcf/)[0][1].toInteger()},"vardict_tonly")} - | combineVariants_vardict_tonly | join(sample_sheet) - | map{tumor,marked,markedindex,normvcf,normindex,normal ->tuple(tumor,"vardict_tonly",normvcf,normindex)} - annotvep_tonly_vardict(vardict_in_tonly) - - //VarScan TN - varscan_in=bambyinterval.combine(contamination_paired.out,by:0) - | varscan_tn | groupTuple(by:[0,1]) - | map{tumor,normal,vcf-> tuple("${tumor}_vs_${normal}",vcf.toSorted{it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).varscan.vcf.gz/)[0][1].toInteger()},"varscan")} - | combineVariants_varscan | join(sample_sheet_paired) - | map{sample,marked,markedindex,normvcf,normindex,tumor,normal ->tuple(tumor,normal,"varscan",normvcf,normindex)} - annotvep_tn_varscan(varscan_in) - - - //VarScan TOnly - varscan_in_tonly=bambyinterval_t.combine(contamination_tumoronly.out,by:0) - | varscan_tonly | groupTuple - | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.varscan.vcf.gz/)[0][1].toInteger()},"varscan_tonly")} - | combineVariants_varscan_tonly - | join(sample_sheet) - | map{tumor,marked,markedindex,normvcf,normindex,normal ->tuple(tumor,"varscan_tonly",normvcf,normindex)} - annotvep_tonly_varscan(varscan_in_tonly) + if ("strelka" in params.callist){ + //Strelka TN + strelka_in=strelka_tn(bambyinterval) | groupTuple(by:[0,1]) + | map { tumor,normal,vcfs,vcfindex,indels,indelindex -> tuple("${tumor}_vs_${normal}", + vcfs.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).somatic.snvs.vcf.gz/)[0][1].toInteger() },vcfindex, + indels.toSorted{ it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).somatic.indels.vcf.gz/)[0][1].toInteger() } ,indelindex)} + | combineVariants_strelka | join(sample_sheet_paired) + | map{sample,markedvcf,markedindex,finalvcf,finalindex,tumor,normal -> tuple(tumor,normal,"strelka",finalvcf,finalindex)} + annotvep_tn_strelka(strelka_in) + + vc_all=vc_all|concat(strelka_in) + + + } + + if ("vardict" in params.callist){ + //Vardict TN + vardict_in=vardict_tn(bambyinterval) | groupTuple(by:[0,1]) + | map{tumor,normal,vcf-> tuple("${tumor}_vs_${normal}",vcf.toSorted{it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).vardict.vcf/)[0][1].toInteger()},"vardict")} + | combineVariants_vardict | join(sample_sheet_paired) + | map{sample,marked,markedindex,normvcf,normindex,tumor,normal ->tuple(tumor,normal,"vardict",normvcf,normindex)} + annotvep_tn_vardict(vardict_in) + + //VarDict TOnly + vardict_in_tonly=vardict_tonly(bambyinterval_t) + | groupTuple() + | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.vardict.vcf/)[0][1].toInteger()},"vardict_tonly")} + | combineVariants_vardict_tonly | join(sample_sheet) + | map{tumor,marked,markedindex,normvcf,normindex,normal ->tuple(tumor,"vardict_tonly",normvcf,normindex)} + annotvep_tonly_vardict(vardict_in_tonly) + + vc_all=vc_all|concat(vardict_in) + vc_tonly=vc_tonly|concat(vardict_in_tonly) + } + + if ("varscan" in params.callist){ + //VarScan TN + varscan_in=bambyinterval.combine(contamination_paired.out,by:0) + | varscan_tn | groupTuple(by:[0,1]) + | map{tumor,normal,vcf-> tuple("${tumor}_vs_${normal}",vcf.toSorted{it -> (it.name =~ /${tumor}_vs_${normal}_(.*?).varscan.vcf.gz/)[0][1].toInteger()},"varscan")} + | combineVariants_varscan | join(sample_sheet_paired) + | map{sample,marked,markedindex,normvcf,normindex,tumor,normal ->tuple(tumor,normal,"varscan",normvcf,normindex)} + annotvep_tn_varscan(varscan_in) + + //VarScan TOnly + varscan_in_tonly=bambyinterval_t.combine(contamination_tumoronly.out,by:0) + | varscan_tonly | groupTuple + | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.varscan.vcf.gz/)[0][1].toInteger()},"varscan_tonly")} + | combineVariants_varscan_tonly + | join(sample_sheet) + | map{tumor,marked,markedindex,normvcf,normindex,normal ->tuple(tumor,"varscan_tonly",normvcf,normindex)} + annotvep_tonly_varscan(varscan_in_tonly) + + vc_all=vc_all|concat(varscan_in) + vc_tonly=vc_tonly|concat(varscan_in_tonly) + } + //Lofreq TN - lofreq_in=lofreq_tn(bambyinterval) | groupTuple(by:[0,1]) - | map{tu,no,snv,dbsnv,indel,dbindel,vcf,vcfindex-> tuple("${tu}_vs_${no}",vcf.toSorted{it -> (it.name =~ /${tu}_vs_${no}_(.*?)_lofreq.vcf.gz/)[0][1].toInteger()},vcfindex,"lofreq")} - | combineVariants_lofreq | join(sample_sheet_paired) - | map{sample,marked,markedindex,normvcf,normindex,tumor,normal->tuple(tumor,normal,"lofreq",normvcf,normindex)} - annotvep_tn_lofreq(lofreq_in) + if ("lofreq" in params.callist){ + lofreq_in=lofreq_tn(bambyinterval) | groupTuple(by:[0,1]) + | map{tu,no,snv,dbsnv,indel,dbindel,vcf,vcfindex-> tuple("${tu}_vs_${no}",vcf.toSorted{it -> (it.name =~ /${tu}_vs_${no}_(.*?)_lofreq.vcf.gz/)[0][1].toInteger()},vcfindex,"lofreq")} + | combineVariants_lofreq | join(sample_sheet_paired) + | map{sample,marked,markedindex,normvcf,normindex,tumor,normal->tuple(tumor,normal,"lofreq",normvcf,normindex)} + annotvep_tn_lofreq(lofreq_in) + + vc_all=vc_all|concat(lofreq_in) + } + //MuSE TN - muse_in=muse_tn(bamwithsample) - | map{tumor,normal,vcf-> tuple("${tumor}_vs_${normal}",vcf,"muse")} - | combineVariants_muse | join(sample_sheet_paired) - | map{sample,marked,markedindex,normvcf,normindex,tumor,normal ->tuple(tumor,normal,"muse",normvcf,normindex)} - annotvep_tn_muse(muse_in) + if ("muse" in params.callist){ + muse_in=muse_tn(bamwithsample) + | map{tumor,normal,vcf-> tuple("${tumor}_vs_${normal}",vcf,"muse")} + | combineVariants_muse | join(sample_sheet_paired) + | map{sample,marked,markedindex,normvcf,normindex,tumor,normal ->tuple(tumor,normal,"muse",normvcf,normindex)} + annotvep_tn_muse(muse_in) + + vc_all=vc_all|concat(muse_in) + } //Octopus TN - octopus_in=octopus_tn(bambyinterval) | bcftools_index_octopus - | groupTuple() - | map{samplename,vcf,vcfindex-> tuple(samplename,vcf.toSorted{it->(it.name =~ /${samplename}_(.*).octopus.vcf.gz/)[0][1].toInteger()},vcfindex,"octopus")} - | combineVariants_octopus - | map{samplename,marked,markedindex,normvcf,normindex -> - tuple(samplename.split('_vs_')[0],samplename.split('_vs_')[1],"octopus",normvcf,normindex)} - annotvep_tn_octopus(octopus_in) - octopus_in_sc = octopus_in | octopus_convertvcf - | map{tumor,normal,vcf,vcfindex ->tuple(tumor,normal,"octopus",vcf,vcfindex)} + if ("octopus" in params.callist){ + octopus_in=octopus_tn(bambyinterval) | bcftools_index_octopus + | groupTuple() + | map{samplename,vcf,vcfindex-> tuple(samplename,vcf.toSorted{it->(it.name =~ /${samplename}_(.*).octopus.vcf.gz/)[0][1].toInteger()},vcfindex,"octopus")} + | combineVariants_octopus + | map{samplename,marked,markedindex,normvcf,normindex -> + tuple(samplename.split('_vs_')[0],samplename.split('_vs_')[1],"octopus",normvcf,normindex)} + annotvep_tn_octopus(octopus_in) + octopus_in_sc = octopus_in | octopus_convertvcf + | map{tumor,normal,vcf,vcfindex ->tuple(tumor,normal,"octopus",vcf,vcfindex)} //Octopus TOnly - octopus_in_tonly=octopus_tonly(bambyinterval_t) - | bcftools_index_octopus_tonly - | groupTuple() - | map{samplename,vcf,vcfindex->tuple(samplename,vcf.toSorted{it->(it.name =~ /${samplename}_(.*).tonly.octopus.vcf.gz/)[0][1].toInteger()},vcfindex,"octopus_tonly")} - | combineVariants_octopus_tonly - | join(sample_sheet) | - map{tumor,marked,markedindex,normvcf,normindex,normal ->tuple(tumor,"octopus_tonly",normvcf,normindex)} - annotvep_tonly_octopus(octopus_in_tonly) - octopus_in_tonly_sc=octopus_in_tonly | octopus_convertvcf_tonly - | map{tumor,vcf,vcfindex ->tuple(tumor,"octopus_tonly",vcf,vcfindex)} - - //Combine All Variants Using VCF and Then Reannotate - mutect2_in|concat(strelka_in) | concat(octopus_in_sc) | concat(muse_in) | concat(lofreq_in) - | concat(vardict_in) |concat(varscan_in) | groupTuple(by:[0,1]) - | somaticcombine - | map{tumor,normal,vcf,index ->tuple(tumor,normal,"combined",vcf,index)} - | annotvep_tn_combined - - mutect2_in_tonly|concat(octopus_in_tonly_sc) - | concat(vardict_in_tonly)|concat(varscan_in_tonly) | groupTuple() - | somaticcombine_tonly - | map{tumor,vcf,index ->tuple(tumor,"combined_tonly",vcf,index)} - | annotvep_tonly_combined + octopus_in_tonly=octopus_tonly(bambyinterval_t) + | bcftools_index_octopus_tonly + | groupTuple() + | map{samplename,vcf,vcfindex->tuple(samplename,vcf.toSorted{it->(it.name =~ /${samplename}_(.*).tonly.octopus.vcf.gz/)[0][1].toInteger()},vcfindex,"octopus_tonly")} + | combineVariants_octopus_tonly + | join(sample_sheet) + | map{tumor,marked,markedindex,normvcf,normindex,normal ->tuple(tumor,"octopus_tonly",normvcf,normindex)} + annotvep_tonly_octopus(octopus_in_tonly) + octopus_in_tonly_sc=octopus_in_tonly | octopus_convertvcf_tonly + | map{tumor,vcf,vcfindex ->tuple(tumor,"octopus_tonly",vcf,vcfindex)} + + vc_all=vc_all|concat(octopus_in_sc) + vc_tonly=vc_tonly|concat(octopus_in_tonly) + } + + + //Combine All Variants Using VCF -> Annotate + if (params.callist.size()>1){ + vc_all | groupTuple(by:[0,1]) + | somaticcombine + | map{tumor,normal,vcf,index ->tuple(tumor,normal,"combined",vcf,index)} + | annotvep_tn_combined + } + + + if (params.callist.size()>1){ + vc_tonly + | somaticcombine_tonly + | map{tumor,vcf,index ->tuple(tumor,normal,"combined_tonly",vcf,index)} + | annotvep_tn_combined + } + //Implement PCGR Annotator/CivIC Next + if ("octopus" in params.callist){ + somaticcall_input=octopus_in_sc + }else if("mutect2" in params.callist){ + somaticcall_input=mutect2_in + } emit: - somaticcall_input=octopus_in - + somaticcall_input } @@ -581,7 +630,7 @@ workflow INPUT_BAM { tuple(sample, file(bam),file(bai)) } } - + intervalbedin = Channel.fromPath(params.genomes[params.genome].intervals,checkIfExists: true,type: 'file') splitinterval(intervalbedin) if (params.indelrealign){ diff --git a/subworkflows/local/workflows_tonly.nf b/subworkflows/local/workflows_tonly.nf index 9673e9c..eeae1e9 100644 --- a/subworkflows/local/workflows_tonly.nf +++ b/subworkflows/local/workflows_tonly.nf @@ -1,10 +1,3 @@ -//All Worksflows in One Place -// TODO split subworkflows out into one per file -// TODO: this line should be moved to within a subworkflow or the main workflow -intervalbedin = Channel.fromPath(params.genomes[params.genome].intervals,checkIfExists: true,type: 'file') - - - include {fc_lane; fastq_screen;kraken;qualimap_bamqc; samtools_flagstats;vcftools;collectvariantcallmetrics; bcftools_stats;gatk_varianteval; @@ -47,6 +40,8 @@ include {freec; amber_tonly; cobalt_tonly; purple } from '../../modules/local/c include {splitinterval} from '../../modules/local/splitbed.nf' + + workflow INPUT_TONLY { if(params.fastq_input){ fastqinput=Channel.fromFilePairs(params.fastq_input) @@ -89,6 +84,7 @@ workflow ALIGN_TONLY { main: fastp(fastqinput) + intervalbedin = Channel.fromPath(params.genomes[params.genome].intervals,checkIfExists: true,type: 'file') splitinterval(intervalbedin) bwamem2(fastp.out) @@ -132,63 +128,80 @@ workflow VC_TONLY { sample_sheet main: - bambyinterval=bamwithsample.combine(splitout.flatten()) - pileup_paired_tonly(bambyinterval) - pileup_paired_tout=pileup_paired_tonly.out.groupTuple() - .map{samplename,pileups-> tuple( samplename, - pileups.toSorted{ it -> (it.name =~ /${samplename}_(.*?).tumor.pileup.table/)[0][1].toInteger() } , - )} - mutect2_t_tonly(bambyinterval) - - mutect2_t_tonly.out.groupTuple() - | multiMap { tumor,vcfs,f1r2,stats -> - mut2tout_lor: tuple(tumor, - f1r2.toSorted{ it -> (it.name =~ /${tumor}_(.*?).f1r2.tar.gz/)[0][1].toInteger() } ) - mut2tonly_mstats: tuple( tumor, - stats.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz.stats/)[0][1].toInteger() }) - allmut2tonly: tuple(tumor, - vcfs.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz/)[0][1].toInteger() } ) - } - | set{mut2tonlyout} - - - - learnreadorientationmodel_tonly(mut2tonlyout.mut2tout_lor) - mergemut2stats_tonly(mut2tonlyout.mut2tonly_mstats) - contamination_tumoronly(pileup_paired_tout) + //Common steps + params.callers = "mutect2,octopus,vardict,varscan" + params.callist = params.callers.split(',') as List - - mut2tonly_filter=mut2tonlyout.allmut2tonly - | join(mergemut2stats_tonly.out) - | join(learnreadorientationmodel_tonly.out) - | join(contamination_tumoronly.out) + vc_tonly=Channel.empty() - mutect2_tonly_in=mutect2filter_tonly(mut2tonly_filter) - | join(sample_sheet) - | map{tumor,markedvcf,markedindex,finalvcf,finalindex,stats -> tuple(tumor,"mutect2_tonly",finalvcf,finalindex)} - annotvep_tonly_mut2(mutect2_tonly_in) + if ("mutect2" in params.callist | "varscan" in params.callist){ + pileup_paired_tonly(bambyinterval) + pileup_paired_tout=pileup_paired_tonly.out.groupTuple() + .map{samplename,pileups-> tuple( samplename, + pileups.toSorted{ it -> (it.name =~ /${samplename}_(.*?).tumor.pileup.table/)[0][1].toInteger() } , + )} + contamination_tumoronly(pileup_paired_tout) + } + //Mutect2 + if ("mutect2" in params.callist){ + mutect2_t_tonly(bambyinterval) + + mutect2_t_tonly.out.groupTuple() + | multiMap { tumor,vcfs,f1r2,stats -> + mut2tout_lor: tuple(tumor, + f1r2.toSorted{ it -> (it.name =~ /${tumor}_(.*?).f1r2.tar.gz/)[0][1].toInteger() } ) + mut2tonly_mstats: tuple( tumor, + stats.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz.stats/)[0][1].toInteger() }) + allmut2tonly: tuple(tumor, + vcfs.toSorted{ it -> (it.name =~ /${tumor}_(.*?).tonly.mut2.vcf.gz/)[0][1].toInteger() } ) + } + | set{mut2tonlyout} + + learnreadorientationmodel_tonly(mut2tonlyout.mut2tout_lor) + mergemut2stats_tonly(mut2tonlyout.mut2tonly_mstats) + + mut2tonly_filter=mut2tonlyout.allmut2tonly + | join(mergemut2stats_tonly.out) + | join(learnreadorientationmodel_tonly.out) + | join(contamination_tumoronly.out) + + mutect2_in_tonly=mutect2filter_tonly(mut2tonly_filter) + | join(sample_sheet) + | map{tumor,markedvcf,markedindex,finalvcf,finalindex,stats -> tuple(tumor,"mutect2_tonly",finalvcf,finalindex)} + annotvep_tonly_mut2(mutect2_in_tonly) + + vc_tonly=vc_tonly|concat(mutect2_in_tonly) + } //VarDict - vardict_in_tonly=vardict_tonly(bambyinterval) | groupTuple() - | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.vardict.vcf/)[0][1].toInteger()},"vardict_tonly")} - | combineVariants_vardict_tonly - | join(sample_sheet) - | map{tumor,marked,markedindex,normvcf,normindex ->tuple(tumor,"vardict_tonly",normvcf,normindex)} - annotvep_tonly_vardict(vardict_in_tonly) + if ("vardict" in params.callist){ + vardict_in_tonly=vardict_tonly(bambyinterval) | groupTuple() + | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.vardict.vcf/)[0][1].toInteger()},"vardict_tonly")} + | combineVariants_vardict_tonly + | join(sample_sheet) + | map{tumor,marked,markedindex,normvcf,normindex ->tuple(tumor,"vardict_tonly",normvcf,normindex)} + annotvep_tonly_vardict(vardict_in_tonly) + vc_tonly=vc_tonly.concat(vardict_in_tonly) + } + //VarScan_tonly - varscan_in_tonly=bambyinterval.combine(contamination_tumoronly.out,by: 0) - | varscan_tonly | groupTuple() - | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.varscan.vcf/)[0][1].toInteger()},"varscan_tonly")} - | combineVariants_varscan_tonly - | join(sample_sheet) - | map{tumor,marked,markedindex,normvcf,normindex ->tuple(tumor,"varscan_tonly",normvcf,normindex)} - annotvep_tonly_varscan(varscan_in_tonly) - + if ("varscan" in params.callist){ + varscan_in_tonly=bambyinterval.combine(contamination_tumoronly.out,by: 0) + | varscan_tonly | groupTuple() + | map{tumor,vcf-> tuple(tumor,vcf.toSorted{it -> (it.name =~ /${tumor}_(.*?).tonly.varscan.vcf/)[0][1].toInteger()},"varscan_tonly")} + | combineVariants_varscan_tonly + | join(sample_sheet) + | map{tumor,marked,markedindex,normvcf,normindex ->tuple(tumor,"varscan_tonly",normvcf,normindex)} + annotvep_tonly_varscan(varscan_in_tonly) + vc_tonly=vc_tonly|concat(varscan_in_tonly) + } + //Octopus_tonly + if ("octopus" in params.callist){ octopus_in_tonly=bambyinterval | octopus_tonly | bcftools_index_octopus | groupTuple() | map{tumor,vcf,vcfindex -> tuple(tumor,vcf.toSorted{it -> it.name} @@ -198,21 +211,31 @@ workflow VC_TONLY { annotvep_tonly_octopus(octopus_in_tonly) octopus_in_tonly_sc=octopus_in_tonly | octopus_convertvcf_tonly | map{tumor,normvcf,normindex ->tuple(tumor,"octopus_tonly",normvcf,normindex)} + vc_tonly=vc_tonly|concat(octopus_in_tonly_sc) + } //Combined Variants and Annotated - mutect2_tonly_in | concat(octopus_in_tonly_sc) - | concat(vardict_in_tonly) | concat(varscan_in_tonly) - | groupTuple() - | somaticcombine_tonly - | map{tumor,vcf,index ->tuple(tumor,"combined_tonly",vcf,index)} - | annotvep_tonly_combined - - + if (params.callist.size()>1){ + vc_tonly + | groupTuple() | view() + | somaticcombine_tonly + | map{tumor,vcf,index ->tuple(tumor,"combined_tonly",vcf,index)} + | annotvep_tonly_combined + } + + //Emit for SC downstream, take Oc/Mu2/Vard/Varscan + if("octopus" in params.callist){ + somaticcall_input=octopus_in_tonly_sc + }else if("mutect2" in params.callist){ + somaticcall_input=mutect2_in_tonly + }else if("vardict" in params.calllist){ + somaticcall_input=vardict_in_tonly + }else if("varscan" in params.calllist){ + somaticcall_input=varscan_in_tonly + } emit: - somaticcall_input=octopus_in_tonly - - + somaticcall_input } @@ -358,7 +381,7 @@ workflow INPUT_TONLY_BAM { sample_sheet=baminputonly.map{samplename,bam,bai -> tuple ( samplename)} } - + intervalbedin = Channel.fromPath(params.genomes[params.genome].intervals,checkIfExists: true,type: 'file') splitinterval(intervalbedin) bamwithsample=baminputonly