transfer from old repo
This commit is contained in:
parent
cfa4a5f9cc
commit
277e2b8cf3
1111 changed files with 83736 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
name: hwe_calc
|
||||
title:
|
||||
username:
|
||||
account: cognitiveindex
|
||||
server: shinyapps.io
|
||||
hostUrl: https://api.shinyapps.io/v1
|
||||
appId: 6803322
|
||||
bundleId: 6213208
|
||||
url: https://cognitiveindex.shinyapps.io/hwe_calc/
|
||||
when: 1660807491.6397
|
||||
lastSyncTime: 1660807491.63971
|
||||
69
apps/HWE Calc/server.R
Normal file
69
apps/HWE Calc/server.R
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
server <- function(input, output, session) {
|
||||
|
||||
cale <- reactive({
|
||||
as.numeric(input$ale)
|
||||
})
|
||||
|
||||
dat<-reactive({
|
||||
df<-data.frame(lbls=c("MM","MN","NN","MO","NO","OO"),
|
||||
value=rbind(input$mm,input$mn,input$nn,input$mo,input$no,input$oo),
|
||||
stringsAsFactors = FALSE)
|
||||
print(df)
|
||||
df
|
||||
})
|
||||
|
||||
cmm <- reactive({
|
||||
as.numeric(input$mm)
|
||||
})
|
||||
|
||||
cmn <- reactive({
|
||||
as.numeric(input$mn)
|
||||
})
|
||||
|
||||
cnn <- reactive({
|
||||
as.numeric(input$nn)
|
||||
})
|
||||
|
||||
cmo <- reactive({
|
||||
as.numeric(input$mo)
|
||||
})
|
||||
|
||||
cno <- reactive({
|
||||
as.numeric(input$no)
|
||||
})
|
||||
|
||||
coo <- reactive({
|
||||
as.numeric(input$oo)
|
||||
})
|
||||
|
||||
hwe_p <- function() ({ hwe_geno(cmm(),cmn(),cnn(),cmo(),cno(),coo(),alleles=cale()) })
|
||||
|
||||
output$allele.tbl <- renderTable({ hwe_p()$allele.dist })
|
||||
|
||||
output$obs.tbl <- renderTable({ hwe_p()$observed.dist })
|
||||
|
||||
output$exp.tbl <- renderTable({ hwe_p()$expected.dist })
|
||||
|
||||
output$chi.val <- renderTable({ hwe_p()$chi.value })
|
||||
|
||||
output$p.val <- renderTable({ hwe_p()$p.value })
|
||||
|
||||
output$allele.dist <- renderText({"Allele distribution"})
|
||||
|
||||
output$obs.dist <- renderText({"Observed distribution"})
|
||||
|
||||
output$exp.dist <- renderText({"Expected distribution"})
|
||||
|
||||
output$chi <- renderText({"Chi square value"})
|
||||
|
||||
output$p <- renderText({"P value"})
|
||||
|
||||
output$geno.pie.plt<- renderPlot({
|
||||
ggplot(dat(), aes(x="", y=value, fill=lbls))+
|
||||
geom_bar(width = 1, stat = "identity")+
|
||||
coord_polar("y", start=0)+
|
||||
scale_fill_brewer(palette="Dark2")
|
||||
})
|
||||
|
||||
output$geno.pie.ttl <- renderText({"Genotype distribution"})
|
||||
}
|
||||
85
apps/HWE Calc/ui.R
Normal file
85
apps/HWE Calc/ui.R
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
source("https://raw.githubusercontent.com/agdamsbo/daDoctoR/master/R/hwe_geno.R")
|
||||
|
||||
library(shiny)
|
||||
library(ggplot2)
|
||||
|
||||
ui <- fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Chi square test of HWE for bi- or triallelic systems"),
|
||||
|
||||
sidebarLayout(
|
||||
sidebarPanel(
|
||||
|
||||
# Input: Numeric entry for number of alleles ----
|
||||
radioButtons(inputId = "ale",
|
||||
label = "Number of alleles:",
|
||||
inline = FALSE,
|
||||
choiceNames=c("Two alleles (M, N)",
|
||||
"Three alleles (M, N, O)"),
|
||||
choiceValues=c(2,3)),
|
||||
|
||||
h4("Observed genotype distribution"),
|
||||
|
||||
numericInput(inputId = "mm",
|
||||
label = "MM:",
|
||||
value=NA),
|
||||
|
||||
numericInput(inputId = "mn",
|
||||
label = "MN:",
|
||||
value=NA),
|
||||
|
||||
numericInput(inputId = "nn",
|
||||
label = "NN:",
|
||||
value=NA),
|
||||
conditionalPanel(condition = "input.ale==3",
|
||||
|
||||
numericInput(inputId = "mo",
|
||||
label = "MO:",
|
||||
value=NA),
|
||||
|
||||
numericInput(inputId = "no",
|
||||
label = "NO:",
|
||||
value=NA),
|
||||
|
||||
numericInput(inputId = "oo",
|
||||
label = "OO:",
|
||||
value=NA))
|
||||
|
||||
),
|
||||
|
||||
mainPanel(
|
||||
tabsetPanel(
|
||||
tabPanel("Summary",
|
||||
h3(textOutput("obs.dist", container = span)),
|
||||
htmlOutput("obs.tbl", container = span),
|
||||
|
||||
h3(textOutput("exp.dist", container = span)),
|
||||
htmlOutput("exp.tbl", container = span),
|
||||
|
||||
h3(textOutput("allele.dist", container = span)),
|
||||
htmlOutput("allele.tbl", container = span),
|
||||
|
||||
value=1),
|
||||
|
||||
tabPanel("Calculations",
|
||||
|
||||
h3(textOutput("chi", container = span)),
|
||||
htmlOutput("chi.val", container = span),
|
||||
|
||||
h3(textOutput("p", container = span)),
|
||||
htmlOutput("p.val", container = span),
|
||||
|
||||
value=2),
|
||||
|
||||
|
||||
|
||||
tabPanel("Plots",
|
||||
h3(textOutput("geno.pie.ttl", container = span)),
|
||||
plotOutput("geno.pie.plt"),
|
||||
|
||||
value=3),
|
||||
selected= 2, type = "tabs")
|
||||
)
|
||||
)
|
||||
)
|
||||
Loading…
Reference in a new issue