Commit 16eb0a47 authored by Amine  GHOZLANE's avatar Amine GHOZLANE
Browse files

Show the distance, include the participation of Perrine, remove useless print

parent 49ea5e4e
......@@ -39,7 +39,7 @@ Plot_diag <- function(input,resDiff,tree,getTable=FALSE)
if(input$DiagPlot=="MajTax") res = majTaxPlot(input,counts, group = group, col=colors)
if(input$DiagPlot=="SfactorsVStot") res = diagSFactors(input,normFactors,resDiff$raw_counts)
if(input$DiagPlot=="pcaPlot") res = PCAPlot_meta(input,dds, group, type.trans = input$TransType, col = colors)
if(input$DiagPlot=="pcoaPlot") res = PCoAPlot_meta(input,dds, group,CT,tree, col = colors)
if(input$DiagPlot=="pcoaPlot") res = PCoAPlot_meta(input,dds, group,CT,tree, col = colors)$plot
if(input$DiagPlot=="nmdsPlot") res = NMDSPlot(input, dds, group,CT,tree, col = colors)
if(input$DiagPlot=="clustPlot") res = HCPlot(input,dds,group,type.trans=input$TransType,counts,CT,tree,col=colors)
}
......@@ -170,7 +170,8 @@ Plot_diag_Eigen <- function(input,resDiff)
maxFact =max(sapply(group,FUN=function(x) length(levels(x))))
if(maxFact>=4) colors = rainbow(maxFact)
PCAPlot_meta(input,dds, group, type.trans = input$TransType, col = colors, plot = "eigen")
res = PCAPlot_meta(input,dds, group, type.trans = input$TransType, col = colors, plot = "eigen")
return(res)
}
......@@ -383,6 +384,8 @@ diagSFactors<-function (input,normFactors,counts)
### PCoA
PCoAPlot_meta <-function (input, dds, group_init, CT,tree,col = c("SpringGreen","dodgerblue","black","firebrick1"), plot = "pcoa")
{
dist.counts.norm = NULL
pp = NULL
cval=c()
time_set = 0
# Set of shape
......@@ -478,7 +481,7 @@ PCoAPlot_meta <-function (input, dds, group_init, CT,tree,col = c("SpringGreen",
## Plot axis, label and circles
v_axes = c(as.numeric(gsub("PC","",input$PCaxe1)),as.numeric(gsub("PC","",input$PCaxe2)))
plot(pco.counts.norm$li[v_axes],
pp = plot(pco.counts.norm$li[v_axes],
xlab=paste(input$PCaxe1, ": ",round(eigen[v_axes[1]],1),"%") ,
ylab=paste(input$PCaxe2, ": ",round(eigen[v_axes[2]],1),"%"),
xlim=c(min+0.25*min,max+0.25*max), ylim=c(min-0.1,max+0.1),
......@@ -510,11 +513,11 @@ PCoAPlot_meta <-function (input, dds, group_init, CT,tree,col = c("SpringGreen",
nbBar = max(7,max(v_axes))
col = rep("grey",nbBar)
col[v_axes] = "black"
barplot(eigen[1:nbBar], xlab="Dimensions", ylab="Eigenvalues (%)", names.arg = 1:nbBar, col = col, ylim=c(0,max(eigen)+5), cex.axis=1.2, cex.lab=1.4,cex.names=1.2)
pp = barplot(eigen[1:nbBar], xlab="Dimensions", ylab="Eigenvalues (%)", names.arg = 1:nbBar, col = col, ylim=c(0,max(eigen)+5), cex.axis=1.2, cex.lab=1.4,cex.names=1.2)
}
}
}
return(list(plot=pp,dataDiv = dist.counts.norm))
}
......@@ -647,6 +650,7 @@ my.boxplot <- function(x, pol.col = 1, pol.density = NULL, pol.angle = 45,
### Get PCOA table (useful to get the number of axes)
Get_pcoa_table <-function (input, dds, group_init,CT,tree)
{
dist.counts.norm = NULL
cval=c()
time_set = 0
# Set of shape
......
......@@ -17,7 +17,7 @@ TableDiff_print <- function(input,BaseContrast,resDiff, info = NULL)
result[[input$ContrastList_table]] <- results(dds,contrast=BaseContrast[,input$ContrastList_table],pAdjustMethod=input$AdjMeth,
cooksCutoff=cooksCutoff,
independentFiltering=input$IndFiltering,alpha=alpha)
print(result[[input$ContrastList_table]])
#print(result[[input$ContrastList_table]])
#names(result) <- gsub("_", " ", names(result))
if (is.null(info)) info <- data.frame(Id = rownames(result[[1]]))
else names(info)[1] <- "Id"
......
......@@ -391,10 +391,8 @@ Plot_Visu_Scatterplot<- function(input,resDiff,export=FALSE,lmEst = FALSE,CorEst
Rsq = sumRes$r.squared
return(list(regCoef=regCoef,Rsq = Rsq))
}
print("HERE")
if(CorEst)
{
print("HERE2")
#typesTarget = sapply(target,class)
#print(typesTarget)
#numInd = (typesTarget=="numeric")[1:ncol(target)]
......@@ -849,10 +847,10 @@ Plot_network <- function(input,resDiff,availableTaxo, ind_taxo, qualiVariable, e
else{sec_variable = NULL}
data <- GetDataToPlot(input,resDiff,VarInt,availableTaxo, sec_variable = sec_variable, aggregate = FALSE)
if(!is.null(data)){
if(!is.null(data) && !is.null(data$targetInt)){
counts_tmp_combined <- data$counts
dataVariables <- as.matrix(data$targetInt)
if(isolate(input$colorCorr && qualiVariable())){dataVariables[,sec_variable] <- sapply(dataVariables[,sec_variable], function(x) if(is.element(x,isolate(input$values1))){1}else{0})}
if(isolate(input$colorCorr && qualiVariable()) && !is.null(dataVariables)){dataVariables[,sec_variable] <- sapply(dataVariables[,sec_variable], function(x) if(is.element(x,isolate(input$values1))){1}else{0})}
if(!is.null(counts_tmp_combined)){
countsMatrix <- as.matrix(counts_tmp_combined)
......
......@@ -2813,7 +2813,7 @@ shinyServer(function(input, output,session) {
## Phylogenetic tree
tree = dataInputTree()$data
Plot_diag_pcoaEigen(input,resDiff,tree)
Plot_diag_pcoaEigen(input,resDiff,tree)$plot
},height = 400)
......@@ -2830,6 +2830,32 @@ shinyServer(function(input, output,session) {
})
output$Distancetable <- DT::renderDataTable(
datatable({
resDiff = ResDiffAnal()
## Phylogenetic tree
tree = dataInputTree()$data
as.matrix(Plot_diag_pcoaEigen(input,resDiff,tree)$dataDiv)
}, rownames= FALSE, options = list(lengthMenu = list(c(10, 50, -1), c('10', '50', 'All')), scroller = TRUE,
pageLength = 10,scrollX=TRUE
))
)
## Export Distancetable in .csv
output$ExportDistancetable <- downloadHandler(
filename = function() {
if(input$sepdiversity=="\t") 'SHAMAN_Distance.tsv'
else 'SHAMAN_Distance.csv'
},
content = function(file){
resDiff = ResDiffAnal()
## Phylogenetic tree
tree = dataInputTree()$data
tmp = as.matrix(Plot_diag_pcoaEigen(input,resDiff,tree)$dataDiv)
datatable(tmp,rownames= FALSE)
write.table(tmp, file,row.names = FALSE, sep=input$sepdistance)
})
output$ResPermaTestBox <- renderUI({
......@@ -3672,7 +3698,7 @@ shinyServer(function(input, output,session) {
output$tooltippValueDensity <- renderUI({
hover <- input$plot_hover_pValueDensity
point <- nearPoints(pValueDensityData(), hover, xvar = "x", yvar = "y", threshold = 20, maxpoints = 1)
if (nrow(point) == 0) return(NULL)
if (is.null(nrow(point)) || nrow(point) == 0) return(NULL)
# calculate point position INSIDE the image as percent of total dimensions from left (horizontal) and from top (vertical)
left_pct <- (hover$x - hover$domain$left) / (hover$domain$right - hover$domain$left)
top_pct <- (hover$domain$top - hover$y) / (hover$domain$top - hover$domain$bottom)
......
......@@ -59,6 +59,7 @@ function(request) {
tabPanel("Authors", h3("The main contributors to SHAMAN:"),
p(a("Stevenn Volant", href="mailto:stevenn.volant@pasteur.fr"), "(Initiator, coding, testing, documentation, evaluation)"),
p(a("Amine Ghozlane",href="mailto:amine.ghozlane@pasteur.fr"), "(Coding, testing, documentation, evaluation, packaging)"),
p("Perrine Woringer", "(Coding, testing, Documentation)"),
p("Pierre Lechat", "(Coding, testing, feature suggestions)"),
h3("Acknowledgements"),
p("Thanks to the following people for patches and other suggestions for improvements:"),
......@@ -87,6 +88,7 @@ function(request) {
box(
title = "What's new in SHAMAN", width = NULL, status = "primary",
div(style = 'overflow-y: scroll; height: 550px',
addNews("August 14th 2019","Major update","We performed a global improvement of SHAMAN. The application is now migrated to R 3.6.1. We implemented several visualization for differential analysis and network of abundance. We hope you will enjoy this main update."),
addNews("April 11th 2019","Debugging","We fixed few bugs in export system and scatterplot visualisation system."),
addNews("March 28th 2019","Packaging","SHAMAN is now available as packrat package. Take a look at download section."),
addNews("April 17th 2018","Bioinformatics","The bioinformatic treatment offers a larger access to parameters. We also worked a lot on the documentation."),
......@@ -752,6 +754,17 @@ function(request) {
),
conditionalPanel(condition="input.DiagPlot=='pcoaPlot' || input.DiagPlot=='nmdsPlot'",
uiOutput("ResPermaTestBox")
),
conditionalPanel(condition="input.DiagPlot=='pcoaPlot' || input.DiagPlot=='nmdsPlot'",
br(),
box(title = "Distance values", width = 6, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
DT::dataTableOutput("Distancetable"),
fluidRow(
column(width=3,downloadButton('ExportDistancetable', 'Export table')),
column(width=3,selectInput("sepdistance", "Separator:", c("Tab" = "\t", "Comma" = ",", "Semicolon" = ";")))
),
tags$style(type='text/css', "#ExportDistancetable { margin-top: 37px;}")
)
)
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment