Skip to content

Topas#141

Open
Schansiate wants to merge 17 commits intodevfrom
topas
Open

Topas#141
Schansiate wants to merge 17 commits intodevfrom
topas

Conversation

@Schansiate
Copy link
Collaborator

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • If necessary, also make a PR on the nf-core/diseasemodulediscovery branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core pipelines lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

@nf-core-bot
Copy link
Member

Warning

Newer version of the nf-core template is available.

Your pipeline is using an old version of the nf-core template: 3.2.0.
Please update your pipeline to the latest version.

For more documentation on how to update your pipeline, please see the nf-core documentation and Synchronisation documentation.

Merge remote-tracking branch 'origin/doc_update' into topas
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Copilot AI review requested due to automatic review settings December 17, 2025 16:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates TOPAS (a network expansion algorithm) into the disease module discovery pipeline. TOPAS connects seed nodes in a top-down manner by selecting connector nodes that ensure the highest Random Walk with Restart flow across the network.

Key changes:

  • Added TOPAS as a new network expansion method with configurable skip parameter
  • Implemented TOPAS workflow, module, and R wrapper script
  • Extended module parser to support TOPAS output format

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
subworkflows/local/networkexpansion/main.nf Integrated TOPAS workflow into the network expansion pipeline with conditional execution
subworkflows/local/gt_topas/main.nf New workflow that prepares inputs and executes TOPAS
nextflow_schema.json Added skip_topas parameter definition with appropriate metadata
nextflow.config Added skip_topas configuration parameter defaulting to false
modules/local/topas/main.nf New process definition for running TOPAS via R script
modules/local/diamond/main.nf Minor spacing fix in comment (removed extra space)
docs/output.md Added TOPAS documentation section describing the algorithm and output files
bin/run_topas.R New R wrapper script that invokes TOPAS with network and seed inputs
bin/module_parser.py Extended parser to handle TOPAS output format (tab-separated edge list)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


ch_versions = Channel.empty()

GRAPHTOOLPARSER(ch_network, "robust")
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The GRAPHTOOLPARSER format parameter should be "topas" instead of "robust". Each workflow consistently uses its own tool name as the format parameter (see gt_diamond/main.nf:20, gt_rwr/main.nf:20, gt_domino/main.nf:22). Using "robust" will create incorrectly named output files.

Suggested change
GRAPHTOOLPARSER(ch_network, "robust")
GRAPHTOOLPARSER(ch_network, "topas")

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
ch_seeds
ch_network
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Missing input channel documentation comments. Other similar workflow files include inline comments documenting the expected channel structure (see gt_robust/main.nf:10-11, gt_rwr/main.nf:10-14). Add comments like:

ch_seeds // channel: [ val(meta[id,seeds_id,network_id]), path(seeds) ]
ch_network // channel: [ val(meta[id,network_id]), path(network) ]

Copilot uses AI. Check for mistakes.
docs/output.md Outdated

### TOPAS

[Topas] (https://bitbucket.org/sonnhammergroup/topas/src/master/) connects the maximum number of seed nodes in a top-down manner by selecting connector nodes that ensure the highest Random Walk with Restart flow across the network.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Inconsistent capitalization. The section header uses "TOPAS" (all caps) but the link text uses "Topas" (title case). For consistency with other sections in this file (DIAMOnD, DOMINO, RWR, ROBUST), use "TOPAS" in the link text as well.

Copilot uses AI. Check for mistakes.
ch_raw_modules = ch_raw_modules.mix(GT_TOPAS.out.module)
}


Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Extra blank line at end of file. Remove this additional blank line for consistency with the existing code style.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,24 @@
process TOPAS{
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Missing space before opening brace. For consistency with other process definitions in the codebase (e.g., modules/local/robust/main.nf:2, modules/local/rwr/main.nf:2), add a space before the opening brace.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
include { GRAPHTOOLPARSER } from '../../../modules/local/graphtoolparser/main'
include { TOPAS } from '../../../modules/local/topas/main'

Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Missing header comment block. All other similar workflow files (gt_robust, gt_rwr, gt_diamond, gt_domino) include a header comment describing the workflow's purpose. Add a comment block like:

//
// Prepares the input for TOPAS and runs the tool
//

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +18
tuple val(meta), path("${meta.id}.topas.txt") , emit: module
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
"""
run_topas.R -n $network -s $seeds -o ${meta.id}.topas.txt
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The meta.id value is interpolated directly into the shell command (run_topas.R -n $network -s $seeds -o ${meta.id}.topas.txt) without any quoting or sanitization, which allows shell command injection when meta.id contains characters like ;, &, or backticks. Because meta.id is ultimately derived from user-controlled seed and network filenames (seeds.baseName and network.baseName), an attacker who can choose these names could craft a value such as foo; rm -rf / and cause arbitrary commands to execute inside the TOPAS container when this process runs. Restrict meta.id to a safe character set (e.g. alphanumerics, _, -) before it reaches this process and/or ensure it is safely shell-quoted when building the command line so that it is treated purely as a filename.

Suggested change
tuple val(meta), path("${meta.id}.topas.txt") , emit: module
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
"""
run_topas.R -n $network -s $seeds -o ${meta.id}.topas.txt
tuple val(meta), path("${meta.id.replaceAll(/[^A-Za-z0-9_-]/,'_')}.topas.txt") , emit: module
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def safeId = meta.id.replaceAll(/[^A-Za-z0-9_-]/,'_')
"""
run_topas.R -n $network -s $seeds -o ${safeId}.topas.txt

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants