-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainuzay.nf
More file actions
118 lines (93 loc) · 3 KB
/
Copy pathmainuzay.nf
File metadata and controls
118 lines (93 loc) · 3 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
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
#!/usr/bin/env nextflow
// --- USER INPUTS (EDIT THESE PATHS OR OVERRIDE VIA CLI) ---
params.reads = "/PATH/TO/FASTQ/*_{1,2}.fastq.gz" // EDIT
params.fasta = "/PATH/TO/REFERENCE/GENOME.fa" // EDIT
params.gtf = "/PATH/TO/ANNOTATION/GENCODE.gtf" // EDIT
params.outdir = "/PATH/TO/OUTPUT/DIRECTORY" // EDIT
process TrimGalore {
tag "$sample_id"
input:
tuple val(sample_id), path(reads)
output:
tuple val(sample_id),
path("${sample_id}_1_trim.fastq.gz"),
path("${sample_id}_2_trim.fastq.gz"),
path("fastqc_before/*_fastqc.*"),
path("fastqc_after/*_fastqc.*")
publishDir "${params.outdir}/TrimGalore", mode:'copy'
script:
"""
mkdir -p fastqc_before fastqc_after trim
fastqc --outdir fastqc_before --threads 4 ${reads[0]} ${reads[1]}
trim_galore --fastqc --paired --cores 4 --length 20 --quality 20 \
--output_dir trim \
${reads[0]} ${reads[1]}
mv trim/*val_1.fq.gz ${sample_id}_1_trim.fastq.gz
mv trim/*val_2.fq.gz ${sample_id}_2_trim.fastq.gz
mv trim/*_fastqc.zip fastqc_after/ || true
mv trim/*_fastqc.html fastqc_after/ || true
"""
}
process IndexGenome {
input:
tuple path(fasta), path(gtf)
output:
path "star_index"
publishDir "${params.outdir}/IndexGenome", mode:'copy'
script:
"""
mkdir -p star_index
STAR --runMode genomeGenerate \
--runThreadN 8 \
--genomeDir star_index \
--genomeFastaFiles $fasta \
--sjdbGTFfile $gtf \
--sjdbOverhang 100
"""
}
process AlignReads {
tag "$sample_id"
memory '72 GB'
cpus 16
input:
tuple path(star_index),
val(sample_id),
path(read1),
path(read2),
path("fastqc_before/*_fastqc.*"),
path("fastqc_after/*_fastqc.*")
output:
path "${sample_id}.sorted.bam"
publishDir "${params.outdir}/Alignment", mode:'copy'
script:
"""
STAR --runThreadN 4 \
--genomeDir ${star_index} \
--readFilesIn ${read1} ${read2} \
--readFilesCommand zcat \
--outSAMtype BAM SortedByCoordinate \
--outFileNamePrefix ${sample_id}.
mv ${sample_id}.Aligned.sortedByCoord.out.bam ${sample_id}.sorted.bam
"""
}
process RNAseqAnalysis {
publishDir "${params.outdir}/RNAseqAnalysis", mode: 'copy'
output:
path "*.tsv"
path "*.png"
path "*.pdf"
script:
"""
Rscript /PATH/TO/R_SCRIPT/counts_and_tests.R # EDIT
"""
}
workflow {
reads_ch = Channel.fromFilePairs(params.reads, checkIfExists: true)
fasta_ch = Channel.value(params.fasta)
gtf_ch = Channel.value(params.gtf)
fasta_gtf_ch = Channel.of([file(params.fasta), file(params.gtf)])
trimmed_reads_ch = reads_ch | TrimGalore
indexed_ch = fasta_gtf_ch | IndexGenome
indexed_ch.combine(trimmed_reads_ch) | AlignReads
RNAseqAnalysis()
}