-
Notifications
You must be signed in to change notification settings - Fork 2
/
rnaseq-toy.nf
89 lines (76 loc) · 2.32 KB
/
rnaseq-toy.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
#!/usr/bin/env nextflow
/*
* Copyright 2020-2022, Seqera Labs
* Copyright 2013-2019, Centre for Genomic Regulation (CRG)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
nextflow.enable.dsl=1
/*
* Defines pipeline parameters in order to specify the refence genomes
* and read pairs by using the command line options
*/
params.reads = "$baseDir/data/ggal/*_{1,2}.fq"
params.genome = "$baseDir/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"
/*
* The reference genome file
*/
genome_file = file(params.genome)
/*
* Creates the `read_pairs` channel that emits for each read-pair a tuple containing
* three elements: the pair ID, the first read-pair file and the second read-pair file
*/
Channel
.fromFilePairs( params.reads )
.ifEmpty { error "Cannot find any reads matching: ${params.reads}" }
.set { read_pairs }
/*
* Step 1. Builds the genome index required by the mapping process
*/
process buildIndex {
input:
file genome from genome_file
output:
file 'genome.index*' into genome_index
"""
bowtie2-build ${genome} genome.index
"""
}
/*
* Step 2. Maps each read-pair by using Tophat2 mapper tool
*/
process mapping {
input:
file genome from genome_file
file index from genome_index
set pair_id, file(reads) from read_pairs
output:
set pair_id, "tophat_out/accepted_hits.bam" into bam_files
"""
tophat2 genome.index ${reads}
"""
}
/*
* Step 3. Assembles the transcript by using the "cufflinks"
* and publish the transcript output files into the `results` folder
*/
process makeTranscript {
publishDir "results"
input:
set pair_id, bam_file from bam_files
output:
set pair_id, 'transcripts.gtf' into transcripts
"""
cufflinks ${bam_file}
"""
}