Skip to content

fix bug for inf fc#103

Merged
tonywu1999 merged 2 commits intodevelfrom
fix-inf
May 1, 2026
Merged

fix bug for inf fc#103
tonywu1999 merged 2 commits intodevelfrom
fix-inf

Conversation

@tonywu1999
Copy link
Copy Markdown
Contributor

@tonywu1999 tonywu1999 commented Apr 30, 2026

Motivation and Context

This PR fixes a bug in the filtering logic for handling infinite fold change (log2FC) values in .filterGetSubnetworkFromIndraInput. Previously, when include_infinite_fc was FALSE, rows with infinite log2FC could remain in the input (causing adj.pvalue == 0 entries and other downstream issues). The change makes removal of infinite log2FC conditional on the presence of a log2FC column and ensures infinite values are excluded when include_infinite_fc is FALSE while still allowing explicit inclusion or force-inclusion behavior.

Changes

  • R/utils_getSubnetworkFromIndra.R
    • .filterGetSubnetworkFromIndraInput:
      • Added conditional filtering so infinite log2FC rows are actively removed when include_infinite_fc = FALSE, but only if a "log2FC" column exists:
        • if ("log2FC" %in% colnames(input)) { input <- input[!is.infinite(input$log2FC), ] }
      • Retains behavior of collecting infinite FC rows into infinite_fc_proteins when include_infinite_fc = TRUE and later recombining them (with de-duplication).
      • Preserves force_include_other exemption logic (exempt rows are re-added after filtering).
  • tests/testthat/test-utils_getSubnetworkFromIndra.R
    • Added tests that exercise the infinite-FC handling and force-inclusion behavior (see Testing section).
  • .Rbuildignore
    • Added .positai and .claude to ignore rules.
  • .gitignore
    • Added .positai to ignore rules.

Testing

  • tests/testthat/test-utils_getSubnetworkFromIndra.R
    • New tests for .filterGetSubnetworkFromIndraInput:
      • Verifies that infinite-FC proteins with adj.pvalue == 0 are excluded when include_infinite_fc = FALSE.
      • Verifies that an infinite-FC protein can still be included via force_include_other (e.g., "HGNC:...") even when include_infinite_fc = FALSE.
    • Existing tests covering p-value cutoff, logFC cutoff, direction filtering, and force_include_other behavior remain and continue to validate related behaviors.

Coding guidelines / violations

  • None detected in the changed files. The edits are small, internal, and follow existing style and error-checking conventions.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

📝 Walkthrough

Walkthrough

Updated .filterGetSubnetworkFromIndraInput to remove rows with infinite log2FC from the main input when include_infinite_fc = FALSE. Added unit tests covering exclusion and force_include_other override behavior. Minor .gitignore/.Rbuildignore additions for .positai and .claude.

Changes

Cohort / File(s) Summary
Core Function Update
R/utils_getSubnetworkFromIndra.R
.filterGetSubnetworkFromIndraInput now actively excludes rows with log2FC == Inf from the primary input when include_infinite_fc is FALSE (previously they were only optionally captured when TRUE).
Test Coverage
tests/testthat/test-utils_getSubnetworkFromIndra.R
Added two tests: one asserting infinite log2FC rows are excluded when include_infinite_fc = FALSE, and one asserting force_include_other can override exclusion to retain an Inf protein.
Ignore Lists
.Rbuildignore, .gitignore
Added .positai (both) and .claude (.Rbuildignore) to ignore rules to exclude these paths from builds/versioning.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped through rows of Inf and glee,
Sniffed out the ones that shouldn't be.
When FALSE says "no," I clear the pack,
But friends in force_include get brought back.
A tiny filter, tidy and spry — hop! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix bug for inf fc' is vague and uses abbreviations that lack clarity about the specific change. Improve the title to be more descriptive, e.g., 'Fix infinite fold change filtering when include_infinite_fc is FALSE' to clearly convey the bug fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description is comprehensive and well-structured, covering motivation, detailed changes, testing, and coding guidelines.

✏️ 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 fix-inf

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 Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.35%. Comparing base (bd63525) to head (d1d3178).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #103      +/-   ##
==========================================
+ Coverage   75.31%   75.35%   +0.04%     
==========================================
  Files           9        9              
  Lines        1045     1047       +2     
==========================================
+ Hits          787      789       +2     
  Misses        258      258              

☔ 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.

@tonywu1999 tonywu1999 merged commit 7a2aae2 into devel May 1, 2026
4 checks passed
@tonywu1999 tonywu1999 deleted the fix-inf branch May 1, 2026 03:44
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