Skip to content

Commit

Permalink
Add unit test for mixed GENCODE and ENSEMBL annotation
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Eagles <[email protected]>
  • Loading branch information
HediaTnani and Nick-Eagles committed Jan 12, 2024
1 parent a5b2fd0 commit af15128
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ test_that("check_tx_names throw error if annotation is not GENCODE or ENSEMBL",
expect_error(check_tx_names(rownames(altered_covComb_tx_deg), sig_transcripts, 'rownames(rse_tx)', 'sig_transcripts'), "rownames\\(rse_tx\\)' must use either all GENCODE or all ENSEMBL transcript IDs")
})

# Test for check_tx_names transcripts throw errors if annotation is not mixed GENCODE and ENSEMBL
test_that("Mixed row names annotations throw an error", {
# For testing the error condition, altered manually rownames of covComb_tx_deg
altered_covComb_tx_deg <- covComb_tx_deg
rownames(altered_covComb_tx_deg)[1] <- "ENST00000442987" # Change the first rowname
rownames(altered_covComb_tx_deg)[2] <- "ENST00000623083" # Change the second rowname
sig_transcripts <- select_transcripts("cell_component")
expect_error({
# Check if mixed row names annotations (ENST and ENST.*?\.) throw an error
check_tx_names(rownames(altered_covComb_tx_deg), sig_transcripts, 'rownames(rse_tx)', 'sig_transcripts')

}, "rownames\\(rse_tx\\)' must use either all GENCODE or all ENSEMBL transcript IDs")
})

0 comments on commit af15128

Please sign in to comment.