From 3d7c508a83ba11d8c13589a823bde1556f496d77 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Fri, 15 Jul 2022 08:57:10 +0200 Subject: [PATCH] gsea: Improve smoothing resolution --- scripts/gsea.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/gsea.R b/scripts/gsea.R index c9c83d3..5b25d54 100644 --- a/scripts/gsea.R +++ b/scripts/gsea.R @@ -30,7 +30,10 @@ result <- result[, rbindlist(result), by = bucket] data <- result[, .(count = .N), by = c("bucket", "source")] data[, total := sum(count), by = bucket] -smooth_model <- loess(total ~ bucket, data, span = 0.25) + +smooth_model <- loess(total ~ bucket, data, span = 0.3) +bucket_smoothed <- seq(1, nrow(data), 0.1) +total_smoothed <- predict(smooth_model, bucket_smoothed) fig <- plotly::plot_ly(data) |> plotly::add_bars( @@ -39,8 +42,8 @@ fig <- plotly::plot_ly(data) |> color = ~source ) |> plotly::add_lines( - x = ~bucket, - y = predict(smooth_model), + x = ~bucket_smoothed, + y = ~total_smoothed, name = "All (smoothed)" ) |> plotly::layout(