Commit 712d035d authored by Brandi Cantarel's avatar Brandi Cantarel

Merge branch 'shiny_update' into 'master'

Shiny update

Closes #3

See merge request !1
parents 568d7183 34bd6ead
Pipeline #2616 failed with stage
in 103 minutes and 49 seconds
)
)
)
)
)
),
fluidRow(
column(10,offset=1,
br(),
br(),
p("Note:Error messages can indicate data processing or missing data. Please wait 30 seconds for the program to catch up to any changes in data loading."),
h6("Questions? Contract Brandi Cantarel brandi.cantarel@baylorhealth.edu")
)
)
)
)
id='intropage',
fluidRow(
br(),
column(8,offset=2,
h1("Welcome to the RNASeq Analysis Portal", align = "center"),
br(),
br(),
div(
column(4,
div(class="card text-center",
div(class="card-header",
"Gene Compare"
),
div(class="card-body",
h5(class="card-title","To Compare Gene Abundances", align = "center"),
p(class="card-text","Here you will be able explore gene abundances by (1) Transmembrane Proteins, (2) Transcription Fractors and (3) Chemocytokines. Also you can compare the gene abundances of genes by Available Clinicial Data")
),
div(class="card-footer",
# a(class="btn btn-primary btn-sm", 'data-toggle'="tab", 'data-value'="Gene Compare", 'id'="btgc", "Gene Compare")
actionButton(class = "btn btn-primary btn-sm", inputId="actionbtgc", label="Gene Compare", icon=NULL)
)
)
),
column(4,
div(class="card text-center",
div(class="card-header",
"DEA"
),
div(class="card-body",
h5(class="card-title","To Examine Differential Gene Analysis"),
p(class="card-text","Here you will be able explore Differential Gene Expresss by Group. You will also be able to compare two comparisons: such as Case1 vs Control and Case2 vs Control.")
),
div(class="card-footer",
# a(class="btn btn-primary btn-sm", 'data-toggle'="tab",'data-value'="DEA",id="dea","DEA")
actionButton(class="btn btn-primary btn-sm", inputId = "actionbtdea", label="DEA", icon = NULL)
)
)
),
column(4,
div(class="card text-center",
div(class="card-header",
"GSEA"
),
div(class="card-body",
h5(class="card-title","To Examine Gene Set Enrichment Analysis"),
p(class="card-text","Here you will be able explore Gene Set Enrichment Analysis by Group and Gene Set List.")
),
div(class="card-footer",
#a(class="btn btn-primary btn-sm",'data-toggle'="tab", 'data-value'="QuSAGE",id="gsea","GSEA")
actionButton(class="btn btn-primary btn-sm", inputId = "actionbtgsea", label="GSEA")
)
)
)
)
)
),
fluidRow(
column(8,offset=2,
br(),
br(),
div(class="alert alert-info",
a(icon("new-window", lib="glyphicon"),strong("citation link"), href="https://git.biohpc.swmed.edu/BICF/Astrocyte/rnaseq", target="_blank", style="color:white"),
p(strong("Note:"), "Error messages can indicate data processing or missing data. Please wait 30 seconds for the program to catch up to any changes in data loading.")
)
)
)
fluidPage(id='intropage',
fluidRow(
br(),
column(8,offset=2,
h1("Welcome to the RNASeq Analysis Portal", align = "center"),
br(),
br(),
div(
column(4,
div(class="card text-center",
div(class="card-header",
"Gene Compare"
),
div(class="card-body",
h5(class="card-title","To Compare Gene Abundances", align = "center"),
p(class="card-text","Here you will be able explore gene abundances by (1) Transmembrane Proteins, (2) Transcription Fractors and (3) Chemocytokines. Also you can compare the gene abundances of genes by Available Clinicial Data")
),
div(class="card-footer",
# a(class="btn btn-primary btn-sm", 'data-toggle'="tab", 'data-value'="Gene Compare", 'id'="btgc", "Gene Compare")
actionButton(class = "btn btn-primary btn-sm", inputId="actionbtgc", label="Gene Compare", icon=NULL)
)
)
),
column(4,
div(class="card text-center",
div(class="card-header",
"DEA"
),
div(class="card-body",
h5(class="card-title","To Examine Differential Gene Analysis"),
p(class="card-text","Here you will be able explore Differential Gene Expresss by Group. You will also be able to compare two comparisons: such as Case1 vs Control and Case2 vs Control.")
),
div(class="card-footer",
# a(class="btn btn-primary btn-sm", 'data-toggle'="tab",'data-value'="DEA",id="dea","DEA")
actionButton(class="btn btn-primary btn-sm", inputId = "actionbtdea", label="DEA", icon = NULL)
)
)
),
column(4,
div(class="card text-center",
div(class="card-header",
"GSEA"
),
div(class="card-body",
h5(class="card-title","To Examine Gene Set Enrichment Analysis"),
p(class="card-text","Here you will be able explore Gene Set Enrichment Analysis by Group and Gene Set List.")
),
div(class="card-footer",
#a(class="btn btn-primary btn-sm",'data-toggle'="tab", 'data-value'="QuSAGE",id="gsea","GSEA")
actionButton(class="btn btn-primary btn-sm", inputId = "actionbtgsea", label="GSEA")
)
)
)
)
)
),
fluidRow(
column(8,offset=2,
br(),
br(),
div(class="alert alert-info",
a(icon("new-window", lib="glyphicon"),strong("citation link"), href="https://git.biohpc.swmed.edu/BICF/Astrocyte/rnaseq", target="_blank", style="color:white"),
p(strong("Note:"), "Error messages can indicate data processing or missing data. Please wait 30 seconds for the program to catch up to any changes in data loading.")
)
)
)
)
source('~/shiny_R/vizapp/workflow_322_output/t.R')
source('~/shiny_R/vizapp/workflow_322_output/t.R')
source('~/shiny_R/vizapp/workflow_322_output/t.R')
source('~/shiny_R/vizapp/workflow_322_output/t.R')
source('~/shiny_R/vizapp/workflow_322_output/t.R')
source('~/shiny_R/vizapp/workflow_322_output/t.R')
source('~/shiny_R/vizapp/workflow_322_output/t.R')
shiny::runApp('shiny_R/activebuttontab')
runApp('shiny_R/activebuttontab')
if (var$adjust == 'FDR') {
comp.filt <- na.omit(comp[abs(comp$logFC) >= var$fc.thresh & comp$fdr <= var$pval.thresh,])
}
ctfile <- paste(data.dir,'countTable.logCPM.txt',sep='/')
data.dir <- "workflow_322_output"
# UI-elements for DEA
data.dir <- "workflow_322_output"
ctfile <- paste(data.dir,'countTable.logCPM.txt',sep='/')
samfile <- paste(data.dir,'design.shiny.txt',sep='/')
cts <- read.table(file=ctfile,header=TRUE,sep='\t')
samtbl <- read.table(samfile,header=TRUE,sep="\t")
samples <- colnames(cts[,4:length(cts)])
mergetbl <- merge(as.data.frame(samples),samtbl,by.x="samples",by.y="SampleID",all.x=TRUE,sort=FALSE)
grps <- mergetbl$SampleGroup
grpnames <- levels(factor(grps))
col.blocks <-col.grp(grps,grpnames)
MSIG.geneSets <- read.gmt(paste(data.dir,'geneset.shiny.gmt',sep='/'))
output$pick.dea <- renderUI({
flist <- list.files(data.dir,pattern="*edgeR.txt$")
# selectInput("file", "Choose Pair", choices=substr(flist,0,nchar(flist)-10), width = "100%")
selectInput("file", "Choose Pair", choices=flist, width = "100%")
})
output$pick.pathway <- renderUI({
pathways <- names(MSIG.geneSets)
pathchoices = setNames(1:length(pathways),pathways)
selectInput("deapathname", "Choose Pair", choices=pathchoices)
})
get.data <- function(var) {
# var$file <- paste(var$file, ".edgeR.txt", sep="")
f <- paste(data.dir,var$file,sep='/')
print(f)
comp <- read.table(f,header=TRUE,sep='\t')
comp.filt <- na.omit(comp[abs(comp$logFC) >= var$fc.thresh & comp$rawP <= var$pval.thresh,])
if (var$adjust == 'FDR') {
comp.filt <- na.omit(comp[abs(comp$logFC) >= var$fc.thresh & comp$fdr <= var$pval.thresh,])
}
if (var$adjust == 'BONF') {
comp.filt <- na.omit(comp[abs(comp$logFC) >= var$fc.thresh & comp$bonf <= var$pval.thresh,])
}
genelist <- as.character(head(comp.filt[order(comp.filt$fdr),]$symbol,n=var$numgenes))
if (var$heatmap == 'hgeneset') {
genelist <- unlist(MSIG.geneSets[as.numeric(var$deapathname)])
}
if (var$heatmap == 'cgeneset') {
genelist <- unlist(strsplit(as.character(var$genes), "[;\n]+"))
}
return(list(filt=comp.filt,glist=genelist))
}
tbls <- eventReactive(input$deButton,{get.data(input)})
output$selectgenes <- renderUI({
symnames <- tbls()$glist
textAreaInput("genes", "Gene Symbols separated by ';'",value=paste(symnames,collapse=";"), width = '95%',rows=10)
})
output$dge.c <- DT::renderDataTable({
t1 <- tbls()$filt
t1$symbol <- paste("<a href=http://www.genecards.org/cgi-bin/carddisp.pl?gene=",t1$symbol,'>',t1$symbol,"</a>",sep='')
t1$ensembl <- paste("<a href=http://www.ensembl.org/Homo_sapiens/Gene/Summary?g=",t1$ensembl,'>',t1$ensembl,"</a>",sep='')
t1
},escape=FALSE,filter = 'top',options = list(lengthMenu = c(10, 25, 50, 200, -1), autoWidth=TRUE,columnDefs = list(list(width = '5%', targets = '0'))))
output$downloadC <- downloadHandler(
file <- paste(input$file,".filt.txt",sep=""),
content = function(file) {
write.table(tbls()$filt,file,quote=FALSE,row.names=FALSE,sep='\t')
})
plotHeatmap <- reactive({
syms <- tbls()$glist
ct2 <- cts[cts$SYMBOL %in% syms,]
subset <- ct2[,4:length(ct2)]
row.names(subset) <- ct2$SYMBOL
STREE <- hclust(dist(t(subset)))
zscores <- scale(t(subset))
ngenes <- length(colnames(zscores))
textscale <- (1/(ngenes/30))
if (textscale > 1) {
textscale <-1
}
if (textscale < 0.1) {
textscale <- 0.1
}
heatmap.2(zscores, col = bluered(100),Rowv = as.dendrogram(STREE), RowSideColors = col.blocks,dendrogram='row', cexCol=textscale,srtRow=45,srtCol=45,trace="none",margins=c(8,16))
legend("topright",legend=grpnames,col=rainbow(length(grpnames)),pch=20)
})
output$plot.heatmap <- renderPlot({
plotHeatmap()
})
output$downloadpdf = downloadHandler(
filename = "output.heatmap.pdf",
content = function(file) {
pdf(file = file,paper="letter")
plotHeatmap()
dev.off()
})
output$hm.comp <- renderImage({
f1 <- paste(data.dir,input$file,sep='/')
png <- gsub('edgeR.txt','heatmap.edgeR.png',f1)
list(src=png, alt=paste("HeatMap Comparison"))
},deleteFile=FALSE)
output$hmcomp.desc <- renderText({
paste("Heatmap of all genes with an FDR < 0.05 using EdgeR Results",sep='')
})
output$ui_dea <- renderUI({
list(
fluidPage(
includeCSS("www/style.css"),
fluidRow(
sidebarPanel(
numericInput("fc.thresh",
"LogFold Change Threshold:", 1),
numericInput("gene.thresh",
"Gene Mean Threshold:", 5),
numericInput("pval.thresh",
"P-Value Threshold:", 0.05),
selectInput("adjust", "Choose P-Value Correction", choices=c("raw","FDR",'BONF'),selected='FDR'),
uiOutput("pick.dea"),
selectInput(
"heatmap", "HeatMap",
c(Top = "top",
HallmarkGeneSet = "hgeneset",
CustomGeneSet= "cgeneset")
),
conditionalPanel(
condition = "input.heatmap == 'cgeneset'",
uiOutput("selectgenes")
),
conditionalPanel(
condition = "input.heatmap == 'top'",
numericInput("numgenes","Number Top Genes:", 50)
),
conditionalPanel(
condition = "input.heatmap == 'hgeneset'",
uiOutput("pick.pathway")
),
actionButton("deButton", "Go")
),
column(7,
tabsetPanel(
tabPanel("Differential Gene Set Comparison",br(),br(),
downloadButton('downloadC', 'Download CSV'),
dataTableOutput('dge.c', width=500, height='auto')
),
tabPanel("Heatmap",
#downloadButton('downloadpdf', 'Download Heatmap'),
h1("HeatMap Comparison"),
h3("Top 50 User Defined Genes"),
plotOutput("plot.heatmap"),
h3("All Differentially Expressed Genes"),
imageOutput("hm.comp",width="1200px",height="1200px"),
textOutput("hmcomp.desc")
)
)
)
)
),
fluidRow(style = "margin-top:40px",
tags$footer(
class = "footer",
div(
class = "container",
style = "padding-bottom:0; margin-bottom:0",
p(
icon("envelope", lib = "glyphicon"),
"brandi.cantarel@baylorhealth.edu | @ UT Southwestern Medical Center",
style = "margin-bottom:-40px;"
)
# p("@ UT Southwestern Medical Center", style = "margin-top:-40px;")
)
)))
})
#######################################
# Shiny interface for data functions
#######################################
# data ui and tabs
output$ui_dea <- renderUI({
list(
fluidPage(
includeCSS("www/style.css"),
fluidRow(
sidebarPanel(
numericInput("fc.thresh",
"LogFold Change Threshold:", 1),
numericInput("gene.thresh",
"Gene Mean Threshold:", 5),
numericInput("pval.thresh",
"P-Value Threshold:", 0.05),
selectInput("adjust", "Choose P-Value Correction", choices=c("raw","FDR",'BONF'),selected='FDR'),
uiOutput("pick.dea"),
selectInput(
"heatmap", "HeatMap",
c(Top = "top",
HallmarkGeneSet = "hgeneset",
CustomGeneSet= "cgeneset")
),
conditionalPanel(
condition = "input.heatmap == 'cgeneset'",
uiOutput("selectgenes")
),
conditionalPanel(
condition = "input.heatmap == 'top'",
numericInput("numgenes","Number Top Genes:", 50)
),
conditionalPanel(
condition = "input.heatmap == 'hgeneset'",
uiOutput("pick.pathway")
),
actionButton("deButton", "Go")
),
column(7,
tabsetPanel(
tabPanel("Differential Gene Set Comparison",br(),br(),
downloadButton('downloadC', 'Download CSV'),
dataTableOutput('dge.c', width=500, height='auto')
),
tabPanel("Heatmap",
#downloadButton('downloadpdf', 'Download Heatmap'),
h1("HeatMap Comparison"),
h3("Top 50 User Defined Genes"),
plotOutput("plot.heatmap"),
h3("All Differentially Expressed Genes"),
imageOutput("hm.comp",width="1200px",height="1200px"),
textOutput("hmcomp.desc")
)
)
)
)
),
fluidRow(style = "margin-top:40px",
tags$footer(
class = "footer",
div(
class = "container",
style = "padding-bottom:0; margin-bottom:0",
p(
icon("envelope", lib = "glyphicon"),
"brandi.cantarel@baylorhealth.edu | @ UT Southwestern Medical Center",
style = "margin-bottom:-40px;"
)
# p("@ UT Southwestern Medical Center", style = "margin-top:-40px;")
)
)))
})
runApp('shiny_R/activebuttontab')
runApp('shiny_R/vizapp')
runApp('shiny_R/vizapp')
runApp('shiny_R/activebuttontab')
install.packages("shinydashboard")
runApp('shiny_R/activebuttontab')
runApp('shiny_R/vizapp')
list(
fluidPage(
includeCSS("www/style.css"),
fluidRow(
sidebarPanel(
numericInput("fc.thresh",
"LogFold Change Threshold:", 1),
numericInput("gene.thresh",
"Gene Mean Threshold:", 5),
numericInput("pval.thresh",
"P-Value Threshold:", 0.05),
selectInput("adjust", "Choose P-Value Correction", choices=c("raw","FDR",'BONF'),selected='FDR'),
uiOutput("pick.dea"),
selectInput(
"heatmap", "HeatMap",
c(Top = "top",
HallmarkGeneSet = "hgeneset",
CustomGeneSet= "cgeneset")
),
conditionalPanel(
condition = "input.heatmap == 'cgeneset'",
uiOutput("selectgenes")
),
conditionalPanel(
condition = "input.heatmap == 'top'",
numericInput("numgenes","Number Top Genes:", 50)
),
conditionalPanel(
condition = "input.heatmap == 'hgeneset'",
uiOutput("pick.pathway")
),
actionButton("deButton", "Go", class = "btn btn-primary btn-bg centerbtn")
),
column(7,
tabsetPanel(
tabPanel("Differential Gene Set Comparison",br(),br(),
downloadButton('downloadC', 'Download CSV'),
# dataTableOutput('dge.c')
box(
title = "Box title", width = NULL, status = "primary",
div(style = 'overflow-x: scroll', DT::dataTableOutput('dge.c'))
)
),
tabPanel("Heatmap",
#downloadButton('downloadpdf', 'Download Heatmap'),
h1("HeatMap Comparison"),
h3("Top 50 User Defined Genes"),
plotOutput("plot.heatmap"),
h3("All Differentially Expressed Genes"),
imageOutput("hm.comp",width = "100%", height ="auto"),
textOutput("hmcomp.desc")
)
)
)
)
),
fluidRow(style = "margin-top:40px",
tags$footer(
class = "footer",
div(
class = "container",
style = "padding-bottom:0; margin-bottom:0",
p(
icon("envelope", lib = "glyphicon"),
"brandi.cantarel@baylorhealth.edu | @ UT Southwestern Medical Center",
style = "margin-bottom:-40px;"
)
# p("@ UT Southwestern Medical Center", style = "margin-top:-40px;")
)
)))
runApp('shiny_R/vizapp')
runApp('shiny_R/vizapp')
runApp('shiny_R/vizapp')
runApp('shiny_R/vizapp')
runApp('shiny_R/vizapp')
install.packages(shinyjs)
runApp('shiny_R/vizapp')
runApp('shiny_R/vizapp')
install.packages("shinyjs")
runApp('shiny_R/vizapp')
if(input$file==TRUE){
shinyjs::enable("downloadC")
}else{
shinyjs::disable("downloadC")
}
runApp('shiny_R/vizapp')
runApp('shiny_R/vizapp')
install.packages("shinythemes")
install.packages("shinythemes", dep=TRUE)
shiny::runApp('shiny_R/DisHet_shinyapp')
runApp('shiny_R/DisHet_shinyapp')
install.packages("DisHet")
runApp('shiny_R/DisHet_shinyapp')
runApp('shiny_R/DisHet_shinyapp')
clean
runApp('shiny_R/DisHet_shinyapp')
runApp('shiny_R/DisHet_shinyapp')
getwd()
load("/home/danni/shiny_R/DisHet_shinyapp/eTME_signatures.RData")
head(isfar)
head(eTME_signatures)
load("/home/danni/shiny_R/DisHet_shinyapp/DisHet_App_example.RData")
head(DisHet_App_example)
head(DisHet_App_example)
load("/home/danni/shiny_R/DisHet_shinyapp/DisHet_App_example.RData")
head(DisHet_App_example)
shiny::runApp('shiny_R/rnaseq/vizapp')
......@@ -3,6 +3,7 @@ update.packages()
install.packages("sqldf",dep=TRUE)
install.packages("gmp",dep=TRUE)
install.packages("shinythemes",dep=TRUE)
install.packages(c('gplots','lattice','latticeExtra','vegan','labdsv','cluster','ggplot2'))
install.packages("Vennerable", repos="http://R-Forge.R-project.org",type='source')
source("http://bioconductor.org/biocLite.R")
......
library(shiny)
library(Vennerable)
library(qusage)
library(DT)
library(ggplot2)
library(ballgown)
library(sqldf)
library(reshape2)
library("gplots")
shinyServer(function(input, output, session) {
data.dir <- Sys.getenv('outputDir')
rda.dir <- data.dir
symsyn <- read.table(file='symbol2synonym.txt',header=FALSE)
names(symsyn) <- c('symbol','synonyms')
source('functions.R', local = TRUE)
source('tools/intro.R', local = TRUE)
source('tools/gc.R', local = TRUE)
source('tools/qc.R', local = TRUE)
source('tools/altsplice.R', local = TRUE)
source('tools/dea.R', local = TRUE)
source('tools/gsea.R', local = TRUE)
#source('tools/fastqc.R', local = TRUE)
source('tools/gc_ui.R', local = TRUE)
source('tools/qc_ui.R', local = TRUE)
source('tools/dea_ui.R', local = TRUE)
source('tools/gsea_ui.R', local = TRUE)
#source('tools/fastqc_ui.R', local = TRUE)
source('tools/altsplice_ui.R', local = TRUE)
})
library(shiny)
library(Vennerable)
library(qusage)
library(DT)
library(ggplot2)
library(ballgown)
library(sqldf)
library(reshape2)
library("gplots")
shinyServer(function(input, output, session) {
data.dir <- Sys.getenv('outputDir')
#data.dir <-"../../vizapp/workflow_322_output"
rda.dir <- data.dir
symsyn <- read.table(file='symbol2synonym.txt',header=FALSE)
names(symsyn) <- c('symbol','synonyms')
source('functions.R', local = TRUE)
source('tools/intro.R', local = TRUE)
source('tools/intro_ui.R', local = TRUE)
source('tools/gc.R', local = TRUE)
source('tools/qc.R', local = TRUE)
source('tools/altsplice.R', local = TRUE)
source('tools/dea.R', local = TRUE)
source('tools/gsea.R', local = TRUE)
#source('tools/fastqc.R', local = TRUE)
source('tools/gc_ui.R', local = TRUE)
source('tools/qc_ui.R', local = TRUE)
source('tools/dea_ui.R', local = TRUE)
source('tools/gsea_ui.R', local = TRUE)
#source('tools/fastqc_ui.R', local = TRUE)
source('tools/altsplice_ui.R', local = TRUE)
})
get.bgdata <- function(var) {
rdafile <- paste(data.dir,'bg.rda',sep='/')
load(rdafile)
genetrx <- indexes(bg)$t2g
genetrx$SYMBOL <- geneNames(bg)
geneid <- as.character(unique(genetrx[genetrx$SYMBOL %in% var$symsearch,]$g_id))
if (exists("var$enssearch") && var$enssearch != '') {
geneid <- as.character(unique(genetrx$g_id[grep(enssearch,genetrx$g_id)]))
}
genebg <- subset(bg,paste0("gene_id=='",geneid,"'"))
rownames(genetrx) <- transcriptNames(bg)
fpkm <- texpr(bg,meas='FPKM')
keep <- genetrx[genetrx$g_id == geneid,]$t_id
cttbl <- fpkm[keep,]
grps <- pData(bg)$group
trxnames <- genetrx[genetrx$g_id == geneid,]
dtm <- melt(t(cttbl))
names(dtm) <- c('sample','transcript','value')
dtm$grps <- rep(grps,length(keep))
if (length(keep) < 2) {
dtm$transcript <- rep(keep,length(keep))
}
dtm$grptrx <- paste(dtm$grps,dtm$transcript,sep='.')
test <- stattest(gown=genebg, pData=pData(bg), feature='transcript',covariate='group', libadjust=FALSE,getFC=TRUE)
if (length(keep) > 1) {
agg = collapseTranscripts(gene=geneid, gown=bg, k=var$kct, method='kmeans')
test <- stattest(gowntable=<