-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
56 lines (40 loc) · 1.81 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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
params.files = [] // List of files to process, no default values
params.msfragger_parameters = ''
params.database = ''
params.publishDir = './output' // Default publish directory
params.publishMode = 'link' // Set default mode (link or move)
include { parseFileList } from './lib/utils.groovy'
include { runMSconvert } from './workflows/msconvert.nf'
include { runMSFragger } from './workflows/msfragger.nf'
include { runPercolator } from './workflows/percolator.nf'
// Main workflow
workflow {
// Handle the input files as either a list of files or directory *.raw
def fileList = params.files instanceof String ? parseFileList(params.files) : params.files
println fileList
if (fileList.every { it.endsWith('.raw') }) {
// All files end in '.raw'
Channel.from(fileList)
.set { rawFileChannel }
runMSconvert(rawFileChannel)
.set { msConvertChannel }
// Collate to make sure we run 1 instance of MSFragger per output file from MSconvert
msConvertChannel.collate( 1, 1 )
.set { mzMLFileChannel }
} else if (fileList.every { it.endsWith('.mzML') }) {
// All files end in '.mzML', skip MSconvert step
Channel.from(fileList)
.set { mzMLFileChannel }
} else {
throw new IllegalArgumentException("All files must either end in '.raw' or '.mzML'")
}
// Run MSFragger
def resultFilesMsFragger = runMSFragger(mzMLFileChannel, params.msfragger_parameters, params.database).pin
// Collate to make sure we run 1 instance of Percolator per output file from MSFragger
resultFilesMsFragger.collate( 1, 1 )
.set { filteredPinChannelCollated }
// Run Percolator
def resultFilesPercolator = runPercolator(filteredPinChannelCollated)
}