Commit 3b48b54c authored by NAVRATIL VINCENT's avatar NAVRATIL VINCENT
Browse files

SARS-Cov-2 release - input format modification

parent 1e95b393
......@@ -11,24 +11,43 @@ shinyServer(
#
dginn_df_reactive <- reactive({
dginn_file <- input$dginn_file_tsv
if (is.null(dginn_file)){
return(NULL)
}
else{
df=read.csv2(dginn_file$datapath,sep="\t")
colnames <- c("File","Name","Gene","Description","GeneSize","NbSpecies","omegaM0Bpp","omegaM0codeml","BUSTED","BUSTED_p-value","MEME_NbSites","MEME_PSS","BppM1M2","BppM1M2_p-value","BppM1M2_NbSites","BppM1M2_PSS","BppM7M8","BppM7M8_p-value","BppM7M8_NbSites","BppM7M8_PSS","codemlM1M2","codemlM1M2_p-value","codemlM1M2_NbSites","codemlM1M2_PSS","codemlM7M8","codemlM7M8_p-value","codemlM7M8_NbSites","codemlM7M8_PSS")
df <- read.csv2(dginn_file$datapath,sep=",")
#split primates and bat data
df_primates <- df[,c(5,6,2,3,7:30)]
df_primates[,2] <- "primates"
names(df_primates) <- colnames
df_bats <- df[,c(31,32,4,3,33:56)]
df_bats[,2] <- "bats"
names(df_bats) <- names(df_primates)
df <- rbind(df_primates,df_bats)
sel <- df$BppM1M2_NbSites+df$BppM7M8_NbSites+df$codemlM1M2_NbSites+df$codemlM7M8_NbSites
sel <- sel == 0 | is.na(sel)
return(df[!sel,])
}
})
tree_data_reactive <- reactive({
selected <- input$dginn_data_rows_selected
selected <- input$dginn_data_rows_selected
file=dginn_df_reactive()[selected,"File"]
species=dginn_df_reactive()[selected,"Name"]
path="../data/"
gene=dginn_df_reactive()[selected,"Gene"]
file_url=paste(path,file,sep="/")
file_url=paste(path,species,file,sep="/")
read_file(paste(file_url,".phylip_phyml_tree.txt",sep=""))
})
......@@ -66,21 +85,23 @@ shinyServer(
file=dginn_df_reactive()[selected,"File"]
path="../data/"
gene=dginn_df_reactive()[selected,"Gene"]
file_url=paste(path,file,sep="/")
file_url=paste(path,species,file,sep="/")
tree=read.tree(paste(file_url,".phylip_phyml_tree.txt",sep=""))
model=input$model_parameter_rb
#
# get dginn_data_model_summary
#
models <- c("BppM1M2","BppM7M8","BppDFP07_0DFP07","codemlM1M2","codemlM7M8")
models <- c("BppM1M2","BppM7M8","codemlM1M2","codemlM7M8")
dginn_data_model_summary <- list()
dginn_data_model_summary[1] <- c()
for(i in 1:length(models)){
if(as.character(dginn_df_reactive()[selected,paste(models[i],"PSS",sep="_")]) !="na"){
dginn_position <- as.character(dginn_df_reactive()[selected,paste(models[i],"PSS",sep="_")])
if(dginn_df_reactive()[selected,paste(models[i],"NbSites",sep="_")] >0){
dginn_position <- as.character(dginn_df_reactive()[selected,paste(models[i],"PSS",sep="_")])
dginn_data_model_summary[1] = c(dginn_data_model_summary[1],as.integer(strsplit(dginn_position,",")[[1]]))
dginn_data_model_summary[[i+1]]= as.integer(strsplit(dginn_position,",")[[1]])
}
......@@ -90,27 +111,26 @@ shinyServer(
}
names(dginn_data_model_summary) <- c("summary",models)
dginn_data_model_summary$summary <- table(dginn_data_model_summary$summary)
phylopic_id=""
if(species=="Primates"){
if(species=="primates"){
phylopic_id="2d078b25-e6a0-4beb-a5d3-5d6f16be8ebf"
}
if(species=="Bats"){
if(species=="bats"){
phylopic_id="18bfd2fc-f184-4c3a-b511-796aafcc70f6"
}
p <- ggtree(tree,size=1) + geom_tiplab(size=5) + msaplot()
p <- ggtree(tree,size=1) + geom_tiplab(size=5)
p_msa_window <- dginn_msaplot(p, paste(file_url,".fas",sep=""), offset=1, width=5, window=c(120, 200))
p_msa_window <- dginn_msaplot(p, paste(file_url,".best.fas",sep=""), offset=1, width=5, window=c(120, 200))
p_msa <- dginn_msaplot(p, paste(file_url,".fas",sep=""),dginn_position=as.numeric(names(dginn_data_model_summary$summary)), offset=1, width=5)
p_msa_summary <- dginn_msaplot_summary(p, paste(file_url,".fas",sep=""),dginn_summary=dginn_data_model_summary, offset=1, width=5)
p_msa <- dginn_msaplot(p, paste(file_url,".best.fas",sep=""),dginn_position=as.numeric(names(dginn_data_model_summary$summary)), offset=1, width=5)
p_msa_summary <- dginn_msaplot_summary(p, paste(file_url,".best.fas",sep=""),dginn_summary=dginn_data_model_summary, offset=1, width=5)
grid.arrange(cowplot::get_legend(p_msa_summary
),p_msa_summary+ theme(legend.position = "none") ,p_msa+ theme(legend.position = "none"),nrow=3,ncol=1,heights=c(10,5,2*dginn_df_reactive()[selected,"NbSpecies"]))
grid.arrange(cowplot::get_legend(p_msa_summary),p_msa_summary+ theme(legend.position = "none") ,p_msa+ theme(legend.position = "none"),nrow=3,ncol=1,heights=c(10,5,2*dginn_df_reactive()[selected,"NbSpecies"]))
removeUI(
selector="#tree"
......
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