Skip to content
Open
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
1 change: 0 additions & 1 deletion MPA/MPA.Rproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Version: 1.0
ProjectId: 6922b498-8eb0-4d69-a638-8e3ee1fca3c1

RestoreWorkspace: Default
SaveWorkspace: Default
Expand Down
2 changes: 1 addition & 1 deletion MPA/R/MPA_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ compute_reaction_score <- function(expr_data, reaction_data){
#' @export
compute_pathway_score <- function(expr_data, pathway_data){
pert_score <- 0
# pert_score <- expr_data + pathway_data
#pert_score <- expr_data + pathway_data
# compute perturbation score using expression data and pathway data
return(pert_score)
}
Expand Down
14 changes: 14 additions & 0 deletions MPA/tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ test_that("compute_pathway_score", {
})



test_that("compute_reaction_score", {
expr_data <- data.frame(row.names = c("m1","m2","m3"),
condition = c(1.4,2,3),
Expand All @@ -29,3 +30,16 @@ test_that("compute_reaction_score", {
expected_score <- 1
expect_equal(compute_reaction_score(expr_data, reaction_data), expected_score)
})

test_that("compute_reaction_score_negvalues", {
expr_data <- data.frame(row.names = c("m1","m2","m3"),
condition = c(-1.4,-2,-3),
control = c(-3,-4,-5))
reaction_data <- list(left = data.frame(row.names = c("m155","m20","m30"),
coefficient = c(-1,-1,-1)),
right = data.frame(row.names = c("m1","m2","m13"),
coefficient = c(-1,-1,-1)))
expected_score <- 1
expect_equal(compute_reaction_score(expr_data, reaction_data), expected_score)
})