-
Notifications
You must be signed in to change notification settings - Fork 1
/
rnaseq.nf
92 lines (86 loc) · 2.93 KB
/
rnaseq.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
#!/usr/bin/env nextflow
VERSION="1.0"
nextflow.enable.dsl=2
// Include your modules and parameterize them
include { FASTQC } from './modules/FASTQC' params(params)
include { TRIM_GALORE } from './modules/TRIM_GALORE' params(params)
include { HISAT_INDEX } from './modules/HISAT' params(params)
include { HISAT_MAPPING } from './modules/HISAT' params(params)
include { FEATURE_COUNTS } from './modules/QUANT' params(params)
include { FEATURE_COUNTS_MATRIX } from './modules/QUANT' params(params)
include { ESET } from './modules/QUANT' params(params)
include { MULTIQC } from './modules/MULTIQC' params(params)
/*
// under construction (to replace load_reads)
def load_reads_from_csv(path, csv, paired) {
if (paired) {
Channel
.fromPath(csv).splitCsv(header: true)
.map {row -> [row.Sample_Name, [row.Read1, row.Read2]]}
.ifEmpty {error "File ${csv} not parsed properly"}
.into {reads;}
} else {
Channel
.fromPath(params.reads).splitCsv(header: true)
.map {row -> [row.Sample_Name, [row.Read1]]}
.ifEmpty {error "File ${params.reads} not parsed properly"}
.into {reads;}
}
}
*/
def load_reads(path, paired) {
if (paired) {
Channel
.fromFilePairs( path )
.set {reads}
} else {
Channel
.fromPath( path )
.map { [it.getName().split("\\_1|\\_2", 2)[0], [it]] }
.set {reads}
}
}
/**************************************************
* PAIRED-END RNA-SEQ
**************************************************/
workflow rnaseq_from_fastq_paired {
load_reads("${params.wd}/raw_data/*_{R1,R2}*.fastq*.gz", params.paired)
TRIM_GALORE( reads )
HISAT_MAPPING( TRIM_GALORE.out[0] )
FEATURE_COUNTS( HISAT_MAPPING.out[0], params.gtf)
FEATURE_COUNTS_MATRIX( FEATURE_COUNTS.out[0].collect() )
ESET( FEATURE_COUNTS_MATRIX.out[0] )
MULTIQC( ESET.out[0] )
}
// create a hisat index
workflow hisat_index {
HISAT_INDEX( params.fasta, params.gtf )
}
/**************************************************
* SINGLE-END RNA-SEQ
**************************************************/
workflow rnaseq_from_fastq_single {
load_reads("${params.wd}/data/rnaseq/reads/*_1.fq.gz", params.paired)
TRIM_GALORE( reads )
HISAT_MAPPING( TRIM_GALORE.out[0] )
FEATURE_COUNTS( HISAT_MAPPING.out[0], params.gtf)
FEATURE_COUNTS_MATRIX( FEATURE_COUNTS.out[0].collect() )
ESET( FEATURE_COUNTS_MATRIX.out[0] )
MULTIQC( ESET.out[0] )
}
/**************************************************
* RNA-SEQ FROM BAM
**************************************************/
def load_bams(path) {
Channel
.fromPath( path )
.map { [it.getName().split("\\.bam", 0)[0], [it]] }
.set {bams}
}
workflow rnaseq_frombam {
//load_bams("${params.outdir}/samples/ * /hisat/ *.bam")
FEATURE_COUNTS( bams, params.gtf)
FEATURE_COUNTS_MATRIX( FEATURE_COUNTS.out[0].collect() )
ESET( FEATURE_COUNTS_MATRIX.out[0] )
MULTIQC( ESET.out[0] )
}