-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.nf
68 lines (55 loc) · 1.89 KB
/
main.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
#!/usr/bin/env nextflow
import nextflow.splitter.CsvSplitter
def fetchRunAccessions( tsv ) {
def splitter = new CsvSplitter().options( header:true, sep:'\t' )
def reader = new BufferedReader( new FileReader( tsv ) )
splitter.parseHeader( reader )
List<String> run_accessions = []
Map<String,String> row
while( row = splitter.fetchRecord( reader ) ) {
run_accessions.add( row['run_accession'] )
}
return run_accessions
}
//---------------------------------------
// include the RNA seq workflow
//---------------------------------------
include { longRna } from './modules/longReadRnaSeq.nf'
//---------------------------------------------------------------
// Param Checking
//---------------------------------------------------------------
if(!params.referenceAnnotation) {
throw new Exception("Missing parameter params.referenceAnnotation")
}
if(!params.reference) {
throw new Exception("Missing parameter params.reference")
}
if(!params.reads && !params.sraAccession) {
throw new Exception("Missing parameter params.reads and parameter params.sraAccession")
}
if(!params.platform) {
throw new Exception("Missing parameter params.platform")
}
if(!params.build) {
throw new Exception("Missing parameter params.build")
}
if(!params.annotationName) {
throw new Exception("Missing parameter params.annotationName")
}
if(!params.results) {
throw new Exception("Missing parameter params.results")
}
if (params.local){
sample_ch = Channel
.fromPath([params.reads + '/*.fastq', params.reads + '/*.fastq.gz', params.reads + '/*.fq.gz'])
.splitFastq( by : params.splitChunk, file:true )
} else {
input = fetchRunAccessions(params.sraAccession)
sample_ch = Channel.fromList(input)
}
//--------------------------------------
// Process the workflow
//-------------------------------------
workflow {
longRna(sample_ch)
}