Commit c439e564 authored by Etienne Rifa's avatar Etienne Rifa
Browse files

some fixes

fix message at ranomaly startup
add message when no significant features in aggregate
parent 7acdfd87
Pipeline #43906 passed with stage
in 12 seconds
......@@ -50,7 +50,6 @@ import(metagenomeSeq)
import(mixOmics)
import(pairwiseAdonis)
import(phyloseq)
import(plotly)
import(psadd)
import(reshape2)
import(scales)
......@@ -63,10 +62,13 @@ importFrom(DECIPHER,AlignSeqs)
importFrom(DESeq2,DESeq)
importFrom(DESeq2,results)
importFrom(DESeq2,resultsNames)
importFrom(dplyr,`%>%`)
importFrom(dplyr,across)
importFrom(dplyr,arrange)
importFrom(dplyr,group_by)
importFrom(dplyr,group_map)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(ggpubr,ggtexttable)
importFrom(ggpubr,text_grob)
importFrom(ggpubr,ttheme)
......@@ -95,7 +97,11 @@ importFrom(phangorn,NJ)
importFrom(phangorn,dist.ml)
importFrom(phangorn,phyDat)
importFrom(phangorn,pml)
importFrom(plotly,config)
importFrom(plotly,ggplotly)
importFrom(plotly,layout)
importFrom(plotly,plot_ly)
importFrom(plotly,subplot)
importFrom(ranacapa,ggrare)
importFrom(reshape2,melt)
importFrom(tibble,rownames_to_column)
......
......@@ -274,10 +274,9 @@ aggregate_fun <- function(data = data, metacoder = NULL, deseq = NULL, mgseq = N
# print(TABfinal)
if(length(TABfinal) > 0){
if(length(TABfinal$ListAllOtu) > 0){
flog.info('Building csv file...')
TAX <- cbind(seqid = rownames(ttax[as.character(TABfinal$ListAllOtu),]),as.data.frame(ttax[as.character(TABfinal$ListAllOtu),]))
sseq <- cbind(seqid = row.names(as.data.frame(sseq)), as.data.frame(sseq))
......@@ -328,7 +327,7 @@ aggregate_fun <- function(data = data, metacoder = NULL, deseq = NULL, mgseq = N
# save(data, file=paste(output,"/signif_phyloseq.rdata",sep=""))
#
}
}else{flog.info("No significant results in the three methods...")}
}
......@@ -7,7 +7,7 @@
#'
#' @return A plotly graph.
#'
#' @import plotly
#' @importFrom plotly ggplotly
#' @importFrom ranacapa ggrare
#'
#' @export
......@@ -73,10 +73,10 @@ aggregate_top_taxa <- function (x, top, level){
#'
#' @return Returns barplots in an interactive plotly community plot
#'
#' @import plotly
#' @importFrom plotly ggplotly plot_ly layout subplot
#' @importFrom reshape2 melt
#' @importFrom gtools mixedsort
#' @importFrom dplyr group_map group_by across
#' @importFrom dplyr group_map group_by across `%>%` mutate arrange
#'
#'
#' @export
......@@ -221,8 +221,8 @@ if( all(Ord1 != sample_variables(data))){
meltdat$sample.id = factor(meltdat$sample.id, levels = unique(meltdat$sample.id)) # keep sample ids order from metadata.
}
p1 = meltdat %>% arrange(across({Ord1})) %>% group_by(across({Ord1})) %>%
mutate(across(where(is.character), as.factor)) %>%
p1 = meltdat %>% dplyr::arrange(across({Ord1})) %>% dplyr::group_by(across({Ord1})) %>%
dplyr::mutate(across(where(is.character), as.factor)) %>%
dplyr::group_map(~ plot_ly(data=., x = ~sample.id, y = ~value, type = 'bar',
name = ~variable,
color = ~variable, legendgroup = ~variable,
......@@ -230,13 +230,13 @@ if( all(Ord1 != sample_variables(data))){
keep = TRUE) %>%
subplot(nrows = 1, shareX = TRUE, shareY=TRUE, titleX = FALSE) %>%
layout(title="",
xaxis = list(title = glue("{Ord1} = {levels(meltdat[, Ord1])[1]}")),
xaxis = list(title = glue("{Ord1} =\n{levels(meltdat[, Ord1])[1]}")),
yaxis = list(title = ylab),
barmode = 'stack')
for (i in 2:length(unique(meltdat[, Ord1]))) {
p1$x$layoutAttrs[[1]][[paste0("xaxis", i)]] = NULL
p1$x$layoutAttrs[[1]][[paste0("xaxis", i)]]$title <- glue("{Ord1} = {levels(meltdat[, Ord1])[i]}")
p1$x$layoutAttrs[[1]][[paste0("xaxis", i)]]$title <- glue("{Ord1} =\n{levels(meltdat[, Ord1])[i]}")
}
if(!is.null(outfile)){
htmlwidgets::saveWidget(p1, outfile)
......
......@@ -20,7 +20,7 @@
#' @import ggplot2
#' @import pairwiseAdonis
#' @import vegan
#' @importFrom plotly ggplotly
#' @importFrom plotly ggplotly config
#'
#' @export
......
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