Skip to content

Commit b891a52

Browse files
authored
Merge pull request #2 from ICGC-ARGO-Structural-Variation-CN-WG/demo-fastqc-wf@0.2.0
[release]
2 parents a8e73e2 + 336a6c7 commit b891a52

28 files changed

Lines changed: 666 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env nextflow
2+
3+
/*
4+
This is an example process as a local module. Using local module is optional, in general
5+
is discouraged. A process can pentially be reused in different workflows should be developed
6+
in an independent package, so that it can be imported by anyone into any workflow.
7+
*/
8+
9+
nextflow.enable.dsl = 2
10+
11+
params.input_file = ""
12+
params.publish_dir = ""
13+
14+
15+
process demoCopyFile {
16+
publishDir "${params.publish_dir}/${task.process.replaceAll(':', '_')}", mode: "copy", enabled: params.publish_dir
17+
18+
input:
19+
path input_file
20+
21+
output:
22+
path "output_dir/*", emit: output_file
23+
24+
script:
25+
"""
26+
mkdir output_dir
27+
cp ${input_file} output_dir/
28+
"""
29+
}

demo-fastqc-wf/main.nf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env nextflow
2+
3+
/*
4+
Copyright (c) 2021, ICGC ARGO
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
24+
Authors:
25+
Junjun Zhang
26+
*/
27+
28+
nextflow.enable.dsl = 2
29+
version = '0.2.0' // package version
30+
31+
// universal params go here, change default value as needed
32+
params.container = ""
33+
params.container_registry = ""
34+
params.container_version = ""
35+
params.cpus = 1
36+
params.mem = 1 // GB
37+
params.publish_dir = "" // set to empty string will disable publishDir
38+
39+
// tool specific parmas go here, add / change as needed
40+
params.input_file = ""
41+
params.cleanup = true
42+
43+
include { cleanupWorkdir; getSecondaryFiles; getBwaSecondaryFiles } from './wfpr_modules/github.com/icgc-argo/demo-wfpkgs/demo-utils@1.3.0/main.nf' params([*:params, 'cleanup': false])
44+
include { demoFastqc } from './wfpr_modules/github.com/icgc-argo-structural-variation-cn-wg/wfpm-demo/demo-fastqc@0.2.0/main.nf' params([*:params, 'cleanup': false])
45+
46+
47+
// please update workflow code as needed
48+
workflow DemoFastqcWf {
49+
take: // update as needed
50+
input_file
51+
52+
53+
main: // update as needed
54+
demoFastqc(input_file)
55+
if (params.cleanup) { cleanupWorkdir(demoFastqc.out, true) }
56+
57+
emit: // update as needed
58+
output_file = demoFastqc.out.output_file
59+
}
60+
61+
62+
// this provides an entry point for this main script, so it can be run directly without clone the repo
63+
// using this command: nextflow run <git_acc>/<repo>/<pkg_name>/<main_script>.nf -r <pkg_name>.v<pkg_version> --params-file xxx
64+
workflow {
65+
DemoFastqcWf(
66+
file(params.input_file)
67+
)
68+
}

demo-fastqc-wf/nextflow.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker {
2+
enabled = true
3+
runOptions = '-u \$(id -u):\$(id -g)'
4+
}

demo-fastqc-wf/pkg.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "demo-fastqc-wf",
3+
"version": "0.2.0",
4+
"description": "FastQC workflow",
5+
"main": "main.nf",
6+
"deprecated": false,
7+
"keywords": [
8+
"bioinformatics",
9+
"seq",
10+
"qc metrics"
11+
],
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/icgc-argo-structural-variation-cn-wg/wfpm-demo.git"
15+
},
16+
"dependencies": [
17+
"github.com/icgc-argo/demo-wfpkgs/demo-utils@1.3.0",
18+
"github.com/icgc-argo-structural-variation-cn-wg/wfpm-demo/demo-fastqc@0.2.0"
19+
],
20+
"devDependencies": [],
21+
"contributors": [
22+
{
23+
"name": "Junjun Zhang",
24+
"email": "junjun.ca@gmail.com"
25+
}
26+
],
27+
"license": "MIT",
28+
"bugReport": "https://github.com/icgc-argo-structural-variation-cn-wg/wfpm-demo/issues",
29+
"homepage": "https://github.com/icgc-argo-structural-variation-cn-wg/wfpm-demo#readme"
30+
}

demo-fastqc-wf/tests/checker.nf

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/usr/bin/env nextflow
2+
3+
/*
4+
Copyright (c) 2021, ICGC ARGO
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
24+
Authors:
25+
Junjun Zhang
26+
*/
27+
28+
/*
29+
This is an auto-generated checker workflow to test the generated main template workflow, it's
30+
meant to illustrate how testing works. Please update to suit your own needs.
31+
*/
32+
33+
nextflow.enable.dsl = 2
34+
version = '0.2.0' // package version
35+
36+
// universal params
37+
params.publish_dir = ""
38+
params.container = ""
39+
params.container_registry = ""
40+
params.container_version = ""
41+
42+
// tool specific parmas go here, add / change as needed
43+
params.input_file = ""
44+
params.expected_output = ""
45+
params.cleanup = false
46+
47+
include { DemoFastqcWf } from '../main'
48+
// include section starts
49+
// include section ends
50+
51+
52+
process file_smart_diff {
53+
input:
54+
path output_file
55+
path expected_file
56+
57+
output:
58+
stdout()
59+
60+
script:
61+
"""
62+
# Note: this is only for demo purpose, please write your own 'diff' according to your own needs.
63+
# in this example, we need to remove date field before comparison eg, <div id="header_filename">Tue 19 Jan 2021<br/>test_rg_3.bam</div>
64+
# sed -e 's#"header_filename">.*<br/>test_rg_3.bam#"header_filename"><br/>test_rg_3.bam</div>#'
65+
66+
cat ${output_file} \
67+
| sed -e 's#"header_filename">.*<br/>#"header_filename"><br/>#' > normalized_output
68+
69+
([[ '${expected_file}' == *.gz ]] && gunzip -c ${expected_file} || cat ${expected_file}) \
70+
| sed -e 's#"header_filename">.*<br/>#"header_filename"><br/>#' > normalized_expected
71+
72+
diff normalized_output normalized_expected \
73+
&& ( echo "Test PASSED" && exit 0 ) || ( echo "Test FAILED, output file mismatch." && exit 1 )
74+
"""
75+
}
76+
77+
78+
workflow checker {
79+
take:
80+
input_file
81+
expected_output
82+
83+
main:
84+
DemoFastqcWf(
85+
input_file
86+
)
87+
88+
file_smart_diff(
89+
DemoFastqcWf.out.output_file,
90+
expected_output
91+
)
92+
}
93+
94+
95+
workflow {
96+
checker(
97+
file(params.input_file),
98+
file(params.expected_output)
99+
)
100+
}
14.6 KB
Binary file not shown.
148 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder contains tiny data files for testing.
14.6 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
includeConfig '../nextflow.config'

0 commit comments

Comments
 (0)