Skip to content

Commit 4e74bcd

Browse files
committed
Leave workflow file solution in main dir as previous
1 parent 7c0f8d7 commit 4e74bcd

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

nf4-science/genomics/genomics-4.nf

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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

Comments
 (0)