|
| 1 | +#!/usr/bin/env nextflow |
| 2 | + |
| 3 | +/* |
| 4 | + * Pipeline parameters |
| 5 | + */ |
| 6 | + |
| 7 | +// Primary input (file of input files, one per line) |
| 8 | +params.reads_bam = "${projectDir}/data/sample_bams.txt" |
| 9 | + |
| 10 | +// Output directory |
| 11 | +params.outdir = "results_genomics" |
| 12 | + |
| 13 | +// Accessory files |
| 14 | +params.reference = "${projectDir}/data/ref/ref.fasta" |
| 15 | +params.reference_index = "${projectDir}/data/ref/ref.fasta.fai" |
| 16 | +params.reference_dict = "${projectDir}/data/ref/ref.dict" |
| 17 | +params.intervals = "${projectDir}/data/ref/intervals.bed" |
| 18 | + |
| 19 | +// Base name for final output file |
| 20 | +params.cohort_name = "family_trio" |
| 21 | + |
| 22 | +include { SAMTOOLS_INDEX } from './modules/samtools/index/main.nf' |
| 23 | +include { GATK_HAPLOTYPECALLER } from './modules/gatk/haplotypecaller/main.nf' |
| 24 | +include { GATK_JOINTGENOTYPING } from './modules/gatk/jointgenotyping/main.nf' |
| 25 | + |
| 26 | + |
| 27 | +workflow { |
| 28 | + |
| 29 | + // Create input channel from a text file listing input file paths |
| 30 | + reads_ch = Channel.fromPath(params.reads_bam).splitText() |
| 31 | + |
| 32 | + // Load the file paths for the accessory files (reference and intervals) |
| 33 | + ref_file = file(params.reference) |
| 34 | + ref_index_file = file(params.reference_index) |
| 35 | + ref_dict_file = file(params.reference_dict) |
| 36 | + intervals_file = file(params.intervals) |
| 37 | + |
| 38 | + // Create index file for input BAM file |
| 39 | + SAMTOOLS_INDEX(reads_ch) |
| 40 | + |
| 41 | + // Call variants from the indexed BAM file |
| 42 | + GATK_HAPLOTYPECALLER( |
| 43 | + SAMTOOLS_INDEX.out, |
| 44 | + ref_file, |
| 45 | + ref_index_file, |
| 46 | + ref_dict_file, |
| 47 | + intervals_file |
| 48 | + ) |
| 49 | + |
| 50 | + // Collect variant calling outputs across samples |
| 51 | + all_gvcfs_ch = GATK_HAPLOTYPECALLER.out.vcf.collect() |
| 52 | + all_idxs_ch = GATK_HAPLOTYPECALLER.out.idx.collect() |
| 53 | + |
| 54 | + // Combine GVCFs into a GenomicsDB data store and apply joint genotyping |
| 55 | + GATK_JOINTGENOTYPING( |
| 56 | + all_gvcfs_ch, |
| 57 | + all_idxs_ch, |
| 58 | + intervals_file, |
| 59 | + params.cohort_name, |
| 60 | + ref_file, |
| 61 | + ref_index_file, |
| 62 | + ref_dict_file |
| 63 | + ) |
| 64 | +} |
0 commit comments