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 .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
^docs$
^pkgdown$
^\.github$
^\.positai$
^\.claude$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/doc/
/Meta/
docs
.positai
4 changes: 4 additions & 0 deletions R/utils_getSubnetworkFromIndra.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@
infinite_fc_proteins <- NULL
if (include_infinite_fc) {
infinite_fc_proteins <- input[is.infinite(input$log2FC), ]
} else {
if ("log2FC" %in% colnames(input)) {
input <- input[!is.infinite(input$log2FC), ]
}
}

input <- input[!is.na(input$adj.pvalue),]
Expand Down
32 changes: 32 additions & 0 deletions tests/testthat/test-utils_getSubnetworkFromIndra.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,38 @@ describe(".filterGetSubnetworkFromIndraInput", {
)
expect_true("D" %in% result$Protein)
})

test_that(".filterGetSubnetworkFromIndraInput excludes infinite FC proteins with adj.pvalue=0 when include_infinite_fc is FALSE", {
# MSstats sets adj.pvalue=0 for infinite FC proteins; they must still be excluded
input <- data.frame(
Protein = c("A", "B", "D"),
log2FC = c(3, -3, Inf),
adj.pvalue = c(0.01, 0.01, 0),
stringsAsFactors = FALSE
)
result <- MSstatsBioNet:::.filterGetSubnetworkFromIndraInput(
input, pvalueCutoff = 0.05, logfc_cutoff = NULL,
force_include_other = NULL, include_infinite_fc = FALSE, direction = "both"
)
expect_false("D" %in% result$Protein)
})

test_that(".filterGetSubnetworkFromIndraInput includes infinite FC protein via force_include_other even when include_infinite_fc is FALSE", {
input <- cbind(
data.frame(
Protein = c("A", "B", "D"),
log2FC = c(3, -3, Inf),
adj.pvalue = c(0.01, 0.01, 0),
stringsAsFactors = FALSE
),
HgncId = c("1", "2", "4")
)
result <- MSstatsBioNet:::.filterGetSubnetworkFromIndraInput(
input, pvalueCutoff = 0.05, logfc_cutoff = NULL,
force_include_other = c("HGNC:4"), include_infinite_fc = FALSE, direction = "both"
)
expect_true("D" %in% result$Protein)
})

test_that(".filterGetSubnetworkFromIndraInput filters by direction up", {
result <- MSstatsBioNet:::.filterGetSubnetworkFromIndraInput(
Expand Down
Loading