Skip to content

Commit

Permalink
fix samseq issue
Browse files Browse the repository at this point in the history
  • Loading branch information
likelet committed Aug 29, 2018
1 parent fa63901 commit 2df9330
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 27 deletions.
2 changes: 1 addition & 1 deletion inst/IDEA/GlobalFunction/PlotFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ HeatmapData<-function(normalizedData,DEtable,DEmethod=c("DESeq","edgeR","NOIseq"
}else if(DEmethod=='NOIseq'){
DEtable<-DEtable[order(DEtable[,"prob"],decreasing = TRUE),]
}else if(DEmethod=='SAMseq'){
DEtable<-DEtable[order(DEtable[,5]),]
DEtable<-DEtable[order(DEtable[,4]),]
}
DElist<-rownames(DEtable)
if(length(DElist)>=Topnumber){
Expand Down
25 changes: 10 additions & 15 deletions inst/IDEA/GlobalFunction/SAMseqAdjustFunction.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,15 @@ library(samr)

getsamfit<-function(data,conditionlist,myresp.type="Two class unpaired",mynperms = 100, mynresamp = 20, myfdr = 0.20){
y=as.numeric(factor(conditionlist,labels = c(1:length(unique(conditionlist)))))
samfit <- SAMseq(data.matrix(data), y, resp.type =myresp.type,fdr.output=myfdr,geneid=row.names(data),genenames=row.names(data),nresamp = mynresamp,)
samfit <- SAMseq(data.matrix(data), y, resp.type =myresp.type,fdr.output=myfdr,geneid=row.names(data),genenames=row.names(data),nresamp = mynresamp)
}
getSamResultTable<-function(data,conditionlist,resp.type="Two class unpaired",myfdr=1){
#data must be rounded
#y must be a numberic vector
samfit <- getsamfit(data,conditionlist,myresp.type=resp.type,fdr=myfdr)
result<-data.frame(samfit$siggenes.table$genes.up)
result2<-data.frame(samfit$siggenes.table$genes.lo)

return(rbind(result,result2))
}

samfitplot<-function(data,conditionlist,resp.type,myfdr=0.05){
samfit <- getsamfit(data,conditionlist,myresp.type=resp.type,fdr=myfdr)
plot(samfit)
# getSamResultTable<-function(data,conditionlist,resp.type="Two class unpaired",myfdr=1){
# #data must be rounded
# #y must be a numberic vector
# samfit <- getsamfit(data,conditionlist,myresp.type=resp.type,fdr=myfdr)
# result<-data.frame(samfit$siggenes.table$genes.up)
# result2<-data.frame(samfit$siggenes.table$genes.lo)
#
# return(rbind(result,result2))
# }

}
1 change: 1 addition & 0 deletions inst/IDEA/GlobalFunction/possionSeqDatafFunction.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ getPossionTestResult<-function(data,condition,ispaired=FALSE){
file.remove("PossionPow.txt")
LL<-paralist()
dat<-poissonData(data,condition,ispaired)
data<-data[complete.cases(data),]
result<-PS.Main(dat,LL)
return(result)
}
Expand Down
20 changes: 9 additions & 11 deletions inst/IDEA/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,18 @@ shinyServer(function(input,output,session){
data=NULL
})
}

df <- NULL
if(values$wethernew=="example"){
example
df <- example
}else{
validate(
need(!is.null(input$file1), "Please upload a data set")
)
data
df <- data
}
# switch(values$wethernew,
# 'example'= example,
# 'upload'= data
# )

#remove gene with 0 count across samples
df<-df[rowSums(df)>0,]
df

})

Expand Down Expand Up @@ -1865,9 +1863,9 @@ getPowerCurve<-reactive({

#SAMseq DE heatmap
SAMseqHeatmapPlotfunction<-reactive({
table<-getresultPoissonSeqresultTableNew()
table<-getSAMseqresultTableNew()
normalizedData<-normalizeDataNew()
data<-HeatmapData(normalizedData,table,DEmethod='PoissonSeq',Topnumber=input$SAMseqShowDeGenes)
data<-HeatmapData(normalizedData,table,DEmethod='SAMseq',Topnumber=input$SAMseqShowDeGenes)
data
})
#SAMseq DE heatmap render
Expand Down Expand Up @@ -1917,7 +1915,7 @@ getPowerCurve<-reactive({

content = function(file) {
#Cairo(file=file, width = 600, height = 600,type = "png", units = "px", pointsize = 12, bg = "white", res = NA)
res<-getresultPoissonSeqresultTableNew()
res<-getSAMseqresultTableNew()
write.csv(res,file=file)
},
contentType = 'text/csv'
Expand Down

0 comments on commit 2df9330

Please sign in to comment.