library(testthat) library(PCAPAM50) library(ComplexHeatmap) library(circlize) test_that("makeCalls.PC1ihc works correctly with test data", { # Load the test data data_path <- system.file("extdata", "Sample_IHC_PAM-Mat.Rdat", package = "pcapam50") load(data_path) # Loads Test.ihc and Test.matrix # Prepare the data Test.ihc$ER_status <- rep("NA", length(Test.ihc$PatientID)) Test.ihc$ER_status[Test.ihc$IHC %in% c("LA", "LB1", "LB2")] <- "pos" Test.ihc$ER_status[Test.ihc$IHC %in% c("TN", "Her2+")] <- "neg" Test.ihc <- Test.ihc[order(Test.ihc$ER_status, decreasing = TRUE),] Test.matrix <- Test.matrix[, Test.ihc$PatientID] df.cln <- data.frame(PatientID = Test.ihc$PatientID, IHC = Test.ihc$IHC, stringsAsFactors = FALSE) inputDir <- "Call.PC1" # Call the function result <- makeCalls.PC1ihc(df.cln=df.cln, seed = 118, mat = Test.matrix, inputDir=inputDir) # Test the result expect_type(result, "list") expect_true("Int.sbs" %in% names(result)) expect_true("score.fl" %in% names(result)) expect_true("mdns.fl" %in% names(result)) expect_true("SBS.colr" %in% names(result)) expect_true("outList" %in% names(result)) expect_true("PC1cutoff" %in% names(result)) expect_true("DF.PC1" %in% names(result)) })