Skip to content

Commit a737ae5

Browse files
committed
fix order of colors bcbio/bcbioR#126
cc @Gammerdinger
1 parent 2d7a90e commit a737ae5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

01_quality_assessment/QC.Rmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ sanitize_datatable <- function(df, ...) {
123123
# This code will load from bcbio or nf-core folder
124124
# NOTE make sure to set numerator and denominator
125125
coldata <- load_coldata(coldata_fn)
126+
# Change this line to change the levels to the desired order.
127+
# It will affect downstream colors in plots.
128+
coldata[[factor_of_interest]] <- as.factor(coldata[[factor_of_interest]])
126129
coldata$sample <- row.names(coldata)
127130
128131
counts <- load_counts(counts_fn)
@@ -470,7 +473,7 @@ colma <- colma[rownames(vst_cor), ]
470473
colma <- colma %>% dplyr::select(.data[[factor_of_interest]])
471474
anno_colors <- lapply(colnames(colma), function(c) {
472475
l.col <- grafify:::graf_palettes[["kelly"]][1:length(unique(colma[[c]]))]
473-
names(l.col) <- unique(colma[[c]])
476+
names(l.col) <- levels(colma[[c]])
474477
l.col
475478
})
476479
names(anno_colors) <- colnames(colma)

0 commit comments

Comments
 (0)