Skip to content

Commit ad4976b

Browse files
committed
added starting template for song-score-upload@0.2.6
1 parent a27566c commit ad4976b

19 files changed

Lines changed: 443 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+
}

song-score-upload/main.nf

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env nextflow
2+
3+
/*
4+
Copyright (c) 2020-2021, Ontario Institute for Cancer Research
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
Authors:
19+
Junjun Zhang
20+
*/
21+
22+
nextflow.enable.dsl = 2
23+
version = '0.2.6' // package version
24+
25+
// universal params go here, change default value as needed
26+
params.container = ""
27+
params.container_registry = ""
28+
params.container_version = ""
29+
params.cpus = 1
30+
params.mem = 1 // GB
31+
params.publish_dir = "" // set to empty string will disable publishDir
32+
33+
// tool specific parmas go here, add / change as needed
34+
params.input_file = ""
35+
params.cleanup = true
36+
37+
include { demoCopyFile } from "./local_modules/demo-copy-file"
38+
include { cleanupWorkdir; getSecondaryFiles; getBwaSecondaryFiles } from './wfpr_modules/github.com/icgc-argo/demo-wfpkgs/demo-utils@1.3.0/main.nf' params([*:params, 'cleanup': false])
39+
40+
41+
// please update workflow code as needed
42+
workflow SongScoreUpload {
43+
take: // update as needed
44+
input_file
45+
46+
47+
main: // update as needed
48+
demoCopyFile(input_file)
49+
if (params.cleanup) { cleanupWorkdir(demoCopyFile.out, true) }
50+
51+
emit: // update as needed
52+
output_file = demoCopyFile.out.output_file
53+
54+
}
55+
56+
57+
// this provides an entry point for this main script, so it can be run directly without clone the repo
58+
// using this command: nextflow run <git_acc>/<repo>/<pkg_name>/<main_script>.nf -r <pkg_name>.v<pkg_version> --params-file xxx
59+
workflow {
60+
SongScoreUpload(
61+
file(params.input_file)
62+
)
63+
}

song-score-upload/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+
}

song-score-upload/pkg.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "song-score-upload",
3+
"version": "0.2.6",
4+
"description": "SONG/SCORE upload",
5+
"main": "main.nf",
6+
"deprecated": false,
7+
"keywords": [
8+
"bioinformatics",
9+
"data",
10+
"metadata",
11+
"upload"
12+
],
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/icgc-argo/nextflow-data-processing-utility-tools.git"
16+
},
17+
"dependencies": [
18+
"github.com/icgc-argo/demo-wfpkgs/demo-utils@1.3.0"
19+
],
20+
"devDependencies": [],
21+
"contributors": [
22+
{
23+
"name": "Junjun Zhang",
24+
"email": "junjun.ca@gmail.com"
25+
}
26+
],
27+
"license": "Apache License 2.0",
28+
"bugReport": "https://github.com/icgc-argo/nextflow-data-processing-utility-tools/issues",
29+
"homepage": "https://github.com/icgc-argo/nextflow-data-processing-utility-tools#readme"
30+
}

song-score-upload/tests/checker.nf

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env nextflow
2+
3+
/*
4+
Copyright (c) 2020-2021, Ontario Institute for Cancer Research
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
Authors:
19+
Junjun Zhang
20+
*/
21+
22+
/*
23+
This is an auto-generated checker workflow to test the generated main template workflow, it's
24+
meant to illustrate how testing works. Please update to suit your own needs.
25+
*/
26+
27+
nextflow.enable.dsl = 2
28+
version = '0.2.6' // package version
29+
30+
// universal params
31+
params.publish_dir = ""
32+
params.container = ""
33+
params.container_registry = ""
34+
params.container_version = ""
35+
36+
// tool specific parmas go here, add / change as needed
37+
params.input_file = ""
38+
params.expected_output = ""
39+
params.cleanup = false
40+
41+
include { SongScoreUpload } from '../main'
42+
// include section starts
43+
// include section ends
44+
45+
46+
process file_smart_diff {
47+
input:
48+
path output_file
49+
path expected_file
50+
51+
output:
52+
stdout()
53+
54+
script:
55+
"""
56+
# Note: this is only for demo purpose, please write your own 'diff' according to your own needs.
57+
# remove date field before comparison eg, <div id="header_filename">Tue 19 Jan 2021<br/>test_rg_3.bam</div>
58+
# sed -e 's#"header_filename">.*<br/>test_rg_3.bam#"header_filename"><br/>test_rg_3.bam</div>#'
59+
60+
diff <( cat ${output_file} | sed -e 's#"header_filename">.*<br/>#"header_filename"><br/>#' ) \
61+
<( ([[ '${expected_file}' == *.gz ]] && gunzip -c ${expected_file} || cat ${expected_file}) | sed -e 's#"header_filename">.*<br/>#"header_filename"><br/>#' ) \
62+
&& ( echo "Test PASSED" && exit 0 ) || ( echo "Test FAILED, output file mismatch." && exit 1 )
63+
"""
64+
}
65+
66+
67+
workflow checker {
68+
take:
69+
input_file
70+
expected_output
71+
72+
main:
73+
SongScoreUpload(
74+
input_file
75+
)
76+
77+
file_smart_diff(
78+
SongScoreUpload.out.output_file,
79+
expected_output
80+
)
81+
}
82+
83+
84+
workflow {
85+
checker(
86+
file(params.input_file),
87+
file(params.expected_output)
88+
)
89+
}
14.6 KB
Binary file not shown.
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'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"input_file": "input/test_rg_3.bam",
3+
"expected_output": "expected/expected.test_rg_3.bam",
4+
"publish_dir": "outdir",
5+
"cleanup": true,
6+
"cpus": 1,
7+
"mem": 0.5
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"input_file": "input/test_rg_3.bam",
3+
"expected_output": "expected/expected.test_rg_3.bam",
4+
"publish_dir": "outdir",
5+
"container_registry": "ghcr.io",
6+
"cpus": 1,
7+
"mem": 0.5
8+
}

0 commit comments

Comments
 (0)