Skip to content

Commit

Permalink
Improve the unit test where at least one sig_transcript is in covComb…
Browse files Browse the repository at this point in the history
…_tx_deg rownames
  • Loading branch information
HediaTnani committed Jan 8, 2024
1 parent 62c896c commit 5fb0760
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/testthat/test-getDegTx.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,26 @@ test_that("getDegTx correctly processes covComb_tx_deg", {
})


# Test where all sig_transcripts are in covComb_tx_deg rownames
test_that("All sig_transcripts are in rse_tx rownames", {
# Test where at least one sig_transcript is in covComb_tx_deg rownames
test_that("At least one sig_transcript is in covComb_tx_deg rownames", {
sig_transcripts <- select_transcripts("cell_component")
expect_silent({
# Check if any of the sig_transcripts are in covComb_tx_deg rownames
if (!any(sig_transcripts %in% rownames(covComb_tx_deg))) {
stop("sig_transcripts and rownames(rse_tx) do not match")
stop("No sig_transcripts found in rownames(covComb_tx_deg)")
}
})
})

# Test where none of the sig_transcripts are in the rse_tx rownames
test_that("No sig_transcripts are in rse_tx rownames", {
sig_transcripts <- c("gene4", "gene5", "gene6")
# Test where none of the sig_transcripts are in the covComb_tx_deg rownames
test_that("No sig_transcripts are in covComb_tx_deg rownames", {
sig_transcripts <- c("gene4", "gene5", "gene6") # Example genes not in covComb_tx_deg
expect_error({
# Check if any of the sig_transcripts are in covComb_tx_deg rownames
if (!any(sig_transcripts %in% rownames(covComb_tx_deg))) {
stop("sig_transcripts and rownames(rse_tx) do not match")
stop("No sig_transcripts found in rownames(covComb_tx_deg)")
}
}, "sig_transcripts and rownames(rse_tx) do not match")
}, "No sig_transcripts found in rownames(covComb_tx_deg)")
})

# Test whether getDegTx gives the same results with original and altered row names
Expand Down

0 comments on commit 5fb0760

Please sign in to comment.