From e7b03932d03273c03894eb9cd3d3410578b4e6df Mon Sep 17 00:00:00 2001 From: Jacques Date: Fri, 12 Jul 2024 16:55:54 -0400 Subject: [PATCH] fix: ensure that track/features are vectors --- R/as_tibble.R | 3 ++- R/expand.R | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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))