This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| ui <- bootstrapPage( | |
| selectizeInput('foo', choices = NULL, label="Species") | |
| ) | |
| server <- function(input, output, session) | |
| { | |
| updateSelectizeInput(session, 'foo', choices = state.name, server = TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(shinydashboard) | |
| library(googleAuthR) | |
| options("googleAuthR.scopes.selected" = c("https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email")) | |
| options("googleAuthR.webapp.client_id" = "906514199468-1jpkqgngur8emoqfg9j460s47fdo2euo.apps.googleusercontent.com") | |
| options("googleAuthR.webapp.client_secret" = "I7Gqp83Ku4KJxL9zHWYxG_gD") | |
| user_info <- function(){ | |
| f <- gar_api_generator("https://www.googleapis.com/oauth2/v1/userinfo", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get_beta_se_from_p_z_n_vary <- function(z, n, vy, maf) | |
| { | |
| qval <- qchisq(pnorm(abs(z), low=FALSE)*2, 1, low=F) / (qchisq(pnorm(abs(z), low=FALSE)*2, n-2, low=F)/(n-2)) | |
| r <- sqrt(sum(qval / (n - qval))) | |
| b <- sign(z) * sqrt(r^2 * vy / (2*maf*(1-maf))) | |
| se <- b / z | |
| return(list(b=b, se=se)) | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| palette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3", | |
| "#FF7F00", "#FFFF33", "#A65628", "#F781BF", "#999999")) | |
| shinyServer(function(input, output, session) { | |
| # Combine the selected variables into a new data frame | |
| selectedData <- reactive({ | |
| iris[, c(input$xcol, input$ycol)] | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: Notes on survival analysis | |
| author: Gibran Hemani | |
| date: "`r Sys.Date()`" | |
| output: pdf_document | |
| bibliography: survival.bib | |
| --- | |
| These notes are based on [http://data.princeton.edu/wws509/notes](http://data.princeton.edu/wws509/notes). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # In R: | |
| load("/panfs/panasas01/shared/alspac/deprecated/gib/aries_renormalised/condanal_results.RData") | |
| mprobes <- c("cg06500161", "cg11024682", "cg07094298", "cg04011474", "cg10192877", "cg17782974", "cg20496314", "cg07202479", "cg09494176", "cg17501210", "cg21139312", "cg26403843") | |
| b <- subset(condres, CPG %in% mprobes) | |
| write.table(unique(b$SNP), file="~/snplist.txt", row=F, col=F, qu=F) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impute <- function(X) | |
| { | |
| apply(X, 2, function(x) { | |
| x[is.na(x)] <- mean(x, na.rn=T) | |
| return(x) | |
| }) | |
| } | |
| # Original matrix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| while [[ $# > 1 ]] | |
| do | |
| key="$1" | |
| case $key in | |
| -g|--rootname) | |
| genort="${2}" | |
| shift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rowCors = function(x, y) | |
| { | |
| sqr = function(x) x*x | |
| if(!is.matrix(x)||!is.matrix(y)||any(dim(x)!=dim(y))) | |
| stop("Please supply two matrices of equal size.") | |
| x = sweep(x, 1, rowMeans(x)) | |
| y = sweep(y, 1, rowMeans(y)) | |
| cor = rowSums(x*y) / sqrt(rowSums(sqr(x))*rowSums(sqr(y))) | |
| return(cor) | |
| } |