Commit c8549fe3 authored by Amine  GHOZLANE's avatar Amine GHOZLANE

Let's support complete lineage

parent f3e618b2
Pipeline #48577 failed with stages
in 43 minutes and 51 seconds
......@@ -174,6 +174,10 @@ if (!require("scatterD3")) {
install.packages("scatterD3", repos="https://cran.univ-paris1.fr/")
}
if (!require("stringr")) {
install.packages("stringr", repos="https://cran.univ-paris1.fr/")
}
if (!require(devtools)) {
install.packages('devtools', repos="https://cran.univ-paris1.fr/")
}
......@@ -218,5 +222,5 @@ libshaman=c("shiny", "rjson", "ape", "GUniFrac", "psych", "ggplot2", "vegan", "d
"htmltools", "rAmCharts", "colourpicker", "data.table", "UpSetR", "ggrepel", "igraph",
"visNetwork", "shinytoastr", "scatterD3", "devtools", "shinydashboardshaman", "d3heatmap",
"biomformatshaman", "rNVD3shaman", "DESeq2shaman", "PhyloTreeMetaR", "treeWeightD3", "d3vennR",
"googleVis")
"googleVis", "stringr")
lapply(libshaman, require, character.only = TRUE)
\ No newline at end of file
......@@ -136,10 +136,10 @@ shinyServer(function(input, output,session) {
error=function(e) sendSweetAlert(session,
title = "Oops",
text=paste("Your file can not be read in SHAMAN.\n \n",e),type ="error"))
if(FALSE %in% c(c("accuracy", "barcode", "genus", "species") %in% colnames(data))){
if(FALSE %in% c(c("accuracy", "barcode", "lineage") %in% colnames(data))){
data = NULL
sendSweetAlert(session, title = "Missing data",
text="Shaman looks for accuracy, barcode, genus and species colnames in Epi2me files\n \n",type ="error")
text="Shaman looks for accuracy, barcode and lineage colnames in Epi2me files\n \n",type ="error")
}
}
return(data)
......@@ -314,14 +314,22 @@ shinyServer(function(input, output,session) {
tmpEpi2me = tmpEpi2me[which(tmpEpi2me$accuracy >= as.numeric(input$Epi2me_th) & !is.na(tmpEpi2me$barcode) ),]
# remove missing levels
tmpEpi2me = droplevels(tmpEpi2me)
tmp = plyr::count(tmpEpi2me,c("barcode", "genus", "species"))
tmp$ids = paste(tmp$genus, tmp$species, sep="|")
tmp$index = paste0("Seq_",match(tmp$ids, unique(tmp$ids)))
#tmp = plyr::count(tmpEpi2me,c("barcode", "phylum", "class", "order", "family", "genus", "species"))
tmp = plyr::count(tmpEpi2me,c("barcode", "lineage"))
#tmp$ids = paste(tmp$genus, tmp$species, sep="|")
#tmp$index = paste0("Seq_",match(tmp$ids, unique(tmp$ids)))
tmp$index = paste0("Seq_",match(tmp$lineage, unique(tmp$lineage)))
Counts = as.data.frame.matrix(t(xtabs(freq~.,tmp[,c("freq", "barcode","index")])))
Taxo = unique(tmp[,c("index", "genus", "species")])
rownames(Taxo) = Taxo$index
Taxo= Taxo[,c("genus","species")]
names(Taxo)=c("Genus","Specie")
#Taxo = unique(tmp[,c("index", "phylum", "class", "order", "family", "genus", "species")])
Taxotmp = unique(tmp[,c("index", "lineage")])
Taxo = stringr::str_split_fixed(Taxotmp$lineage, ";", 7)
Taxo[Taxo == ""] =NA
colnames(Taxo) = c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Specie")
rownames(Taxo) = Taxotmp$index
names(Taxo) = c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Specie")
#rownames(Taxo) = Taxo$index
#Taxo= Taxo[,c("genus","species")]
#names(Taxo)=c("Genus","Specie")
if(!is.null(Counts) && !is.null(Taxo))
{
......
......@@ -583,7 +583,7 @@ function(request) {
conditionalPanel(condition="input.FileFormat=='fileEpi2me'&&input.DemoDataset=='...'",
box(title="Load the Epi2me file",width = 3, status = "primary", solidHeader = TRUE,collapsible = FALSE,
column(width=6,
selectInput("sepepi2me", h6(strong("Separator:")), c("Semicolon" = ";", "Tab" = "\t", "Comma" = ","))),
selectInput("sepepi2me", h6(strong("Separator:")), c("Comma" = ",", "Semicolon" = ";", "Tab" = "\t"))),
column(width=6,
numericInput("Epi2me_th",h6(strong("Minimum accuracy level:")),70,step=0.5,min=1,max=100)),
column(width=12,
......
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