forked from mriffle/nf-skyline-dia-ms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mriffle#17 from ajmaurais/pdc
Add PDC as an input file source
- Loading branch information
Showing
7 changed files
with
223 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
def format_client_args(var) { | ||
ret = (var == null ? "" : var) | ||
return ret | ||
} | ||
|
||
process GET_STUDY_METADATA { | ||
publishDir "${params.result_dir}/pdc", failOnError: true, mode: 'copy' | ||
errorStrategy 'retry' | ||
maxRetries 5 | ||
label 'process_low_constant' | ||
container params.images.pdc_client | ||
|
||
input: | ||
val pdc_study_id | ||
|
||
output: | ||
path('study_metadata.tsv'), emit: metadata | ||
path('study_metadata_annotations.csv'), emit: skyline_annotations | ||
env(study_id), emit: study_id | ||
env(study_name), emit: study_name | ||
path('pdc_client_version.txt'), emit: version | ||
|
||
shell: | ||
n_files_arg = params.pdc.n_raw_files == null ? "" : "--nFiles ${params.pdc.n_raw_files}" | ||
pdc_client_args = params.pdc.client_args == null ? "" : params.pdc.client_args | ||
|
||
''' | ||
study_id=$(PDC_client studyID !{pdc_client_args} !{pdc_study_id} | tee study_id.txt) | ||
study_name=$(PDC_client studyName --normalize !{pdc_client_args} ${study_id} | tee study_name.txt) | ||
PDC_client metadata !{pdc_client_args} -f tsv !{n_files_arg} --skylineAnnotations ${study_id} | ||
echo "pdc_client_git_repo='$GIT_REPO - $GIT_BRANCH [$GIT_SHORT_HASH]'" > pdc_client_version.txt | ||
''' | ||
} | ||
|
||
process METADATA_TO_SKY_ANNOTATIONS { | ||
label 'process_low_constant' | ||
container params.images.pdc_client | ||
|
||
input: | ||
path pdc_study_metadata | ||
|
||
output: | ||
path('skyline_annotations.csv'), emit: skyline_annotations | ||
|
||
shell: | ||
''' | ||
PDC_client metadataToSky !{pdc_study_metadata} | ||
''' | ||
} | ||
|
||
process GET_FILE { | ||
storeDir "${params.panorama_cache_directory}" | ||
label 'process_low_constant' | ||
container params.images.pdc_client | ||
errorStrategy 'retry' | ||
maxRetries 1 | ||
|
||
input: | ||
tuple val(url), val(file_name), val(md5) | ||
|
||
output: | ||
path(file_name), emit: downloaded_file | ||
|
||
shell: | ||
''' | ||
PDC_client file -o '!{file_name}' -m '!{md5}' '!{url}' | ||
''' | ||
|
||
stub: | ||
""" | ||
touch ${file_name} | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
include { GET_STUDY_METADATA } from "../modules/pdc.nf" | ||
include { METADATA_TO_SKY_ANNOTATIONS } from "../modules/pdc.nf" | ||
include { GET_FILE } from "../modules/pdc.nf" | ||
include { MSCONVERT } from "../modules/msconvert.nf" | ||
|
||
workflow get_pdc_study_metadata { | ||
emit: | ||
study_name | ||
metadata | ||
annotations_csv | ||
|
||
main: | ||
if(params.pdc.metadata_tsv == null) { | ||
GET_STUDY_METADATA(params.pdc.study_id) | ||
metadata = GET_STUDY_METADATA.out.metadata | ||
annotations_csv = GET_STUDY_METADATA.out.skyline_annotations | ||
study_name = GET_STUDY_METADATA.out.study_name | ||
} else { | ||
metadata = Channel.fromPath(file(params.pdc.metadata_tsv, checkIfExists: true)) | ||
METADATA_TO_SKY_ANNOTATIONS(metadata) | ||
annotations_csv = METADATA_TO_SKY_ANNOTATIONS.out | ||
study_name = params.pdc.study_name | ||
} | ||
} | ||
|
||
workflow get_pdc_files { | ||
emit: | ||
study_name | ||
metadata | ||
annotations_csv | ||
wide_mzml_ch | ||
|
||
main: | ||
get_pdc_study_metadata() | ||
metadata = get_pdc_study_metadata.out.metadata | ||
annotations_csv = get_pdc_study_metadata.out.annotations_csv | ||
study_name = get_pdc_study_metadata.out.study_name | ||
|
||
metadata \ | ||
| splitCsv(header:true, sep:'\t') \ | ||
| map{row -> tuple(row.url, row.file_name, row.md5sum)} \ | ||
| GET_FILE | ||
|
||
MSCONVERT(GET_FILE.out.downloaded_file, | ||
params.msconvert.do_demultiplex, | ||
params.msconvert.do_simasspectra) | ||
|
||
wide_mzml_ch = MSCONVERT.out.mzml_file | ||
} | ||
|