Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ dag.svg
testing/
testing*/
*.pyc
.nf-test
*nf.test.snap

# Codacy
.codacy
Expand Down
1 change: 0 additions & 1 deletion modules/bigbio/onsite/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
name: onsite
channels:
- conda-forge
- bioconda
Expand Down
43 changes: 25 additions & 18 deletions modules/bigbio/onsite/main.nf
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'
Expand All @@ -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 : ''}
"""
Comment on lines 47 to 54
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent ${args} handling across algorithms.

The phosphors algorithm (line 67) includes ${args} in its command, but ascore (lines 47-54) and lucxor (lines 91-111) do not. This means task.ext.args only 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
Verify each finding against the current code and only fix it if needed.

In `@modules/bigbio/onsite/main.nf` around lines 47 - 54, The ascore and lucxor
algorithm command templates (variable algorithm_cmd in the ascore block and the
lucxor block) currently omit ${args} while the phosphors block uses it, causing
task.ext.args to only apply to phosphors; update the ascore and lucxor
algorithm_cmd strings to append ${args} in the same position phosphors does
(preserving optional_flags handling) so task.ext.args is applied consistently,
or alternatively add a clear comment in both the ascore and lucxor blocks
explaining why ${args} is intentionally omitted if that was the intended
behavior.

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

} 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'
Expand All @@ -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} \\
Expand All @@ -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")
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Bug: \K is a PCRE feature but grep -oE uses ERE.

The \K (reset match start) is a Perl-compatible regex feature that only works with grep -oP. Using it with grep -oE (Extended regex) will fail to extract the version correctly—it will try to match the literal characters \K.

Proposed fix

Either revert to -oP (requires PCRE-enabled grep):

-        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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@modules/bigbio/onsite/main.nf` at line 122, The current extraction in the
onsite version command uses a PCRE-only token (\K) with grep -oE which is ERE
and will not work; update the command in the onsite version assignment to use a
PCRE-enabled grep (change grep -oE to grep -oP) or replace the grep usage with
an ERE-compatible pipeline (e.g., pipe through sed or awk to capture the numeric
version) so that the version is correctly extracted from the output of the
onsite --version invocation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enryH @jpfeuffer should we accept this suggestion.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I would. Did yo add it?

algorithm: ${algorithm}
END_VERSIONS
"""
Expand Down
78 changes: 45 additions & 33 deletions modules/bigbio/onsite/meta.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: onsite
description: Post-translational modification (PTM) localization using onsite algorithms (AScore, PhosphoRS, LucXor)
description: Post-translational modification (PTM) localization using onsite
algorithms (AScore, PhosphoRS, LucXor)
keywords:
- onsite
- PTM
Expand All @@ -18,40 +19,51 @@ tools:
homepage: https://github.com/bigbio/onsite
documentation: https://github.com/bigbio/onsite/blob/main/README.md
tool_dev_url: https://github.com/bigbio/onsite
doi: ""
licence: ["MIT"]
licence:
- "MIT"
identifier: ""
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', mzml_id:'sample1' ]
- mzml_file:
type: file
description: Input spectrum file in mzML format
pattern: "*.mzML"
- id_file:
type: file
description: Protein/peptide identifications file in idXML format
pattern: "*.idXML"
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', mzml_id:'sample1' ]`
- mzml_file:
type: file
description: Input spectrum file in mzML format
pattern: "*.mzML"
ontologies: []
- id_file:
type: file
description: Protein/peptide identifications file in idXML format
pattern: "*.idXML"
ontologies: []
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', mzml_id:'sample1' ]
- ptm_in_id_onsite:
type: file
description: Protein/peptide identifications file with PTM localization scores
pattern: "*_{ascore,phosphors,lucxor}.idXML"
- log:
type: file
description: Log file from onsite execution
pattern: "*.log"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
ptm_in_id_onsite:
- - meta:
type: map
description: |
Groovy Map containing sample information
- ${prefix}_*.idXML:
type: file
description: Output idXML file containing PTM localization results from
onsite
pattern: "${prefix}_*.idXML"
ontologies: []
log:
- "*.log":
type: file
description: Log file from onsite execution
pattern: "*.log"
ontologies: []
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750
authors:
- "@ypriverol"
- "@weizhongchun"
- "@enryh"
1 change: 1 addition & 0 deletions modules/bigbio/onsite/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ nextflow_process {
process "ONSITE"
tag "modules"
tag "modules_onsite"
tag "modules_bigbio"
tag "onsite"

test("Should run AScore algorithm") {
Expand Down
Loading