#' @title Creating networks on the basis of the links between genes ids and pubmedid
#' @description This function build networks using the genes.edges generated by getInfo function and create a graph using the genes present in a file generated by DESeq or ANOVAlike
#' @param group, a character string. Two options: \code{"sudo"} or \code{"docker"}, depending to which group the user belongs
#' @param file, a character string indicating the output of DESeq or ANOVAlike to be used. In the same folder must be present also genes.edges file.
#' @author Raffaele Calogero
#'
#' @return one graph plot
#' @examples
#'\dontrun{
#' pubmedNet(group="docker", file=paste(getwd(),"DE_anova_rankedBySD_filteredByPositivePatient.txt", sep="/"))
#'
#' }
#' @export
pubmedNet <- function(group=c("sudo","docker"), file){
home <- getwd()
data.folder = dirname(file)
de.table = basename(file)
setwd(data.folder)
#initialize status
system("echo 0 >& ExitStatusFile")
#running time 1
ptm <- proc.time()
#running time 1
test <- dockerTest()
if(!test){
cat("\nERROR: Docker seems not to be installed in your system\n")
system("echo 10 >& ExitStatusFile")
setwd(home)
return(10)
}
params <- paste("--cidfile ",data.folder,"/dockerID -v ",data.folder,":/data -d docker.io/repbioinfo/genes.2018.01 sh /bin/net.sh ", de.table, sep="")
resultRun <- runDocker(group=group, params=params)
if(resultRun==0){
cat("\nNetwork plot is ready\n")
}
#running time 2
ptm <- proc.time() - ptm
dir <- dir(data.folder)
dir <- dir[grep("run.info",dir)]
if(length(dir)>0){
con <- file("run.info", "r")
tmp.run <- readLines(con)
close(con)
tmp.run[length(tmp.run)+1] <- paste("user run time mins ",ptm[1]/60, sep="")
tmp.run[length(tmp.run)+1] <- paste("system run time mins ",ptm[2]/60, sep="")
tmp.run[length(tmp.run)+1] <- paste("elapsed run time mins ",ptm[3]/60, sep="")
writeLines(tmp.run,"run.info")
}else{
tmp.run <- NULL
tmp.run[1] <- paste("run time mins ",ptm[1]/60, sep="")
tmp.run[length(tmp.run)+1] <- paste("system run time mins ",ptm[2]/60, sep="")
tmp.run[length(tmp.run)+1] <- paste("elapsed run time mins ",ptm[3]/60, sep="")
writeLines(tmp.run,"run.info")
}
#saving log and removing docker container
container.id <- readLines(paste(data.folder,"/dockerID", sep=""), warn = FALSE)
system(paste("docker logs ", container.id, " >& ", "pubmedNet_",substr(container.id,1,12),".log", sep=""))
system(paste("docker rm ", container.id, sep=""))
system(paste("cp ",paste(path.package(package="docker4seq"),"containers/containers.txt",sep="/")," ",data.folder, sep=""))
system(paste("rm -f ",data.folder,"/dockerID", sep=""))
setwd(home)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.