-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiudex.nf
114 lines (88 loc) · 3.06 KB
/
iudex.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
#!/usr/bin/env nextflow
/*
vim: syntax=groovy
-*- mode: groovy;-*-
================================================================================
= S C R E E N I N G | H A P L O I D | P I P E L I N E =
================================================================================
@Author
Eric Davis <[email protected]>
--------------------------------------------------------------------------------
@Homepage
https://github.com/davisem/iudex
--------------------------------------------------------------------------------
@Documentation
https://github.com/davisem/iudex/blob/master/README.md
--------------------------------------------------------------------------------
@Licence
https://github.com/davisem/iudex/blob/master/LICENSE
--------------------------------------------------------------------------------
Processes overview
- Run the Iudex analysis pipeline
================================================================================
= C O N F I G U R A T I O N =
================================================================================
*/
if ( params.help ) {
help()
return
}
if( !nextflow.version.matches('0.25+') ) {
println "This workflow requires Nextflow version 0.25 or greater -- You are running version $nextflow.version"
println "Run ./nextflow self-update to update Nextflow to the latest available version."
exit 1
}
if ( params.index ) {
index = Channel.fromPath(params.index).toSortedList()
}
threads = params.threads
intron_bed = file(params.intron_bed)
exon_bed = file(params.exon_bed)
false_positive_probability = params.false_positive_probability
Channel
.fromPath( "${params.input_path}/*fastq" )
.ifEmpty { exit 1, "Fastq files could not be found in: ${params.input_path}" }
.set { gene_trap_insertions }
/*
* Pre-filters duplicate reads from the input fastqs.
*/
process FilterFastq {
publishDir "${params.output_dir}/FilterFastq", mode: "copy"
input:
file fastq from gene_trap_insertions
output:
file "${fastq.baseName}.filtered" into filtered_fastqs
"""
/src/fastq_filterer ${fastq} "${fastq.baseName}.filtered" ${false_positive_probability}
"""
}
/*
* Aligns fastq files to hg38
*/
process AlignToGenome {
publishDir "${params.output_dir}/Alignment", mode: "copy"
input:
file fastq from filtered_fastqs
file idx from index
output:
file "${fastq.baseName}.aln" into aligned_bams
"""
bwa mem hg38.fa ${fastq} -t ${threads} > sam
samtools view -bS sam | samtools sort -o "${fastq.baseName}.aln"
"""
}
/*
* Counts the gene trap insertions in genes, and compiles metrics
*/
process MakeInsertionTables {
publishDir "${params.output_dir}/Insertions", mode: "copy"
input:
file bam from aligned_bams
file intron_bed
file exon_bed
output:
file "${bam.baseName}.table" into insertion_table_csvs
"""
python /gene_trap/intron_exon_counts.py -i ${intron_bed} -e ${exon_bed} -b ${bam} -o "${bam.baseName}.table"
"""
}