Skip to content

Commit

Permalink
Upgrade to NF20.x + Use secure env (#12)
Browse files Browse the repository at this point in the history
* update readme

* use new take syntax

* updated env usage (untested)
  • Loading branch information
lepsalex authored Mar 24, 2020
1 parent 321f611 commit 3b49104
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# nextflow-data-processing-utility-tools

_WORK IN PROGRESS AND NOT READY FOR USE!!!_

This repository intends to provide a data utilities for use in Nextflow workflows. Specifically at this time it provides processes wrapping Overture SONG/SCORE clients for upload and download of files and metadata.

Using Nextflow's experimental DSL2, the modules defined in the repo can be imported and used as part of a larger workflow (or independently).
Expand Down
2 changes: 1 addition & 1 deletion process/score_download.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ process scoreDownload {
path analysis
val study_id
val analysis_id
env ACCESSTOKEN

output:
path analysis, emit: analysis_json
Expand All @@ -38,7 +39,6 @@ process scoreDownload {
"""
export METADATA_URL=${params.song_url}
export STORAGE_URL=${params.score_url}
export ACCESSTOKEN=${params.api_token}
export TRANSPORT_PARALLEL=${params.cpus}
export TRANSPORT_MEMORY=${params.transport_mem}
Expand Down
2 changes: 1 addition & 1 deletion process/score_upload.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ process scoreUpload {
val analysis_id
path manifest
path upload
env ACCESSTOKEN

output:
val analysis_id, emit: ready_to_publish

"""
export METADATA_URL=${params.song_url}
export STORAGE_URL=${params.score_url}
export ACCESSTOKEN=${params.api_token}
export TRANSPORT_PARALLEL=${params.cpus}
export TRANSPORT_MEMORY=${params.transport_mem}
Expand Down
2 changes: 1 addition & 1 deletion process/song_get_analysis.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ process songGetAnalysis {
input:
val study_id
val analysis_id
env CLIENT_ACCESS_TOKEN

output:
path '*.analysis.json', emit: json


"""
export CLIENT_SERVER_URL=${params.song_url}
export CLIENT_ACCESS_TOKEN=${params.api_token}
export CLIENT_STUDY_ID=${study_id}
curl -X GET "${params.song_url}/studies/$study_id/analysis/$analysis_id" -H "accept: */*" > ${analysis_id}.analysis.json
Expand Down
2 changes: 1 addition & 1 deletion process/song_manifest.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ process songManifest {
val study_id
val analysis_id
path upload
env CLIENT_ACCESS_TOKEN

output:
path 'manifest.txt'

"""
export CLIENT_SERVER_URL=${params.song_url}
export CLIENT_ACCESS_TOKEN=${params.api_token}
export CLIENT_STUDY_ID=${study_id}
sing manifest -a ${analysis_id} -d . -f manifest.txt
Expand Down
2 changes: 1 addition & 1 deletion process/song_publish.nf
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ process songPublish {
input:
val study_id
val analysis_id
env CLIENT_ACCESS_TOKEN

output:
val analysis_id, emit: analysis_id

"""
export CLIENT_SERVER_URL=${params.song_url}
export CLIENT_ACCESS_TOKEN=${params.api_token}
export CLIENT_STUDY_ID=${study_id}
sing publish -a ${analysis_id}
Expand Down
2 changes: 1 addition & 1 deletion process/song_submit.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ process songSubmit {
input:
val study_id
path payload
env CLIENT_ACCESS_TOKEN

output:
path 'download_payload.json'

"""
export CLIENT_SERVER_URL=${params.song_url}
export CLIENT_ACCESS_TOKEN=${params.api_token}
export CLIENT_STUDY_ID=${study_id}
sing submit -f ${payload} > download_payload.json
Expand Down
8 changes: 4 additions & 4 deletions workflow/song_score_download.nf
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ include songGetAnalysis from '../process/song_get_analysis' params(song_params)
include scoreDownload from '../process/score_download' params(score_params)

workflow songScoreDownload {
get: study_id
get: analysis_id
take: study_id
take: analysis_id

main:
songGetAnalysis(study_id, analysis_id)
scoreDownload(songGetAnalysis.out.json, study_id, analysis_id)
songGetAnalysis(study_id, analysis_id, song_params.api_token)
scoreDownload(songGetAnalysis.out.json, study_id, analysis_id, score_params.api_token)

emit:
analysis_json = songGetAnalysis.out.json
Expand Down
14 changes: 7 additions & 7 deletions workflow/song_score_upload.nf
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,25 @@ include songPublish from '../process/song_publish' params(song_params)
include extractAnalysisId from '../process/extract_analysis_id' params(extract_params)

workflow songScoreUpload {
get: study_id
get: payload
get: upload
take: study_id
take: payload
take: upload

main:
// Create new analysis
songSubmit(study_id, payload)
songSubmit(study_id, payload, song_params.api_token)

// Extract and save analysis_id
extractAnalysisId(songSubmit.out)

// Generate file manifest for upload
songManifest(study_id, extractAnalysisId.out, upload)
songManifest(study_id, extractAnalysisId.out, upload, song_params.api_token)

// Upload to SCORE
scoreUpload(extractAnalysisId.out, songManifest.out, upload)
scoreUpload(extractAnalysisId.out, songManifest.out, upload, score_params.api_token)

// Publish the analysis
songPublish(study_id, scoreUpload.out.ready_to_publish)
songPublish(study_id, scoreUpload.out.ready_to_publish, song_params.api_token)

emit:
analysis_id = songPublish.out.analysis_id
Expand Down

0 comments on commit 3b49104

Please sign in to comment.