library(MethylExpress)
test_that("input of number for strand1 param throws error", {
expect_error(findDifferencesInDNASequence(1, "aacgttt"))
})
test_that("input of number for strand2 param throws error", {
expect_error(findDifferencesInDNASequence("aacg", 1))
})
test_that("parameters have different lengths throws error", {
expect_error(findDifferencesInDNASequence("aacg", "aacgttt"))
})
test_that("no differences between the two DNA strands - nothing is highlighted", {
expResult <- c()
expResult <- c(expResult, "<b style='float: left'>Strand 1:</b><br></br>")
expResult <- c(expResult, "<span style='float: left'> cccc </span>")
expResult <- c(expResult, "<br><br>")
expResult <- c(expResult, "<div style='clear: both'><b><br>Strand 2:</b></div><br>")
expResult <- c(expResult, "<span style='float: left'> cccc </span>")
file <- DNASequenceHighlights("cccc", "cccc")
expect_identical(readLines(file), expResult)
})
test_that("all nucleotides are different b/w strands - everything is highlighted", {
expResult <- c()
expResult <- c(expResult, "<b style='float: left'>Strand 1:</b><br></br>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> c </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> g </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> t </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> a </span>")
expResult <- c(expResult, "<br><br>")
expResult <- c(expResult, "<div style='clear: both'><b><br>Strand 2:</b></div><br>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> a </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> t </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> g </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> c </span>")
file <- DNASequenceHighlights("cgta", "atgc")
expect_identical(readLines(file), expResult)
})
test_that("one nucleotide is different b/w strands (and is highlighted)", {
expResult <- c()
expResult <- c(expResult, "<b style='float: left'>Strand 1:</b><br></br>")
expResult <- c(expResult, "<span style='float: left'> a </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> t </span>")
expResult <- c(expResult, "<span style='float: left'> cg </span>")
expResult <- c(expResult, "<br><br>")
expResult <- c(expResult, "<div style='clear: both'><b><br>Strand 2:</b></div><br>")
expResult <- c(expResult, "<span style='float: left'> a </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> a </span>")
expResult <- c(expResult, "<span style='float: left'> cg </span>")
file <- DNASequenceHighlights("atcg", "aacg")
expect_identical(readLines(file), expResult)
})
test_that("one nucleotide is different b/w strands (and is highlighted) - longer DNA strands", {
expResult <- c()
expResult <- c(expResult, "<b style='float: left'>Strand 1:</b><br></br>")
expResult <- c(expResult, "<span style='float: left'> aac </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> c </span>")
expResult <- c(expResult, "<span style='float: left'> aaagggagagaga </span>")
expResult <- c(expResult, "<br><br>")
expResult <- c(expResult, "<div style='clear: both'><b><br>Strand 2:</b></div><br>")
expResult <- c(expResult, "<span style='float: left'> aac </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> t </span>")
expResult <- c(expResult, "<span style='float: left'> aaagggagagaga </span>")
file <- DNASequenceHighlights("aaccaaagggagagaga", "aactaaagggagagaga")
expect_identical(readLines(file), expResult)
})
test_that("multiple nucleotides are different b/w strands (and is highlighted)
- longer DNA strands", {
expResult <- c()
expResult <- c(expResult, "<b style='float: left'>Strand 1:</b><br></br>")
expResult <- c(expResult, "<span style='float: left'> aac </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> c </span>")
expResult <- c(expResult, "<span style='float: left'> aaacccag </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> c </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> c </span>")
expResult <- c(expResult, "<span style='float: left'> aga </span>")
expResult <- c(expResult, "<br><br>")
expResult <- c(expResult, "<div style='clear: both'><b><br>Strand 2:</b></div><br>")
expResult <- c(expResult, "<span style='float: left'> aac </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> t </span>")
expResult <- c(expResult, "<span style='float: left'> aaacccag </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> t </span>")
expResult <- c(expResult, "<span style='background-color: yellow; float: left'> t </span>")
expResult <- c(expResult, "<span style='float: left'> aga </span>")
file <- DNASequenceHighlights("aaccaaacccagccaga", "aactaaacccagttaga")
expect_identical(readLines(file), expResult)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.