shuffle everything

This commit is contained in:
Tanushree Tunstall 2022-12-12 10:35:41 +00:00
parent 8c96f1a317
commit 48d9e88bc9
3 changed files with 60 additions and 16 deletions

View file

@ -13,7 +13,7 @@ library(httr)
library(readr)
library(RCurl)
shinyServer(function(input, output) {
shinyServer(function(input, output){
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
@ -83,11 +83,13 @@ shinyServer(function(input, output) {
observeEvent(input$table_rows_selected,{
#req(length(input$table_row_selected) > 0)
mutation_pdb = as.character(unique_missense_genes[input$table_rows_selected,"position_pdb"])
mutation_af = as.character(unique_missense_genes[input$table_rows_selected,"position_af"])
mutation = as.character(unique_missense_genes[input$table_rows_selected,"hgvd_p"])
chain = as.character(unique_missense_genes[input$table_rows_selected,"chain"])
# what the absolute FUCK is this mess? I JUST WANT THE MATCH ASDLASJASDASHFKLJASDFK
# coming down from the trees was a mistake, and abandoning Perl doubly so.
clicked_position = regmatches(mutation, regexpr("[0-9]+", mutation, perl=TRUE))
#clicked_position = regmatches(mutation, regexpr("[0-9]+", mutation, perl=TRUE))
# Now update the 3D structure to highlight the clicked thing and then zoom in.
@ -96,7 +98,7 @@ shinyServer(function(input, output) {
addSelection('spacefill'
, param = list(
name = "Pos"
, sele = trimws(paste0(clicked_position,':', chain))
, sele = trimws(paste0(mutation_pdb,':', chain))
, color = "red"
#, colorValue="00ff00"
#, colorScheme="element"
@ -107,7 +109,7 @@ shinyServer(function(input, output) {
addSelection('spacefill'
, param = list(
name = "Pos"
, sele = clicked_position
, sele = mutation_af
, color = "red"
#, colorValue="00ff00"
#, colorScheme="element"
@ -115,20 +117,20 @@ shinyServer(function(input, output) {
)
NGLVieweR_proxy("af_structure") %>% updateZoomMove(
center = clicked_position,
zoom = clicked_position,
center = mutation_af,
zoom = mutation_af,
duration = 1000, # animation time in ms
z_offSet = -1
)
NGLVieweR_proxy("structure") %>% updateZoomMove(
center = trimws(paste0(clicked_position,':', chain)),
zoom = trimws(paste0(clicked_position,':', chain)),
center = trimws(paste0(mutation_pdb,':', chain)),
zoom = trimws(paste0(mutation_pdb,':', chain)),
duration = 1000, # animation time in ms
z_offSet = -1
)
output$information <- renderUI({
selected_gene=input$gene
HTML(paste0("<strong>Mutation: </strong>", as.character(unique_missense_genes[input$table_rows_selected,"mutationinformation"]),"<br/>",
HTML(paste0("<strong>Mutation: </strong>", as.character(unique_missense_genes[input$table_rows_selected,"mutationinformation_pdb"]),"<br/>",
"<strong>PDB ID: </strong>", as.character(genes[genes$Gene==selected_gene,"PDB"]),"<br/>",
"<strong>AlphaFold ID: </strong>", as.character(genes[genes$Gene==selected_gene,"AF_PDB"]), "<br/>",
"<strong>Ligand Distance: </strong>", as.character(unique_missense_genes[input$table_rows_selected,"ligand_distance"]), "<br/>",
@ -186,7 +188,21 @@ shinyServer(function(input, output) {
" and (",
paste0(
apply(
unique_missense_genes[unique_missense_genes$gene_name == gene,c("position","chain")],
unique_missense_genes[unique_missense_genes$gene_name == gene,c("position_pdb","chain")],
1,
function(x){
paste0(trimws(x[1])
)}
),
collapse=", "
), ")"
)
mutations_af = paste0(":",
as.matrix(unique_missense_genes[unique_missense_genes$gene_name == gene,c("chain")])[1],
" and (",
paste0(
apply(
unique_missense_genes[unique_missense_genes$gene_name == gene,c("position_af","chain")],
1,
function(x){
paste0(trimws(x[1])
@ -207,7 +223,7 @@ shinyServer(function(input, output) {
opacity = 0.2
)
) %>%
addSelection(type="ball+stick", #spacefill
addSelection(type="spacefill", #spacefill
param = list(name = "all_mutations",
color="orange",
sele = mutations
@ -225,14 +241,14 @@ shinyServer(function(input, output) {
opacity = 0.2
)
) %>%
addSelection(type="ball+stick", #spacefill
addSelection(type="spacefill", #spacefill
param = list(name = "all_mutations",
color="orange",
sele = mutations
sele = mutations_af
#colorScheme = "bfactor",
#opacity = 1
)
)
})
}
)
})