|
| 1 | +#!/usr/bin/env nextflow |
| 2 | + |
| 3 | +/* |
| 4 | + Copyright (C) 2021, icgc-argo |
| 5 | +
|
| 6 | + This program is free software: you can redistribute it and/or modify |
| 7 | + it under the terms of the GNU Affero General Public License as published by |
| 8 | + the Free Software Foundation, either version 3 of the License, or |
| 9 | + (at your option) any later version. |
| 10 | +
|
| 11 | + This program is distributed in the hope that it will be useful, |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + GNU Affero General Public License for more details. |
| 15 | +
|
| 16 | + You should have received a copy of the GNU Affero General Public License |
| 17 | + along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | +
|
| 19 | + Authors: |
| 20 | + Linda Xiang |
| 21 | +*/ |
| 22 | + |
| 23 | +/********************************************************************/ |
| 24 | +/* this block is auto-generated based on info from pkg.json where */ |
| 25 | +/* changes can be made if needed, do NOT modify this block manually */ |
| 26 | +nextflow.enable.dsl = 2 |
| 27 | +version = '0.1.0' // package version |
| 28 | + |
| 29 | +container = [ |
| 30 | + 'ghcr.io': 'ghcr.io/icgc-argo-workflows/dna-seq-processing-tools.seq-data-to-lane-fastq' |
| 31 | +] |
| 32 | +default_container_registry = 'ghcr.io' |
| 33 | +/********************************************************************/ |
| 34 | + |
| 35 | + |
| 36 | +// universal params go here |
| 37 | +params.container_registry = "" |
| 38 | +params.container_version = "" |
| 39 | +params.container = "" |
| 40 | + |
| 41 | +params.cpus = 1 |
| 42 | +params.mem = 1 // GB |
| 43 | +params.publish_dir = "" // set to empty string will disable publishDir |
| 44 | + |
| 45 | + |
| 46 | +// tool specific parmas go here, add / change as needed |
| 47 | +params.metadata_json = "" |
| 48 | +params.seq_files = "" |
| 49 | +params.reads_max_discard_fraction = 0.05 |
| 50 | +params.tempdir = "NO_DIR" |
| 51 | + |
| 52 | + |
| 53 | +process seqDataToLaneFastq { |
| 54 | + container "${params.container ?: container[params.container_registry ?: default_container_registry]}:${params.container_version ?: version}" |
| 55 | + publishDir "${params.publish_dir}/${task.process.replaceAll(':', '_')}", mode: "copy", enabled: params.publish_dir ? true : false |
| 56 | + |
| 57 | + cpus params.cpus |
| 58 | + memory "${params.mem} GB" |
| 59 | + |
| 60 | + input: // input, make update as needed |
| 61 | + path metadata_json |
| 62 | + path seq |
| 63 | + |
| 64 | + output: // output, make update as needed |
| 65 | + path "out/*{fq,fastq,fq.gz,fastq.gz}", emit: lane_fastq |
| 66 | + path "out/rgs_file_pair_map.csv", emit: file_pair_map_csv |
| 67 | + |
| 68 | + script: |
| 69 | + // add and initialize variables here as needed |
| 70 | + |
| 71 | + arg_tempdir = params.tempdir != 'NO_DIR' ? "-t ${params.tempdir}" : "" |
| 72 | + |
| 73 | + """ |
| 74 | + mkdir -p out |
| 75 | +
|
| 76 | + main.py \ |
| 77 | + -p ${metadata_json} \ |
| 78 | + -s ${seq} \ |
| 79 | + -d ${params.reads_max_discard_fraction} \ |
| 80 | + -n ${params.cpus} \ |
| 81 | + -o out ${arg_tempdir} |
| 82 | + |
| 83 | + """ |
| 84 | +} |
| 85 | + |
| 86 | + |
| 87 | +// this provides an entry point for this main script, so it can be run directly without clone the repo |
| 88 | +// using this command: nextflow run <git_acc>/<repo>/<pkg_name>/<main_script>.nf -r <pkg_name>.v<pkg_version> --params-file xxx |
| 89 | +workflow { |
| 90 | + seqDataToLaneFastq( |
| 91 | + file(params.metadata_json), |
| 92 | + Channel.fromPath(params.seq_files).collect() |
| 93 | + ) |
| 94 | +} |
0 commit comments