Skip to content

Event handler#98

Merged
tonywu1999 merged 6 commits intodevelfrom
event-handler
Apr 16, 2026
Merged

Event handler#98
tonywu1999 merged 6 commits intodevelfrom
event-handler

Conversation

@tonywu1999
Copy link
Copy Markdown
Contributor

@tonywu1999 tonywu1999 commented Apr 16, 2026

Motivation and Context

This PR adds a programmatic function to delete edges from network edge data frames. It provides the programmatic counterpart to the interactive edge deletion (Ctrl+click / right-click) available in the cytoscapeNetwork function, enabling developers to manipulate network structures outside of the interactive visualization context.

Changes

  • New exported function deleteEdgeFromNetwork() in R/deleteEdgeFromNetwork.R:

    • Accepts an edges data frame and three matching criteria: source, target, and interaction
    • Validates that the input is a data frame and contains required columns (source, target, interaction)
    • Filters and removes row(s) from the edges data frame matching all three criteria
    • Returns the modified edges data frame with matching rows removed
    • Throws informative errors for invalid inputs
  • Documentation file man/deleteEdgeFromNetwork.Rd generated by roxygen2:

    • Includes function title, parameter descriptions, return value description
    • Contains executable example demonstrating the function's usage
  • NAMESPACE update:

    • Added export directive for deleteEdgeFromNetwork function

Unit Tests

No unit tests were added for the new deleteEdgeFromNetwork function. The repository has an established testing framework using testthat and mockery (as evidenced by existing test files in tests/testthat/), but no corresponding test file was created for this new functionality.

Coding Guidelines

No violations of coding guidelines were identified. The function implementation:

  • Follows the roxygen2 documentation format consistent with other exported functions in the package
  • Includes appropriate input validation with clear error messages
  • Uses standard R data frame manipulation
  • Provides clear, executable examples in the documentation

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

📝 Walkthrough

Walkthrough

A new function deleteEdgeFromNetwork() was added to remove edges from a network data frame based on specified source, target, and interaction criteria. The function includes input validation, filtering logic, roxygen documentation, and an example.

Changes

Cohort / File(s) Summary
Function Implementation
NAMESPACE, R/deleteEdgeFromNetwork.R
New exported function deleteEdgeFromNetwork() that validates input data frame structure, filters edges matching provided source/target/interaction values, and returns the filtered data frame with matching rows removed.
Documentation
man/deleteEdgeFromNetwork.Rd
Roxygen-generated documentation file defining function signature, parameter descriptions, return value, and executable usage example.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 With a hop and a snip, we delete with care,
Edges vanish when source and target pair!
From networks so tangled, connections take flight,
deleteEdgeFromNetwork makes interactions right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Event handler' is vague and does not clearly describe the main change. The PR primarily adds a deleteEdgeFromNetwork function for programmatic edge deletion, but the title suggests event handling functionality. Provide a more specific title that reflects the actual changes, such as 'Add deleteEdgeFromNetwork function for removing edges' or 'Add programmatic edge deletion functionality'.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description comprehensively addresses all required template sections with detailed information about motivation, changes, and testing considerations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch event-handler

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.31%. Comparing base (8991901) to head (9d2832e).

Files with missing lines Patch % Lines
R/deleteEdgeFromNetwork.R 0.00% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel      #98      +/-   ##
==========================================
- Coverage   76.70%   75.31%   -1.40%     
==========================================
  Files           8        9       +1     
  Lines        1026     1045      +19     
==========================================
  Hits          787      787              
- Misses        239      258      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@R/deleteEdgeFromNetwork.R`:
- Around line 28-39: The deleteEdgeFromNetwork function currently risks NA
propagation and vector recycling; add input validation to ensure that source,
target, and interaction are scalar (length 1) and not NA (use explicit checks
and stop with a clear message if violated), and change the matching predicate to
guard against NA in edges columns by only comparing when the column value is not
NA (e.g., require !is.na(edges$source) && !is.na(edges$target) &&
!is.na(edges$interaction) in the comparison) so that NA comparisons evaluate to
FALSE instead of NA; update the symbol deleteEdgeFromNetwork and parameter names
source, target, interaction accordingly and keep returning edges[keep, , drop =
FALSE].
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd6a7d3a-a264-49f5-995f-fc0340c50bea

📥 Commits

Reviewing files that changed from the base of the PR and between 8991901 and 398b2dc.

📒 Files selected for processing (3)
  • NAMESPACE
  • R/deleteEdgeFromNetwork.R
  • man/deleteEdgeFromNetwork.Rd

Comment thread R/deleteEdgeFromNetwork.R
tonywu1999 and others added 2 commits April 16, 2026 13:29
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@tonywu1999 tonywu1999 merged commit 732fba0 into devel Apr 16, 2026
4 checks passed
@tonywu1999 tonywu1999 deleted the event-handler branch April 16, 2026 17:52
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.

2 participants