-
Notifications
You must be signed in to change notification settings - Fork 0
/
align_methods.config
32 lines (29 loc) · 1.19 KB
/
align_methods.config
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
/**
* This methods namespace contains common functions for alignment pipeline input handling.
*/
align_methods {
/**
* Sets the parameters from the input which may be either a YAML (specified with key 'input')
* or a CSV (specified with key 'input_csv')
*/
set_params_from_input = {
if (params.containsKey('input_csv')) {
def reader = new BufferedReader(new FileReader(params.input_csv))
header_line = reader.readLine()
def csv_header_fields = header_line.split(',') as List
def raw_csv_input = csv_parser.parse_csv(params.input_csv, csv_header_fields)
// format the raw input so it matches the YAML
params.input = ['FASTQ': []]
// extract the inputs from the parsed csv
def extracted_inputs = [] as Set
raw_csv_input.each { csv_line ->
extracted_inputs.add(
csv_line
)
}
params.input.FASTQ = extracted_inputs
} else if (!(params.containsKey('input'))) {
throw new IllegalArgumentException('Neither YAML nor CSV inputs found! Please run pipeline with inputs.')
}
}
}