Skip to content

Commit

Permalink
GSE study examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jmzeng1314 committed May 16, 2016
1 parent c048257 commit e3849f3
Show file tree
Hide file tree
Showing 33 changed files with 581 additions and 488 deletions.
960 changes: 480 additions & 480 deletions .Rhistory

Large diffs are not rendered by default.

Binary file removed 8-DEG/MA.png
Binary file not shown.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added 8-DEG/example_input_output/MA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
Binary file added 8-DEG/example_input_output/qc_dispersions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
58 changes: 53 additions & 5 deletions 8-DEG/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ DEG_DESeq2 <- function(exprSet=exprSet,group_list=group_list){
colData = colData,
design = ~ group_list)
dds <- DESeq(dds)
png("qc-dispersions.png", 1000, 1000, pointsize=20)
png("qc_dispersions.png", 1000, 1000, pointsize=20)
plotDispEsts(dds, main="Dispersion plot")
dev.off()
res <- results(dds)
Expand Down Expand Up @@ -235,7 +235,7 @@ DEG_DESeq <- function(exprSet=exprSet,group_list=group_list){
de=newCountDataSet(exprSet,group_list)
de=estimateSizeFactors(de)
de=estimateDispersions(de)
png("qc-dispersions.png", 1000, 1000, pointsize=20)
png("qc_dispersions.png", 1000, 1000, pointsize=20)
DESeq::plotDispEsts(de, main="Dispersion plot")
dev.off()

Expand Down Expand Up @@ -337,13 +337,17 @@ shinyServer(function(input, output) {
})
output$matrix_control <- renderDataTable({
example_data=get_example_data()
example_data$matrix_a
tmp=example_data$matrix_a
tmp=cbind(ID=rownames(tmp),tmp)
tmp
})
output$matrix_case <- renderDataTable({
example_data=get_example_data()
example_data$matrix_b
tmp=example_data$matrix_b
tmp=cbind(ID=rownames(tmp),tmp)
tmp
})
output$DEG_results <- renderDataTable({
output$DEG_results <- renderDataTable({
example_data=get_example_data()
DEG_method=tolower(input$method)
exprSet=example_data$exprSet
Expand All @@ -368,4 +372,48 @@ shinyServer(function(input, output) {
DEG_results=cbind(symbol=rownames(DEG_results),DEG_results)
DEG_results
})
output$MA_plot <-renderImage({
list(src = "MA.png",
contentType = 'image/png',
width = 400,
height = 300,
alt = "This is alternate text")
})
output$MDS_plot <-renderImage({
list(src = "MDS.png",
contentType = 'image/png',
width = 400,
height = 300,
alt = "This is alternate text")
})
output$BCV_plot <-renderImage({
list(src = "BCV.png",
contentType = 'image/png',
width = 400,
height = 300,
alt = "This is alternate text")
})
output$volcanoplot <-renderImage({
list(src = "volcanoplot.png",
contentType = 'image/png',
width = 400,
height = 300,
alt = "This is alternate text")
})
output$qc_dispersions <-renderImage({
list(src = "qc_dispersions.png",
contentType = 'image/png',
width = 400,
height = 300,
alt = "This is alternate text")
})
output$RAWvsNORM <-renderImage({
list(src = "RAWvsNORM.png",
contentType = 'image/png',
width = 400,
height = 300,
alt = "This is alternate text")
})


})
8 changes: 5 additions & 3 deletions 8-DEG/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ shinyUI(fluidPage(
tabPanel("group 1",dataTableOutput("matrix_control")),
tabPanel("group 2",dataTableOutput("matrix_case")),
tabPanel("results for the DEG",dataTableOutput("DEG_results")),
tabPanel("quality control",imageOutput("qc_values_distribution"),
imageOutput("qc_sample_clustering"),
imageOutput("MA_plot"),
tabPanel("quality control",imageOutput("MA_plot"),
imageOutput("MDS_plot"),
imageOutput("BCV_plot"),
imageOutput("RAWvsNORM"),
imageOutput("qc_dispersions"),
imageOutput("volcanoplot")

)
Expand Down
43 changes: 43 additions & 0 deletions 9-microarray-examples/GSE43837.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## GSE43837
#exprSet_url="ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE43nnn/GSE43837/matrix/GSE43837_series_matrix.txt.gz"
#a=read.table(exprSet_url,sep = '\t',header = T,comment.char = "!")
library(GEOquery)
GSE43837 <- getGEO('GSE43837', destdir=".",getGPL = F)
## geneNames/sampleNames/pData/exprs
exprSet=exprs(GSE43837[[1]])

library("annotate")
platformDB='u133x3p.db'
library(platformDB, character.only=TRUE)
probeset <- featureNames(GSE43837[[1]])
#EGID <- as.numeric(lookUp(probeset, platformDB, "ENTREZID"))
SYMBOL <- lookUp(probeset, platformDB, "SYMBOL")
a=cbind(SYMBOL,exprSet)
## remove the duplicated probeset
rmDupID <-function(a=matrix(c(1,1:5,2,2:6,2,3:7),ncol=6)){
exprSet=a[,-1]
rowMeans=apply(exprSet,1,function(x) mean(as.numeric(x),na.rm=T))
a=a[order(rowMeans,decreasing=T),]
exprSet=a[!duplicated(a[,1]),]
#
exprSet=exprSet[!is.na(exprSet[,1]),]
rownames(exprSet)=exprSet[,1]
exprSet=exprSet[,-1]
return(exprSet)
}
exprSet=rmDupID(a)
rn=rownames(exprSet)
exprSet=apply(exprSet,2,as.numeric)
rownames(exprSet)=rn
exprSet=log(exprSet)

pdata=pData(GSE43837[[1]])
group_list=unlist(lapply(as.character(pdata$title),function(x) strsplit(x,"_")[[1]][2]))
library(limma)
design=model.matrix(~factor(group_list))
fit=lmFit(exprSet,design)
fit=eBayes(fit)
#options(digits = 4)
DEG_limma=topTable(fit,coef=2,adjust='BH',n=Inf)


0 comments on commit e3849f3

Please sign in to comment.