This repository has been archived by the owner on Jul 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
strandedness.nf
78 lines (63 loc) · 3.97 KB
/
strandedness.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Workflow that determines the strandedness of reads compared to a reference genome bed file
include { SORT_INDEX_BAM } from './modules/rseqc.nf' addParams(PublishTo: "02-STAR_Alignment")
include { GENEBODY_COVERAGE } from './modules/rseqc.nf' addParams(PublishTo: "RSeQC_Analyses/02_geneBody_coverage")
include { INFER_EXPERIMENT } from './modules/rseqc.nf' addParams(PublishTo: "RSeQC_Analyses/03_infer_experiment")
include { INNER_DISTANCE } from './modules/rseqc.nf' addParams(PublishTo: "RSeQC_Analyses/04_inner_distance")
include { READ_DISTRIBUTION } from './modules/rseqc.nf' addParams(PublishTo: "RSeQC_Analyses/05_read_distribution")
include { ASSESS_STRANDEDNESS } from './modules/rseqc.nf'
include { MULTIQC as GENEBODY_COVERAGE_MULTIQC } from './modules/quality.nf' addParams(PublishTo: "RSeQC_Analyses/02_geneBody_coverage", MQCLabel:"geneBody_cov")
include { MULTIQC as INFER_EXPERIMENT_MULTIQC } from './modules/quality.nf' addParams(PublishTo: "RSeQC_Analyses/03_infer_experiment", MQCLabel:"infer_exp")
include { MULTIQC as INNER_DISTANCE_MULTIQC } from './modules/quality.nf' addParams(PublishTo: "RSeQC_Analyses/04_inner_distance", MQCLabel:"inner_dist")
include { MULTIQC as READ_DISTRIBUTION_MULTIQC } from './modules/quality.nf' addParams(PublishTo: "RSeQC_Analyses/05_read_distribution", MQCLabel:"read_dist")
workflow strandedness{
take:
bam_array // array: sample-wise tuples (meta, bam_file)
genome_bed
samples_ch
main:
bam_array | SORT_INDEX_BAM
SORT_INDEX_BAM.out.bam | combine( genome_bed ) | set { ch_bam_bed }
INFER_EXPERIMENT( ch_bam_bed )
GENEBODY_COVERAGE( ch_bam_bed )
INNER_DISTANCE( ch_bam_bed )
READ_DISTRIBUTION( ch_bam_bed )
// duplicated in each subworkflow, could use refactoring
ch_multiqc_config = params.multiqcConfig ? Channel.fromPath( params.multiqcConfig ) : Channel.fromPath("NO_FILE")
INFER_EXPERIMENT_MULTIQC( samples_ch, INFER_EXPERIMENT.out.log | map { it[1] } | collect, ch_multiqc_config )
GENEBODY_COVERAGE_MULTIQC( samples_ch, GENEBODY_COVERAGE.out.log | map { it[1] } | collect, ch_multiqc_config )
INNER_DISTANCE_MULTIQC( samples_ch, INNER_DISTANCE.out.log | map { it[1] } | collect, ch_multiqc_config )
READ_DISTRIBUTION_MULTIQC( samples_ch, READ_DISTRIBUTION.out.log | map { it[1] } | collect, ch_multiqc_config )
ch_software_versions = Channel.empty()
ch_software_versions | mix(INFER_EXPERIMENT.out.version,
GENEBODY_COVERAGE.out.version,
SORT_INDEX_BAM.out.version,
INNER_DISTANCE.out.version,
READ_DISTRIBUTION.out.version)
| set{ ch_software_versions }
INFER_EXPERIMENT.out.log | map { it[1] }
| collect
| set { ch_infer_expt }
ch_infer_expt | ASSESS_STRANDEDNESS
ch_rseqc_mqc_reports = Channel.empty()
ch_rseqc_mqc_reports | mix(INFER_EXPERIMENT_MULTIQC.out.zipped_report,
INNER_DISTANCE_MULTIQC.out.zipped_report,
READ_DISTRIBUTION_MULTIQC.out.zipped_report,
GENEBODY_COVERAGE_MULTIQC.out.zipped_report)
| collect
| set{ ch_rseqc_mqc_reports }
ch_rseqc_logs = Channel.empty()
ch_rseqc_logs | mix(INFER_EXPERIMENT.out.log_only,
GENEBODY_COVERAGE.out.log_only,
INNER_DISTANCE.out.log_only,
READ_DISTRIBUTION.out.log_only)
| collect
| set{ ch_rseqc_logs }
emit:
strandedness = ASSESS_STRANDEDNESS.out
infer_expt = ch_infer_expt
versions = ch_software_versions
rseqc_logs = ch_rseqc_logs
infer_expt_mqc = INFER_EXPERIMENT_MULTIQC.out.data
mqc_reports = ch_rseqc_mqc_reports
bam_bed = SORT_INDEX_BAM.out.bam_only_files
}