mirror of
https://github.com/johrpan/ubigen.git
synced 2025-10-26 19:57:24 +01:00
gsea: Show all sources in plot
This commit is contained in:
parent
4cb08de325
commit
af364b1da8
1 changed files with 4 additions and 11 deletions
|
|
@ -28,27 +28,20 @@ result <- if (file.exists(file_path)) {
|
||||||
result[, result := lapply(analysis, function (a) a$result)]
|
result[, result := lapply(analysis, function (a) a$result)]
|
||||||
result <- result[, rbindlist(result), by = bucket]
|
result <- result[, rbindlist(result), by = bucket]
|
||||||
|
|
||||||
result <- result[source %chin% c("GO:CC", "GO:BP", "GO:MF")]
|
data <- result[, .(count = .N), by = c("bucket", "source")]
|
||||||
result[source == "GO:CC", label := "Cellular component"]
|
|
||||||
result[source == "GO:BP", label := "Biological pathway"]
|
|
||||||
result[source == "GO:MF", label := "Molecular function"]
|
|
||||||
|
|
||||||
data <- result[,
|
|
||||||
.(count = .N, label = unique(label)),
|
|
||||||
by = c("bucket", "source")
|
|
||||||
]
|
|
||||||
|
|
||||||
fig <- plotly::plot_ly() |>
|
fig <- plotly::plot_ly() |>
|
||||||
plotly::add_bars(
|
plotly::add_bars(
|
||||||
data = data,
|
data = data,
|
||||||
x = ~bucket,
|
x = ~bucket,
|
||||||
y = ~count,
|
y = ~count,
|
||||||
color = ~label
|
color = ~source
|
||||||
) |>
|
) |>
|
||||||
plotly::layout(
|
plotly::layout(
|
||||||
xaxis = list(title = "Bucket of genes (n = 500)"),
|
xaxis = list(title = "Bucket of genes (n = 500)"),
|
||||||
yaxis = list(title = "Number of associated terms"),
|
yaxis = list(title = "Number of associated terms"),
|
||||||
barmode = "stack"
|
barmode = "stack",
|
||||||
|
legend = list(title = list(text = "<b>Source of term</b>"))
|
||||||
)
|
)
|
||||||
|
|
||||||
plotly::save_image(fig, image_path, width = 1200, height = 800)
|
plotly::save_image(fig, image_path, width = 1200, height = 800)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue