diff --git a/fastqc/.dockerignore b/fastqc/.dockerignore new file mode 100644 index 0000000..71266ec --- /dev/null +++ b/fastqc/.dockerignore @@ -0,0 +1,5 @@ +.gitignore +.nextflow* +tests +work +outdir diff --git a/fastqc/.gitignore b/fastqc/.gitignore new file mode 100644 index 0000000..a50828c --- /dev/null +++ b/fastqc/.gitignore @@ -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 diff --git a/fastqc/Dockerfile b/fastqc/Dockerfile new file mode 100644 index 0000000..d0558a6 --- /dev/null +++ b/fastqc/Dockerfile @@ -0,0 +1,9 @@ +FROM pegi3s/fastqc:0.11.9 + +LABEL org.opencontainers.image.source https://github.com/icgc-tcga-pancancer/demo-wfs + +ENV PATH="/tools:${PATH}" + +COPY *.py /tools/ + +CMD ["/bin/bash"] diff --git a/fastqc/fastqc.nf b/fastqc/fastqc.nf new file mode 100755 index 0000000..a243eb7 --- /dev/null +++ b/fastqc/fastqc.nf @@ -0,0 +1,41 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 +version = '0.1.0' // tool 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.output_pattern = "*.html" // fastqc output html report + + +process fastqc { + container "ghcr.io/icgc-tcga-pancancer/demo-wfs.fastqc:${params.container_version ?: version}" + publishDir "${params.publish_dir}/${task.process.replaceAll(':', '_')}", mode: "copy", enabled: "${params.publish_dir ? true : ''}" + + cpus params.cpus + memory "${params.mem} GB" + + input: // input, make update as needed + path input_file + + output: // output, make update as needed + path "output_dir/${params.output_pattern}", emit: output + + script: + // add and initialize variables here as needed + + """ + mkdir -p output_dir + + fastqc.py \ + -i ${input_file} \ + -o output_dir + + """ +} diff --git a/fastqc/fastqc.py b/fastqc/fastqc.py new file mode 100755 index 0000000..99e181c --- /dev/null +++ b/fastqc/fastqc.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import os +import sys +import argparse +import subprocess + + +def main(): + """ + Python implementation of tool: fastqc + + This is auto-generated Python code, please update as needed! + """ + + parser = argparse.ArgumentParser(description='Tool: fastqc') + parser.add_argument('-i', '--input-file', dest='input_file', type=str, + help='Input file', required=True) + parser.add_argument('-o', '--output-dir', dest='output_dir', type=str, + help='Output directory', required=True) + args = parser.parse_args() + + if not os.path.isfile(args.input_file): + sys.exit('Error: specified input file %s does not exist or is not accessible!' % args.input_file) + + if not os.path.isdir(args.output_dir): + sys.exit('Error: specified output dir %s does not exist or is not accessible!' % args.output_dir) + + subprocess.run(f"fastqc -o {args.output_dir} {args.input_file}", shell=True, check=True) + + +if __name__ == "__main__": + main() diff --git a/fastqc/nextflow.config b/fastqc/nextflow.config new file mode 100644 index 0000000..f2cd1e3 --- /dev/null +++ b/fastqc/nextflow.config @@ -0,0 +1,4 @@ +docker { + enabled = true + runOptions = '-u \$(id -u):\$(id -g)' +} diff --git a/fastqc/pkg.json b/fastqc/pkg.json new file mode 100644 index 0000000..46a0393 --- /dev/null +++ b/fastqc/pkg.json @@ -0,0 +1,40 @@ +{ + "name": "fastqc", + "version": "0.1.0", + "description": "FastQC tool", + "main": "fastqc", + "scripts": { + "test": "wfpm test" + }, + "deprecated": false, + "keywords": [ + "bioinformatics", + "seq", + "qc metrics" + ], + "repository": { + "type": "git", + "url": "https://github.com/icgc-tcga-pancancer/demo-wfs.git" + }, + "container": { + "registries": [ + { + "registry": "ghcr.io", + "type": "docker", + "org": "icgc-tcga-pancancer", + "default": true + } + ] + }, + "dependencies": [], + "devDependencies": [], + "contributors": [ + { + "name": "Junjun Zhang", + "email": "junjun.zhang@oicr.on.ca" + } + ], + "license": "MIT", + "bugReport": "https://github.com/icgc-tcga-pancancer/demo-wfs/issues", + "homepage": "https://github.com/icgc-tcga-pancancer/demo-wfs#readme" +} \ No newline at end of file diff --git a/fastqc/tests/checker.nf b/fastqc/tests/checker.nf new file mode 100755 index 0000000..47cbd85 --- /dev/null +++ b/fastqc/tests/checker.nf @@ -0,0 +1,69 @@ +#!/usr/bin/env nextflow + +/* + This is an auto-generated checker workflow, please update as needed +*/ + +nextflow.enable.dsl = 2 +version = '0.1.0' // tool 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 { fastqc } from '../fastqc' + +Channel + .fromPath(params.input_file, checkIfExists: true) + .set { input_file } + + +process file_diff { + container "ghcr.io/icgc-tcga-pancancer/demo-wfs.fastqc:${params.container_version ?: version}" + + input: + path output_file + path expected_gzip + + output: + stdout() + + script: + """ + # remove date field before comparison eg,