|
| 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 | + Alex Lepsa |
| 20 | + Junjun Zhang |
| 21 | +*/ |
| 22 | + |
| 23 | +nextflow.enable.dsl = 2 |
| 24 | +version = '2.6.0' // package version |
| 25 | + |
| 26 | +// universal params go here, change default value as needed |
| 27 | +params.max_retries = 5 // set to 0 will disable retry |
| 28 | +params.first_retry_wait_time = 1 // in seconds |
| 29 | + |
| 30 | +// tool specific parmas go here, add / change as needed |
| 31 | +params.study_id = "TEST-PR" |
| 32 | +params.payload = "NO_FILE" |
| 33 | +params.upload = [] |
| 34 | + |
| 35 | +params.api_token = "" |
| 36 | + |
| 37 | +params.song_cpus = 1 |
| 38 | +params.song_mem = 1 // GB |
| 39 | +params.song_url = "https://song.rdpc-qa.cancercollaboratory.org" |
| 40 | +params.song_api_token = "" |
| 41 | +params.song_container_version = "4.2.1" |
| 42 | + |
| 43 | +params.score_cpus = 1 |
| 44 | +params.score_mem = 1 // GB |
| 45 | +params.score_transport_mem = 1 // GB |
| 46 | +params.score_url = "https://score.rdpc-qa.cancercollaboratory.org" |
| 47 | +params.score_api_token = "" |
| 48 | +params.score_container_version = "5.0.0" |
| 49 | + |
| 50 | + |
| 51 | +song_params = [ |
| 52 | + *:params, |
| 53 | + 'cpus': params.song_cpus, |
| 54 | + 'mem': params.song_mem, |
| 55 | + 'song_url': params.song_url, |
| 56 | + 'song_container_version': params.song_container_version, |
| 57 | + 'api_token': params.song_api_token ?: params.api_token |
| 58 | +] |
| 59 | + |
| 60 | +score_params = [ |
| 61 | + *:params, |
| 62 | + 'cpus': params.score_cpus, |
| 63 | + 'mem': params.score_mem, |
| 64 | + 'transport_mem': params.score_transport_mem, |
| 65 | + 'song_url': params.song_url, |
| 66 | + 'score_url': params.score_url, |
| 67 | + 'score_container_version': params.score_container_version, |
| 68 | + 'api_token': params.score_api_token ?: params.api_token |
| 69 | +] |
| 70 | + |
| 71 | +include { songSubmit as songSub } from './local_modules/song-submit' params(song_params) |
| 72 | +include { songManifest as songMan } from './local_modules/song-manifest' params(song_params) |
| 73 | +include { scoreUpload as scoreUp } from './local_modules/score-upload' params(score_params) |
| 74 | +include { songPublish as songPub } from './local_modules/song-publish' params(song_params) |
| 75 | + |
| 76 | + |
| 77 | +workflow SongScoreUpload { |
| 78 | + take: |
| 79 | + study_id |
| 80 | + payload |
| 81 | + upload |
| 82 | + |
| 83 | + main: |
| 84 | + // Create new analysis |
| 85 | + songSub(study_id, payload) |
| 86 | + |
| 87 | + // Generate file manifest for upload |
| 88 | + songMan(study_id, songSub.out, upload.collect()) |
| 89 | + |
| 90 | + // Upload to SCORE |
| 91 | + scoreUp(songSub.out, songMan.out, upload.collect()) |
| 92 | + |
| 93 | + // Publish the analysis |
| 94 | + songPub(study_id, scoreUp.out.ready_to_publish) |
| 95 | + |
| 96 | + emit: |
| 97 | + analysis_id = songPub.out.analysis_id |
| 98 | +} |
| 99 | + |
| 100 | + |
| 101 | +// this provides an entry point for this main script, so it can be run directly without clone the repo |
| 102 | +// using this command: nextflow run <git_acc>/<repo>/<pkg_name>/<main_script>.nf -r <pkg_name>.v<pkg_version> --params-file xxx |
| 103 | + |
| 104 | +workflow { |
| 105 | + SongScoreUpload( |
| 106 | + params.study_id, |
| 107 | + file(params.payload), |
| 108 | + Channel.fromPath(params.upload) |
| 109 | + ) |
| 110 | +} |
0 commit comments