Commit 6267e595 authored by Etienne Rifa's avatar Etienne Rifa
Browse files

Merge branch 'master' of forgemia.inra.fr:umrf/ranomaly

parents d7ae718b 7b1157b1
......@@ -250,7 +250,7 @@ ASVenn_fun <- function(data = data, output = "./ASVenn/", rank = "ASV",
VENNFUN <- function(TF = TF, mode = 1, TITRE = TITRE, output = "./", refseq1 = NULL, alltax=NULL, ggplotmode = FALSE){
if(mode==1){
......@@ -306,7 +306,8 @@ VENNFUN <- function(TF = TF, mode = 1, TITRE = TITRE, output = "./", refseq1 = N
}
} else if(mode == 2){ # more than 5 environments
# pdf(NULL)
venn::venn(TF, zcol = rainbow(7), ilcs = 2, sncs = 2, ggplot = ggplotmode) #, col=rainbow(7)
invisible(dev.off())
venn.plot <- venn::venn(TF, zcol = rainbow(7), ilcs = 2, sncs = 2, ggplot = FALSE) #, col=rainbow(7)
venn.plot <- recordPlot()
invisible(dev.off())
......
......@@ -73,7 +73,8 @@ aggregate_top_taxa <- function (x, top, level){
#'
#' @return Returns barplots in an interactive plotly community plot
#'
#' @importFrom plotly ggplotly plot_ly layout subplot
#' @importFrom plotly plot_ly subplot layout ggplotly
#' @importFrom microbiome aggregate_top_taxa
#' @importFrom reshape2 melt
#' @importFrom gtools mixedsort
#' @importFrom dplyr group_map group_by across `%>%` mutate arrange
......@@ -171,8 +172,8 @@ if( all(Ord1 != sample_variables(data))){
color = ~g,
legendgroup = ~g,
showlegend = FALSE
) %>% layout(xaxis = list(zeroline = FALSE,showline = FALSE, showgrid = FALSE),
yaxis=list(showticklabels = FALSE,title = ylab, showgrid = FALSE))
) %>% plotly::layout(xaxis = list(zeroline = FALSE,showline = FALSE, showgrid = FALSE),
yaxis=list(showticklabels = FALSE,title = "",showgrid = FALSE))
if(relative){
......@@ -190,21 +191,20 @@ if( all(Ord1 != sample_variables(data))){
eval(parse(text=fun))
p1=plot_ly(meltdat, x = ~sample.id, y = ~value, type = 'bar', name = ~variable, color = ~variable) %>% #, color = ~variable
layout(title="", yaxis = list(title = ylab), xaxis = xform, barmode = 'stack')
plotly::layout(title="Relative abundance", yaxis = list(title = 'Relative abundance'), xaxis = xform, barmode = 'stack')
if(length(df1$x) != length(unique(df1$g))){
p1 <- subplot(p1, subp1, nrows = 2, shareX = T, heights=c(0.95,0.05)) %>%
layout(xaxis = xform)
p1 <- plotly::subplot(p1, subp1, nrows = 2, shareX = T, heights=c(0.95,0.05)) %>%
plotly::layout(xaxis = xform)
}
}else{
flog.info('Plotting raw...')
#raw abundance
p1=plot_ly(meltdat, x = ~sample.id, y = ~value, type = 'bar', name = ~variable, color = ~variable) %>% #, color = ~variable
layout(title="", yaxis = list(title = ylab), xaxis = xform, barmode = 'stack')
plotly::layout(title="Raw abundance", yaxis = list(title = 'Raw abundance'), xaxis = xform, barmode = 'stack')
if(length(df1$x) != length(unique(df1$g))){
p1 <- subplot(p1, subp1, nrows = 2, shareX = T, heights=c(0.95,0.05)) %>%
layout(xaxis = xform)
p1 <- plotly::subplot(p1, subp1, nrows = 2, shareX = T, heights=c(0.95,0.05)) %>% plotly::layout(xaxis = xform)
}
}
......@@ -228,8 +228,8 @@ if( all(Ord1 != sample_variables(data))){
color = ~variable, legendgroup = ~variable,
showlegend = (.y == levels(meltdat[, Ord1])[1])),
keep = TRUE) %>%
subplot(nrows = 1, shareX = TRUE, shareY=TRUE, titleX = FALSE) %>%
layout(title="",
plotly::subplot(nrows = 1, shareX = TRUE, shareY=TRUE, titleX = FALSE) %>%
plotly::layout(title="",
xaxis = list(title = glue("{Ord1} =\n{levels(meltdat[, Ord1])[1]}")),
yaxis = list(title = ylab),
barmode = 'stack')
......
......@@ -105,7 +105,7 @@ diversity_alpha_fun <- function(data = data, output = "./plot_div_alpha/", colum
#alpha diversité tableau
resAlpha = list()
flog.info('Alpha diversity tab ...')
p <- alphaPlot(data, column1, column2, measures)
......@@ -116,11 +116,11 @@ diversity_alpha_fun <- function(data = data, output = "./plot_div_alpha/", colum
alphatable <- estimate_richness(data, measures = measures )
anova_data <- cbind(sample_data(data), alphatable)
anova_data$Depth <- sample_sums(data)
resAlpha$alphatable <- anova_data
resAlpha$alphatable <- anova_data
# row.names(resAlpha$alphatable) <- gsub("X","",row.names(resAlpha$alphatable))
write.table(resAlpha$alphatable,paste(output,'/alphaDiversity_table.csv',sep=''), sep="\t", row.names=TRUE, col.names=NA, quote=FALSE)
flog.info('Done.')
if(length(levels(as.factor(anova_data[,column1])))>1 & mean(table(anova_data[,column1])) != 1 ){
flog.info('ANOVA ...')
# variables <- paste(sep=" + ", "Depth", var1)
......
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