-
Notifications
You must be signed in to change notification settings - Fork 4
Updt onsite #25
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
Updt onsite #25
Changes from all commits
c02f169
66baee7
42cd4bc
a62b51e
8da69e3
94d800b
eef2a9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -198,6 +198,8 @@ dag.svg | |
| testing/ | ||
| testing*/ | ||
| *.pyc | ||
| .nf-test | ||
| *nf.test.snap | ||
|
|
||
| # Codacy | ||
| .codacy | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| name: onsite | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,23 +1,26 @@ | ||||||
| process ONSITE { | ||||||
| tag "$meta.mzml_id" | ||||||
| tag "${meta.id}" | ||||||
| label 'process_medium' | ||||||
| label 'onsite' | ||||||
|
|
||||||
| container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||||||
| 'https://depot.galaxyproject.org/singularity/pyonsite:0.0.2--pyhdfd78af_0' : | ||||||
| 'quay.io/biocontainers/pyonsite:0.0.2--pyhdfd78af_0' }" | ||||||
| container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container | ||||||
| ? 'https://depot.galaxyproject.org/singularity/pyonsite:0.0.2--pyhdfd78af_0' | ||||||
| : 'biocontainers/pyonsite:0.0.2--pyhdfd78af_0'}" | ||||||
|
|
||||||
| input: | ||||||
| tuple val(meta), path(mzml_file), path(id_file) | ||||||
|
|
||||||
| output: | ||||||
| tuple val(meta), path("${id_file.baseName}_*.idXML"), emit: ptm_in_id_onsite | ||||||
| tuple val(meta), path("${prefix}_*.idXML"), emit: ptm_in_id_onsite | ||||||
| path "versions.yml", emit: versions | ||||||
| path "*.log", emit: log | ||||||
|
|
||||||
| when: | ||||||
| task.ext.when == null || task.ext.when | ||||||
|
|
||||||
| script: | ||||||
| def args = task.ext.args ?: '' | ||||||
| def prefix = task.ext.prefix ?: "${meta.mzml_id}" | ||||||
| prefix = task.ext.prefix ?: "${meta.id}" | ||||||
|
|
||||||
| // Algorithm selection: lucxor (default), ascore, or phosphors | ||||||
| def algorithm = params.onsite_algorithm ?: 'lucxor' | ||||||
|
|
@@ -40,28 +43,31 @@ process ONSITE { | |||||
| if (algorithm == 'ascore') { | ||||||
| // AScore: uses -in, -id, -out, --fragment-mass-unit | ||||||
| fragment_unit = params.onsite_fragment_unit ?: 'Da' | ||||||
| def optional_flags = [add_decoys, compute_all_scores, debug].findAll { it }.join(' \\\n ') | ||||||
| def optional_flags = [add_decoys, compute_all_scores, debug].findAll { a -> a }.join(' \\\n ') | ||||||
| algorithm_cmd = """ | ||||||
| onsite ascore \\ | ||||||
| -in ${mzml_file} \\ | ||||||
| -id ${id_file} \\ | ||||||
| -out ${id_file.baseName}_ascore.idXML \\ | ||||||
| -out ${prefix}_ascore.idXML \\ | ||||||
| --fragment-mass-tolerance ${fragment_tolerance} \\ | ||||||
| --fragment-mass-unit ${fragment_unit}${optional_flags ? ' \\\n ' + optional_flags : ''} | ||||||
| """ | ||||||
| } else if (algorithm == 'phosphors') { | ||||||
| } | ||||||
| else if (algorithm == 'phosphors') { | ||||||
| // PhosphoRS: uses -in, -id, -out, --fragment-mass-unit | ||||||
| fragment_unit = params.onsite_fragment_unit ?: 'Da' | ||||||
| def optional_flags = [add_decoys, compute_all_scores, debug].findAll { it }.join(' \\\n ') | ||||||
| def optional_flags = [add_decoys, compute_all_scores, debug].findAll { a -> a }.join(' \\\n ') | ||||||
| algorithm_cmd = """ | ||||||
| onsite phosphors \\ | ||||||
| -in ${mzml_file} \\ | ||||||
| -id ${id_file} \\ | ||||||
| -out ${id_file.baseName}_phosphors.idXML \\ | ||||||
| -out ${prefix}_phosphors.idXML \\ | ||||||
| --fragment-mass-tolerance ${fragment_tolerance} \\ | ||||||
| --fragment-mass-unit ${fragment_unit}${optional_flags ? ' \\\n ' + optional_flags : ''} | ||||||
| ${args} | ||||||
| """ | ||||||
| } else if (algorithm == 'lucxor') { | ||||||
| } | ||||||
| else if (algorithm == 'lucxor') { | ||||||
| // LucXor: uses -in, -id, -out, --fragment-error-units (note: error-units not mass-unit) | ||||||
| fragment_unit = params.onsite_fragment_error_units ?: 'Da' | ||||||
| def fragment_method = params.onsite_fragment_method ?: 'CID' | ||||||
|
|
@@ -81,12 +87,12 @@ process ONSITE { | |||||
| def decoy_mass = params.onsite_decoy_mass ? "--decoy-mass ${params.onsite_decoy_mass}" : "--decoy-mass 79.966331" | ||||||
| def decoy_losses = params.onsite_decoy_neutral_losses ? "--decoy-neutral-losses ${params.onsite_decoy_neutral_losses}" : "--decoy-neutral-losses 'X -H3PO4 -97.97690'" | ||||||
|
|
||||||
| def optional_flags = [disable_split_by_charge, compute_all_scores, debug].findAll { it }.join(' \\\n ') | ||||||
| def optional_flags = [disable_split_by_charge, compute_all_scores, debug].findAll { a -> a }.join(' \\\n ') | ||||||
| algorithm_cmd = """ | ||||||
| onsite lucxor \\ | ||||||
| -in ${mzml_file} \\ | ||||||
| -id ${id_file} \\ | ||||||
| -out ${id_file.baseName}_lucxor.idXML \\ | ||||||
| -out ${prefix}_lucxor.idXML \\ | ||||||
| --fragment-method ${fragment_method} \\ | ||||||
| --fragment-mass-tolerance ${fragment_tolerance} \\ | ||||||
| --fragment-error-units ${fragment_unit} \\ | ||||||
|
|
@@ -103,16 +109,17 @@ process ONSITE { | |||||
| --min-num-psms-model ${min_num_psms} \\ | ||||||
| --rt-tolerance ${rt_tolerance}${optional_flags ? ' \\\n ' + optional_flags : ''} | ||||||
| """ | ||||||
| } else { | ||||||
| error "Unknown onsite algorithm: ${algorithm}. Supported algorithms: ascore, phosphors, lucxor" | ||||||
| } | ||||||
| else { | ||||||
| error("Unknown onsite algorithm: ${algorithm}. Supported algorithms: ascore, phosphors, lucxor") | ||||||
| } | ||||||
|
|
||||||
| """ | ||||||
| ${algorithm_cmd.trim()} 2>&1 | tee ${id_file.baseName}_${algorithm}.log | ||||||
| ${algorithm_cmd.trim()} 2>&1 | tee ${prefix}_${algorithm}.log | ||||||
|
|
||||||
| cat <<-END_VERSIONS > versions.yml | ||||||
| "${task.process}": | ||||||
| onsite: \$(onsite --version 2>&1 | grep -oP 'version \\K[0-9.]+' || echo "unknown") | ||||||
| onsite: \$(onsite --version 2>&1 | grep -oE 'version \\K[0-9.]+' || echo "unknown") | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Proposed fixEither revert to - onsite: \$(onsite --version 2>&1 | grep -oE 'version \\K[0-9.]+' || echo "unknown")
+ onsite: \$(onsite --version 2>&1 | grep -oP 'version \\K[0-9.]+' || echo "unknown")Or use ERE-compatible approach with sed: - onsite: \$(onsite --version 2>&1 | grep -oE 'version \\K[0-9.]+' || echo "unknown")
+ onsite: \$(onsite --version 2>&1 | sed -n 's/.*version \\([0-9.]*\\).*/\\1/p' | head -1 || echo "unknown")Or with awk: - onsite: \$(onsite --version 2>&1 | grep -oE 'version \\K[0-9.]+' || echo "unknown")
+ onsite: \$(onsite --version 2>&1 | awk '/version/ {for(i=1;i<=NF;i++) if($i ~ /^[0-9.]+$/) {print $i; exit}}' || echo "unknown")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @enryH @jpfeuffer should we accept this suggestion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I would. Did yo add it? |
||||||
| algorithm: ${algorithm} | ||||||
| END_VERSIONS | ||||||
| """ | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent
${args}handling across algorithms.The
phosphorsalgorithm (line 67) includes${args}in its command, butascore(lines 47-54) andlucxor(lines 91-111) do not. This meanstask.ext.argsonly affects the phosphors algorithm.If this is intentional (e.g., only phosphors supports additional arguments), consider adding a comment to clarify. Otherwise, add
${args}consistently to all algorithms.Proposed fix to add args consistently
For ascore (after line 53):
--fragment-mass-unit ${fragment_unit}${optional_flags ? ' \\\n ' + optional_flags : ''} + ${args}For lucxor (after line 110):
--rt-tolerance ${rt_tolerance}${optional_flags ? ' \\\n ' + optional_flags : ''} + ${args}🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ypriverol should I add it or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.