mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 11:17:24 +01:00
Add links to Ensembl for genes
This commit is contained in:
parent
8fc743fe10
commit
8b727a0329
1 changed files with 25 additions and 4 deletions
29
server.R
29
server.R
|
|
@ -5,6 +5,15 @@ library(shiny)
|
|||
source("init.R")
|
||||
source("scatter_plot.R")
|
||||
|
||||
#' Java script function to replace gene IDs with Ensembl gene links.
|
||||
js_link <- JS("function(row, data) {
|
||||
let id = data[1];
|
||||
var name = data[2];
|
||||
if (!name) name = 'Unknown';
|
||||
let url = `https://www.ensembl.org/Homo_sapiens/Gene/Summary?g=${id}`;
|
||||
$('td:eq(1)', row).html(`<a href=\"${url}\" target=\"_blank\">${name}</a>`);
|
||||
}")
|
||||
|
||||
server <- function(input, output) {
|
||||
#' This reactive expression applies all user defined filters as well as the
|
||||
#' desired ranking weights to the results.
|
||||
|
|
@ -40,16 +49,28 @@ server <- function(input, output) {
|
|||
|
||||
output$genes <- renderDT({
|
||||
dt <- datatable(
|
||||
results()[, .(.I, name, clusteriness, r_mean, score)],
|
||||
results()[, .(
|
||||
.I,
|
||||
gene,
|
||||
name,
|
||||
clusteriness,
|
||||
r_mean,
|
||||
score
|
||||
)],
|
||||
rownames = FALSE,
|
||||
colnames = c(
|
||||
"Rank",
|
||||
"",
|
||||
"Gene",
|
||||
"Clusteriness",
|
||||
"",
|
||||
"Clusters",
|
||||
"Correlation",
|
||||
"Score"
|
||||
),
|
||||
style = "bootstrap"
|
||||
style = "bootstrap",
|
||||
options = list(
|
||||
rowCallback = js_link,
|
||||
columnDefs = list(list(visible = FALSE, targets = 2))
|
||||
)
|
||||
)
|
||||
|
||||
formatPercentage(dt, c("clusteriness", "r_mean", "score"), digits = 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue