Skip to content

Commit

Permalink
Merge pull request #8 from ICGC-TCGA-PanCancer/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
junjun-zhang authored Feb 14, 2021
2 parents bd32ef4 + 8730b59 commit 71db0da
Show file tree
Hide file tree
Showing 22 changed files with 466 additions and 0 deletions.
69 changes: 69 additions & 0 deletions demo-fastqc-wf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
venv*/
pyvenv*/

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
.coverage.*
nosetests.xml
coverage.xml
htmlcov

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea
*.iml
*.komodoproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/_build

.DS_Store
*~
.*.sw[po]
.build
.ve
.env
.cache
.pytest
.bootstrap
.appveyor.token
*.bak
*.log
.vscode
.python-version
.nextflow*
work
outdir
32 changes: 32 additions & 0 deletions demo-fastqc-wf/demo-fastqc-wf.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2
version = '0.1.0' // package version

// universal params go here, change default value as needed
params.container_version = ""
params.cpus = 1
params.mem = 1 // GB
params.publish_dir = "" // set to empty string will disable publishDir

// tool specific parmas go here, add / change as needed
params.input_file = ""
params.cleanup = true

include { demoFastqc } from './wfpr_modules/github.com/icgc-tcga-pancancer/awesome-wfpkgs1/[email protected]/demo-fastqc'
include { cleanupWorkdir; getSecondaryFiles; getBwaSecondaryFiles } from './wfpr_modules/github.com/icgc-argo/demo-wfpkgs/[email protected]/main.nf'


// please update workflow code as needed
workflow DemoFastqcWf {
take: // update as needed
input_file


main: // update as needed
demoFastqc(input_file)
if (params.cleanup) { cleanupWorkdir(demoFastqc.out, true) }

emit: // update as needed
output_file = demoFastqc.out.output_file
}
30 changes: 30 additions & 0 deletions demo-fastqc-wf/local_modules/demo-copy-file.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env nextflow

/*
This is an example process as a local module. Local module is optional, in general
is discouraged. A process can pentially be shareable in different workflows should
be developed in an independently publishable package, so that it can be imported
by anyone into any workflow.
*/

nextflow.enable.dsl = 2

params.input_file = ""
params.publish_dir = ""


process demoCopyFile {
publishDir "${params.publish_dir}/${task.process.replaceAll(':', '_')}", mode: "copy", enabled: "${params.publish_dir ? true : ''}"

input:
path input_file

output:
path "output_dir/*", emit: output_file

script:
"""
mkdir output_dir
cp ${input_file} output_dir/
"""
}
4 changes: 4 additions & 0 deletions demo-fastqc-wf/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker {
enabled = true
runOptions = '-u \$(id -u):\$(id -g)'
}
33 changes: 33 additions & 0 deletions demo-fastqc-wf/pkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "demo-fastqc-wf",
"version": "0.1.0",
"description": "FastQC workflow",
"main": "demo-fastqc-wf",
"scripts": {
"test": "wfpm test"
},
"deprecated": false,
"keywords": [
"bioinformatics",
"seq",
"qc metrics"
],
"repository": {
"type": "git",
"url": "https://github.com/icgc-tcga-pancancer/awesome-wfpkgs2.git"
},
"dependencies": [
"github.com/icgc-argo/demo-wfpkgs/[email protected]",
"github.com/icgc-tcga-pancancer/awesome-wfpkgs1/[email protected]"
],
"devDependencies": [],
"contributors": [
{
"name": "Junjun Zhang",
"email": "[email protected]"
}
],
"license": "MIT",
"bugReport": "https://github.com/icgc-tcga-pancancer/awesome-wfpkgs2/issues",
"homepage": "https://github.com/icgc-tcga-pancancer/awesome-wfpkgs2#readme"
}
71 changes: 71 additions & 0 deletions demo-fastqc-wf/tests/checker.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env nextflow

/*
This is an auto-generated checker workflow to test the generated main template workflow, it's
meant to illustrate how testing works. Please update to suit your own needs.
*/

nextflow.enable.dsl = 2
version = '0.1.0' // package version

// universal params
params.publish_dir = ""
params.container_version = ""

// tool specific parmas go here, add / change as needed
params.input_file = ""
params.expected_output = ""

include { DemoFastqcWf } from '../demo-fastqc-wf' params(['cleanup': false])
// include section starts
// include section ends

Channel
.fromPath(params.input_file, checkIfExists: true)
.set { input_file }


process file_smart_diff {
input:
path output_file
path expected_file

output:
stdout()

script:
"""
# Note: this is only for demo purpose, please write your own 'diff' according to your own needs.
# remove date field before comparison eg, <div id="header_filename">Tue 19 Jan 2021<br/>test_rg_3.bam</div>
# sed -e 's#"header_filename">.*<br/>test_rg_3.bam#"header_filename"><br/>test_rg_3.bam</div>#'
diff <( cat ${output_file} | sed -e 's#"header_filename">.*<br/>#"header_filename"><br/>#' ) \
<( ([[ '${expected_file}' == *.gz ]] && gunzip -c ${expected_file} || cat ${expected_file}) | sed -e 's#"header_filename">.*<br/>#"header_filename"><br/>#' ) \
&& ( echo "Test PASSED" && exit 0 ) || ( echo "Test FAILED, output file mismatch." && exit 1 )
"""
}


workflow checker {
take:
input_file
expected_output

main:
DemoFastqcWf(
input_file
)

file_smart_diff(
DemoFastqcWf.out.output_file,
expected_output
)
}


workflow {
checker(
file(params.input_file),
file(params.expected_output)
)
}
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions demo-fastqc-wf/tests/input/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder contains tiny data files for testing.
Binary file added demo-fastqc-wf/tests/input/test_rg_3.bam
Binary file not shown.
1 change: 1 addition & 0 deletions demo-fastqc-wf/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
includeConfig '../nextflow.config'
7 changes: 7 additions & 0 deletions demo-fastqc-wf/tests/test-job-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"input_file": "input/test_rg_3.bam",
"expected_output": "expected/expected.test_rg_3_fastqc.out.gz",
"publish_dir": "outdir",
"cpus": 1,
"mem": 0.5
}
1 change: 1 addition & 0 deletions demo-fastqc-wf/tests/wfpr_modules
1 change: 1 addition & 0 deletions demo-fastqc-wf/wfpr_modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.gitignore
.nextflow*
tests
work
outdir
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
venv*/
pyvenv*/

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
.coverage.*
nosetests.xml
coverage.xml
htmlcov

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea
*.iml
*.komodoproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/_build

.DS_Store
*~
.*.sw[po]
.build
.ve
.env
.cache
.pytest
.bootstrap
.appveyor.token
*.bak
*.log
.vscode
.python-version
.nextflow*
work
outdir
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM pegi3s/fastqc:0.11.9

LABEL org.opencontainers.image.source https://github.com/icgc-tcga-pancancer/awesome-wfpkgs1

ENV PATH="/tools:${PATH}"

COPY *.py /tools/

CMD ["/bin/bash"]
Loading

0 comments on commit 71db0da

Please sign in to comment.