R/validation.R

Defines functions is_not_duplicated is_rectangular

#' @importFrom magrittr equals
#' @importFrom dplyr n
is_rectangular <- function(.data, se) {
    is_rectangular_sample <-
        .data %>%
        count(!!s_(se)$symbol ) %>%
        count(n, name="nn") %>%
        nrow() %>%
        st(2)

    is_rectangular_transcript <-
        .data %>%
        count(!!f_(se)$symbol) %>%
        count(n, name="nn") %>%
        nrow() %>%
        st(2)

    is_rectangular_sample & is_rectangular_transcript
}

is_not_duplicated <- function(.data, se) {
    .data %>%
        count(!!s_(se)$symbol , !!f_(se)$symbol) %>%
        filter(n > 1) %>%
        nrow() %>%
        equals(0)
}
stemangiola/tidySummarizedExperiment documentation built on June 7, 2024, 1:09 a.m.