-
Notifications
You must be signed in to change notification settings - Fork 0
/
alignment.nf
59 lines (50 loc) · 2.54 KB
/
alignment.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
import groovy.json.JsonSlurper
include { INDEX_GENOME } from './subworkflows/index_genome/main'
include { FASTQ_FASTP_FASTQC } from './subworkflows/fastq_fastp_fastqc/main'
include { ALIGN_MARKDUP_BQSR_STATS } from './subworkflows/align_markdup_bqsr_stats/main'
// main workflow
workflow {
log.info """\
TMB estimation pipeline ${params.release}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sample sheet : ${params.input_json}
output dir : ${params.output_dir}
"""
// Read sample config file
def jsonSlurper = new JsonSlurper()
// If params.input_json exists, use that for multi sample processing.
// Otherwise, default to single sample analysis.
multi_params = params.input_json ? jsonSlurper.parse(new File(params.input_json)).collect{params + it} : [params]
output_dir = params.output_dir ? params.output_dir : "."
// run samples through the pipeline
samples = Channel.from(multi_params.collect{ it -> tuple([
id: it.specimen_id, pid: it.patient_id, single_end:false, tissue: it.tissue, purity: it.purity ],
[ file(it.read1, checkIfExists: true), file(it.read2, checkIfExists: true) ]) })
ch_versions = Channel.empty()
// Index genome reference
INDEX_GENOME ( [[ id:'genome'], file(params.reference_file, checkIfExists: true)])
// Trim sequence reads with paired-end data
FASTQ_FASTP_FASTQC ( samples,
file(params.adapter_fasta, checkIfExists:true),
params.save_trimmed_fail,
params.save_merged,
params.skip_fastp,
params.skip_fastqc )
ch_versions = ch_versions.mix( FASTQ_FASTP_FASTQC.out.versions )
// Align reads to a reference genome
ALIGN_MARKDUP_BQSR_STATS ( FASTQ_FASTP_FASTQC.out.reads,
INDEX_GENOME.out.index,
file(params.reference_file, checkIfExists: true),
params.val_sort_bam,
file(params.exome_plus_tumor_panel_bed, checkIfExists: true),
INDEX_GENOME.out.fai,
INDEX_GENOME.out.dict,
file(params.known_snp_vcf, checkIfExists: true),
file(params.known_snp_vcf_tbi, checkIfExists: true),
file(params.known_indel_vcf, checkIfExists: true),
file(params.known_indel_vcf_tbi, checkIfExists: true),
params.split_reads)
ch_versions = ch_versions.mix( ALIGN_MARKDUP_BQSR_STATS.out.versions )
}