-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.nf
More file actions
55 lines (49 loc) · 1.81 KB
/
main.nf
File metadata and controls
55 lines (49 loc) · 1.81 KB
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
#!/usr/bin/env nextflow
// Workflow to format and export openscpca annotations
process format_annotations {
container params.scpcatools_slim_container
tag "${sample_id}"
label 'mem_8'
publishDir "${params.annotations_bucket}/${params.release_prefix}/${project_id}/${sample_id}", mode: 'copy'
input:
tuple val(sample_id),
val(project_id),
path(annotations_tsv_files),
val(annotation_metadata)
output:
tuple val(sample_id),
val(project_id),
path("*_openscpca-annotations.json")
script:
library_ids = annotations_tsv_files.collect{(it.name =~ /SCPCL\d{6}/)[0]}
"""
for library_id in ${library_ids.join(" ")};do
# get the input files for the library id
annotations_file=\$(ls ${annotations_tsv_files} | grep "\${library_id}")
export-celltype-json.R \
--annotations_tsv_file \$annotations_file \
--annotation_column "${annotation_metadata.annotation_column}" \
${annotation_metadata.ontology_column ? "--ontology_column '${annotation_metadata.ontology_column}'" : ''} \
--module_name ${annotation_metadata.module_name} \
--release_date ${params.release_prefix} \
--openscpca_nf_version ${workflow.manifest.version} \
--output_json_file \${library_id}_openscpca-annotations.json
done
"""
stub:
library_ids = annotations_tsv_files.collect{(it.name =~ /SCPCL\d{6}/)[0]}
"""
for library_id in ${library_ids.join(" ")};do
touch \${library_id}_openscpca-annotations.json
done
"""
}
workflow export_annotations {
take:
celltype_ch // [sample_id, project_id, [cell type assignment files], annotation metadata]
main:
// export json
format_annotations(celltype_ch)
emit:
format_annotations.out // [sample id, project id, annotations json]
}