-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.nf
More file actions
60 lines (56 loc) · 2.15 KB
/
Copy pathmain.nf
File metadata and controls
60 lines (56 loc) · 2.15 KB
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
60
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ADAPTER_TRIM } from './modules/local/adapter_trim'
include { STAR_GENOME_INDEX } from './modules/local/index_genome'
include { SUBSET_1KGP_VCF } from './modules/local/subset_1kgp'
include { STAR_ALIGNMENT_WASP } from './modules/local/alignment'
include { ALLELE_COUNT } from './modules/local/allele_count'
include { REPORT } from './modules/local/report'
include { CHECK_FASTQ } from './modules/local/check_fastq'
workflow {
star_idx_ch = STAR_GENOME_INDEX(
channel.fromPath(params.reference_fa),
channel.fromPath(params.gencode_gtf),
)
reads_ch = channel.fromPath(params.sample_sheet)
.splitCsv(header: true, sep: ",")
.map { row ->
def meta = [
sampleid: row.sample
]
[meta, file(row.fastq_1, checkIfExists: true), file(row.fastq_2, checkIfExists: true)]
}
.groupTuple(by: 0)
vcf_ch_in = channel.fromPath(params.sample_sheet)
.splitCsv(header: true, sep: ",")
.map { row ->
def meta = [
sampleid: row.sample
]
[meta, file(params.phased_vcf_dir)]
}
.unique()
merged_reads_ch = CHECK_FASTQ(reads_ch)
trimmed_reads_ch = ADAPTER_TRIM(merged_reads_ch)
vcf_ch = SUBSET_1KGP_VCF(vcf_ch_in)
align_in_ch = vcf_ch.subset_phased_vcf
.join(trimmed_reads_ch.reads)
.combine(star_idx_ch.star_index_dir)
.map { meta, vcf, fq1, fq2, star_dir ->
[meta, vcf, star_dir, fq1, fq2]
}
ac_in_ch = STAR_ALIGNMENT_WASP(align_in_ch)
if (params.regions_vcf) {
ALLELE_COUNT(
ac_in_ch.bam,
file(params.reference_fa),
file(params.regions_vcf, checkIfExists: true),
)
}
report_in_ch = channel.empty()
report_in_ch = report_in_ch.mix(trimmed_reads_ch.fastqc)
report_in_ch = report_in_ch.mix(trimmed_reads_ch.log.flatten())
report_in_ch = report_in_ch.mix(ac_in_ch.log.map { _meta, log_file -> log_file })
report_in_ch = report_in_ch.mix(ac_in_ch.stats.map { _meta, log_file -> log_file })
REPORT(report_in_ch.collect())
}