# tests/testthat/test-droplevels.R In steinbaugh/brio: Pipette Biological Data In and Out of R

```context("droplevels")

Rle <- structure("Rle", package = "S4Vectors")  # nolint

## This is defined in S4Vectors.
test_that("DataFrame", {
cd <- colData(rse)
expect_s4_class(cd, "DataFrame")
x <- droplevels(cd)
expect_s4_class(x, "DataFrame")
expect_identical(
object = lapply(x, class),
expected = list(condition = "factor")
)
})

test_that("Early return on empty DataFrame", {
expect_identical(droplevels(DataFrame()), DataFrame())
})

test_that("IRanges", {
expect_identical(droplevels(ir), ir)
})

test_that("GRanges", {
rr <- rowRanges(rse)
expect_s4_class(rr, "GRanges")
x <- droplevels(rr)
expect_s4_class(x, "GRanges")
if (packageVersion("GenomicRanges") < "1.31") {
AsIs <- "AsIs"  # nolint
} else {
AsIs <- "list"  # nolint
}
expect_identical(
object = lapply(mcols(x), class),
expected = list(
description = Rle,
entrezID = AsIs,
geneBiotype = Rle,
geneID = Rle,
geneIDVersion = Rle,
geneName = Rle,
seqCoordSystem = Rle
)
)
})

test_that("SummarizedExperiment", {
x <- droplevels(rse)
expect_s4_class(x, "RangedSummarizedExperiment")
## Check for factor columns.
ok <- any(vapply(
X = decode(rowData(x)),
FUN = is.factor,
FUN.VALUE = logical(1L)
))
expect_true(ok)
ok <- any(vapply(
X = decode(colData(x)),
FUN = is.factor,
FUN.VALUE = logical(1L)
))
expect_true(ok)
})
```
steinbaugh/brio documentation built on Jan. 31, 2020, 11:59 p.m.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6634069,"math_prob":0.96350515,"size":1407,"snap":"2020-10-2020-16","text_gpt3_token_len":418,"char_repetition_ratio":0.14326443,"word_repetition_ratio":0.057471264,"special_character_ratio":0.3084577,"punctuation_ratio":0.18811882,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9970947,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-04-05T08:09:30Z\",\"WARC-Record-ID\":\"<urn:uuid:f9ee070c-e120-4f42-94fc-3162dd1fcf4f>\",\"Content-Length\":\"58099\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f1e5d4b9-5809-4d94-83ab-07850d21cb95>\",\"WARC-Concurrent-To\":\"<urn:uuid:dc9ed28c-1d65-4633-852d-607ae62f9110>\",\"WARC-IP-Address\":\"104.28.7.171\",\"WARC-Target-URI\":\"https://rdrr.io/github/steinbaugh/brio/src/tests/testthat/test-droplevels.R\",\"WARC-Payload-Digest\":\"sha1:OZGZXL3LH4UZIBUSPH6LHEQFABHNXK4K\",\"WARC-Block-Digest\":\"sha1:2ECP3YLCL7DWICTXZJ5SUZ2IHHRD6NS4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-16/CC-MAIN-2020-16_segments_1585370529375.49_warc_CC-MAIN-20200405053120-20200405083120-00295.warc.gz\"}"}