mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 19:27:24 +01:00
Convert to R package
This commit is contained in:
parent
b2e2dbf1af
commit
d4611f47cf
15 changed files with 799 additions and 114 deletions
|
|
@ -1,37 +0,0 @@
|
|||
library(data.table)
|
||||
library(plotly)
|
||||
|
||||
#' Draw a scatter plot containing gene positions.
|
||||
#'
|
||||
#' @param results Results from [`process_input()`].
|
||||
#' @param species Species to be displayed.
|
||||
#' @param genes Genes to be displayed.
|
||||
#' @param distances Distance data to display.
|
||||
scatter_plot <- function(results, species, genes, distances) {
|
||||
species_ids <- species[, id]
|
||||
|
||||
data <- merge(
|
||||
genes[, .(id, name)],
|
||||
distances[species %in% species_ids],
|
||||
by.x = "id", by.y = "gene"
|
||||
)
|
||||
|
||||
data[name == "", name := "Unknown"]
|
||||
|
||||
plot_ly(
|
||||
data = data,
|
||||
x = ~species,
|
||||
y = ~distance,
|
||||
color = ~id,
|
||||
name = ~name,
|
||||
type = "scatter",
|
||||
mode = "markers"
|
||||
) |> layout(
|
||||
xaxis = list(
|
||||
title = "Species",
|
||||
tickvals = species_ids,
|
||||
ticktext = species[, name]
|
||||
),
|
||||
yaxis = list(title = "Distance to telomeres [Bp]")
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue