Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zosiadziedzic committed Jun 17, 2020
1 parent 940c722 commit f717533
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions gslope/R/gslope.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ gslope = function(data,
rownames(precision_matrix) = names
colnames(precision_matrix) = names

precision_matrix[abs(precision_matrix) < threshold] = 0
scaled_precision_matrix = -cov2cor(precision_matrix)

scaled_precision_matrix = -cov2cor(precision_matrix)
scaled_precision_matrix[abs(scaled_precision_matrix) < threshold] = 0

graph = graph_from_adjacency_matrix(precision_matrix,
graph = graph_from_adjacency_matrix(scaled_precision_matrix,
mode = c("undirected"),
weighted = TRUE,
diag = FALSE,
Expand Down
20 changes: 8 additions & 12 deletions gslope/inst/gslope/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ui <- fluidPage(theme = shinytheme("superhero"),
tabPanel("Matrix plot",
sidebarPanel(
selectInput("data", label = h3("Select data"),
choices = list("generated" = 1, "mtcars" = 2, "JGL: example.data" = 3),
choices = list("generated" = 1, "mtcars" = 2, "frets" = 3),
selected = 1)
),

Expand All @@ -142,7 +142,7 @@ ui <- fluidPage(theme = shinytheme("superhero"),
tabPanel("Graphs",
sidebarPanel(
selectInput("data_graph", label = h3("Select data"),
choices = list("generated" = 1, "mtcars" = 2, "JGL: example.data" = 3),
choices = list("generated" = 1, "mtcars" = 2, "frets" = 3),
selected = 1)
),

Expand All @@ -159,10 +159,7 @@ server <- function(input, output) {
library(gslope)
library(glasso)
library(mvtnorm)
library(JGL)


genes = example.data[[1]][,1:15]
library(boot)


create_Gamma = function(p){
Expand Down Expand Up @@ -218,7 +215,7 @@ server <- function(input, output) {


output$prec_est <- renderPrint({
round(gslope_X()[[1]], 4)
round(gslope_X()[[3]], 4)
})

# output$prec_est <- renderPrint({
Expand All @@ -235,16 +232,15 @@ server <- function(input, output) {
})



output$plot_prec <- renderPlot({
if(input$data == 1){
g_X = gslope(X(), scaled=TRUE, threshold = thr())
plot(g_X)
plot(g_X, plt = "scaled_precision")
}
if(input$data == 2)
plot(gslope(scale(mtcars), scaled=TRUE))
plot(gslope(scale(mtcars), scaled=TRUE), plt = "scaled_precision")
if(input$data_graph == 3)
plot(gslope(genes, scaled=TRUE))
plot(gslope(frets), plt = "scaled_precision")
})


Expand All @@ -254,7 +250,7 @@ server <- function(input, output) {
if(input$data_graph == 2)
graph_plot(gslope(scale(mtcars), scaled=TRUE))
if(input$data_graph == 3)
graph_plot(gslope(genes, scaled=TRUE))
graph_plot(gslope(frets))
})

}
Expand Down

0 comments on commit f717533

Please sign in to comment.