-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtranscript_annotation.nf
130 lines (110 loc) · 5.25 KB
/
transcript_annotation.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
========================================================================================
Annotation Nextflow Workflow
========================================================================================
Github :
Contact :
----------------------------------------------------------------------------------------
*/
nextflow.enable.dsl=2
// Display pipeline details
println """\
T R A N S C R I P T - A N N O T A T I O N - N F P I P E L I N E
===================================
genome : ${params.genome}
fastq : ${params.reads}
outdir : ${params.outdir}
"""
.stripIndent()
/*
========================================================================================
Pipeline Modules
========================================================================================
*/
include { read_conf; get_path; get_genome_desc; create_channel_from_path; UNCOMPRESS } from './modules/common.nf'
include { FILTER_READ } from './modules/filterreads.nf'
include { INDEX_GENOME } from './modules/mapping.nf'
include { READ_MAPPING } from './modules/mapping.nf'
include { FILTER_SAM } from './modules/filtersam.nf'
include { COMPUTE_EXPRESSION } from './modules/expression.nf'
include { ISOQUANT } from './modules/isoquant.nf'
include { MERGE_FASTQ } from './modules/merge_fastq.nf'
include { RNA_BLOOM } from './modules/rnabloom.nf'
include { RNABLOOM_MINIMAP2 } from './modules/rnabloom_minimap2.nf'
include { RNABLOOM_PATHTOOLS } from './modules/rnabloom_pathtools.nf'
include { RNABLOOM_AGAT } from './modules/agat.nf'
include { SAMTOOLS } from './modules/samtools.nf'
include { SAMTOOLS_MERGE } from './modules/samtools_merge.nf'
/*
========================================================================================
Create Channels
========================================================================================
*/
genome_ch = Channel.of( params.genome )
annot_ch = Channel.of( params.annotation )
reads_ch = Channel.fromPath( params.reads, checkIfExists:true )
// channel for optional short reads
shortread_ch = params.optional_shortread != null ? file(params.optional_shortread, type: "file") : file("no_shortread", type: "file")
// Eoulsan modules input parameters
params.mapperName = "minimap2"
params.mapperVersion = "2.24"
params.mapperFlavor = ""
params.indexerArguments = "-x splice"
params.mappersArguments = "-x splice --eqx --secondary=no"
params.tmpDir = projectDir + "/tmp"
params.binaryDir = "/tmp"
params.storages = read_conf()
params.readFilteringConf = [ "trimpolynend" : "" ]
params.samFilteringConf = [ "removeunmapped" : "true", "quality.threshold" : "1", "removesupplementary": "true", "removemultimatches" : "true" ]
params.expressionConf = [ "genomic.type" : "exon", "attribute.id" : "gene_id", "stranded" : "no", "overlap.mode" : "union", "remove.ambiguous.cases" : "false" ]
/*
========================================================================================
WORKFLOW - Transcript Annotation
========================================================================================
*/
workflow {
// Index creation
index_ch = INDEX_GENOME(genome_ch, params.mapperName, params.mapperVersion, params.mapperFlavor, params.storages, params.tmpDir, params.binaryDir, params.indexerArguments)
genome_ch = create_channel_from_path(params.genome, params.storages)
uncompress_ch = UNCOMPRESS(genome_ch)
// Reads filtering
filterreads_ch = FILTER_READ(reads_ch, params.readFilteringConf)
// Mapping
filterreads_ch.combine(index_ch).set { reads_index_combined_ch }
mapping_ch = READ_MAPPING(reads_index_combined_ch, params.mapperName, params.mapperVersion, params.mapperFlavor, params.tmpDir, params.binaryDir, params.mappersArguments)
// Alignments filtering
filtersam_ch = FILTER_SAM(mapping_ch, params.samFilteringConf, params.tmpDir)
// Expression computation
filtersam_ch.combine(annot_ch).combine(genome_ch).set { filtersam_annot_combined_ch }
expression_ch = COMPUTE_EXPRESSION(filtersam_annot_combined_ch, params.expressionConf, "True", params.storages)
// Launch transcript annotation modules: Isoquant + RNABloom
SAMTOOLS(FILTER_SAM.out.filtered_sam)
SAMTOOLS_MERGE(SAMTOOLS.out.samtools_bam.collect())
ISOQUANT(uncompress_ch, SAMTOOLS_MERGE.out.samtools_mergedbam)
MERGE_FASTQ(FILTER_READ.out.eoulsan_fasta.collect())
RNA_BLOOM(MERGE_FASTQ.out.merged_fastq, shortread_ch)
RNABLOOM_MINIMAP2(uncompress_ch, RNA_BLOOM.out.rnabloom_fasta)
RNABLOOM_PATHTOOLS(RNABLOOM_MINIMAP2.out.rnabloom_sam)
RNABLOOM_AGAT(RNABLOOM_PATHTOOLS.out.rnabloom_bed)
}
// Display pipeline execution summary upon completion
workflow.onComplete {
println (workflow.success ? """
Pipeline execution summary
---------------------------
Completed at: ${workflow.complete}
Duration : ${workflow.duration}
Success : ${workflow.success}
workDir : ${workflow.workDir}
exit status : ${workflow.exitStatus}
""" : """
Failed: ${workflow.errorReport}
exit status : ${workflow.exitStatus}
"""
)
}
/*
========================================================================================
THE END
========================================================================================
*/