diff --git a/R/as_tibble.R b/R/as_tibble.R index 619b45b..649344e 100644 --- a/R/as_tibble.R +++ b/R/as_tibble.R @@ -33,7 +33,8 @@ as_tibble.AggregatedCoverage <- function(x, ...) { dplyr::bind_cols() |> dplyr::mutate( coord = seq(-w/2, w/2-1, by = bin), - track = t, features = f + track = factor(t, levels = tracks), + features = factor(f, levels = features) ) |> dplyr::relocate(coord) |> dplyr::relocate(features) |> diff --git a/R/expand.R b/R/expand.R index 8872ab1..e5d5449 100644 --- a/R/expand.R +++ b/R/expand.R @@ -38,7 +38,8 @@ expand.CoverageExperiment <- function(data, ..., .name_repair = NULL) { m <- assay(data, "coverage")[f, t][[1]] |> as.data.frame() |> dplyr::mutate( - track = t, features = f, + track = factor(t, levels = tracks), + features = factor(f, levels = features), chr = as.vector(seqnames(rr)), ranges = as.character(rr), strand = as.vector(strand(rr))