Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skyline logging #16

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ workflow {
all_mzml_ch = wide_mzml_ch
}

// save details about this run
input_files = all_mzml_ch.map{ it -> ['Spectra File', it.baseName] }
version_files = Channel.empty()
save_run_details(input_files.collect(), version_files.collect())
run_details_file = save_run_details.out.run_details

// if requested, upload mzMLs to panorama
if(params.panorama.upload) {

Expand All @@ -124,13 +130,6 @@ workflow {
)
}


// save details about this run
input_files = all_mzml_ch.map{ it -> ['Spectra File', it.baseName] }
version_files = Channel.empty()
save_run_details(input_files.collect(), version_files.collect())
run_details_file = save_run_details.out.run_details

return
}

Expand Down
39 changes: 21 additions & 18 deletions modules/skyline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@ process SKYLINE_ADD_LIB {

output:
path("results.sky.zip"), emit: skyline_zipfile
path("skyline_add_library.log"), emit: log
path("skyline_add_library.stdout"), emit: stdout
path("skyline_add_library.stderr"), emit: stderr
path("pwiz_versions.txt"), emit: version

shell:
'''
unzip !{skyline_template_zipfile}

wine SkylineCmd \
--in="!{skyline_template_zipfile.baseName}" \
--log-file=skyline_add_library.log \
--in="!{skyline_template_zipfile.baseName}" --memstamp \
--import-fasta="!{fasta}" \
--add-library-path="!{elib}" \
--out="results.sky" \
--save \
--share-zip="results.sky.zip" \
--share-type="complete"
--share-type="complete" \
> >(tee 'skyline_add_library.stdout') 2> >(tee 'skyline_add_library.stderr' >&2)

# parse Skyline version info
wine SkylineCmd --version > version.txt
Expand All @@ -59,7 +60,7 @@ process SKYLINE_ADD_LIB {
stub:
'''
touch "results.sky.zip"
touch "skyline_add_library.log"
touch "skyline_add_library.stderr" "skyline_add_library.stdout"

# parse Skyline version info
wine SkylineCmd --version > version.txt
Expand Down Expand Up @@ -99,7 +100,8 @@ process SKYLINE_IMPORT_MZML {

output:
path("*.skyd"), emit: skyd_file
path("${mzml_file.baseName}.log"), emit: log_file
path("${mzml_file.baseName}.stdout"), emit: stdout
path("${mzml_file.baseName}.stderr"), emit: stderr

script:
"""
Expand All @@ -108,15 +110,15 @@ process SKYLINE_IMPORT_MZML {
cp ${mzml_file} /tmp/${mzml_file}

wine SkylineCmd \
--in="${skyline_zipfile.baseName}" \
--in="${skyline_zipfile.baseName}" --memstamp \
--import-no-join \
--log-file="${mzml_file.baseName}.log" \
--import-file="/tmp/${mzml_file}" \
> >(tee '${mzml_file.baseName}.stdout') 2> >(tee '${mzml_file.baseName}.stderr' >&2)
"""

stub:
"""
touch "${mzml_file.baseName}.log" "${mzml_file.baseName}.skyd"
touch "${mzml_file.baseName}.stdout" "${mzml_file.baseName}.stderr" "${mzml_file.baseName}.skyd"
"""
}

Expand All @@ -135,14 +137,15 @@ process SKYLINE_MERGE_RESULTS {

output:
path("${params.skyline.document_name}.sky.zip"), emit: final_skyline_zipfile
path("skyline-merge.log"), emit: log
path("skyline-merge.stdout"), emit: stdout
path("skyline-merge.stderr"), emit: stderr
env(sky_zip_hash), emit: file_hash

script:
import_files_params = "--import-file=${(mzml_files as List).collect{ "/tmp/" + file(it).name }.join(' --import-file=')}"
protein_parsimony_args = "--import-fasta=${fasta} --associate-proteins-shared-peptides=DuplicatedBetweenProteins --associate-proteins-min-peptides=1 --associate-proteins-remove-subsets --associate-proteins-minimal-protein-list"
if(params.skyline.group_by_gene) {
protein_parsimony_args += ' --associate-proteins-gene-level-parsimony'
protein_parsimony_args += ' --associate-proteins-gene-level-parsimony'
}

"""
Expand All @@ -151,22 +154,22 @@ process SKYLINE_MERGE_RESULTS {
cp -v ${skyd_files} /tmp/

wine SkylineCmd \
--in="${skyline_zipfile.baseName}" \
--log-file="skyline-merge.log" \
--in="${skyline_zipfile.baseName}" --memstamp \
${import_files_params} \
${params.skyline.protein_parsimony ? protein_parsimony_args : ''} \
--out="${params.skyline.document_name}.sky" \
--save \
--share-zip="${params.skyline.document_name}.sky.zip" \
--share-type="complete"
--share-type="complete" \
> >(tee 'skyline-merge.stdout') 2> >(tee 'skyline-merge.stderr' >&2)

sky_zip_hash=\$( md5sum ${params.skyline.document_name}.sky.zip |awk '{print \$1}' )
"""

stub:
"""
touch "${params.skyline.document_name}.sky.zip"
touch "skyline-merge.log"
touch "skyline-merge.stderr" "skyline-merge.stdout"
sky_zip_hash=\$( md5sum ${params.skyline.document_name}.sky.zip |awk '{print \$1}' )
"""
}
Expand Down Expand Up @@ -214,7 +217,7 @@ process SKYLINE_MINIMIZE_DOCUMENT {
unzip ${skyline_zipfile}

wine SkylineCmd \
--in="${skyline_zipfile.baseName}" \
--in="${skyline_zipfile.baseName}" --memstamp \
--chromatograms-discard-unused \
--chromatograms-limit-noise=1 \
--out="${sky_basename(skyline_zipfile)}_minimized.sky" \
Expand Down Expand Up @@ -255,7 +258,7 @@ process SKYLINE_ANNOTATE_DOCUMENT {
unzip ${skyline_zipfile}

# Create Skyline batch file with annotation definitions
echo '--in="${skyline_zipfile.baseName}"' > add_annotations.bat
echo '--in="${skyline_zipfile.baseName}" --memstamp' > add_annotations.bat
cat ${annotation_definitions} >> add_annotations.bat
echo '--import-annotations="${annotation_csv}"' >> add_annotations.bat
echo '--save --out="${sky_basename(skyline_zipfile)}_annotated.sky"' >> add_annotations.bat
Expand Down Expand Up @@ -295,7 +298,7 @@ process SKYLINE_RUN_REPORTS {
unzip !{skyline_zipfile}

# generate skyline batch file to export reports
echo "--in=\\"!{skyline_zipfile.baseName}\\"" > export_reports.bat
echo "--in=\\"!{skyline_zipfile.baseName}\\" --memstamp" > export_reports.bat

for skyrfile in ./*.skyr; do
# Add report to document
Expand Down
Loading