Commit 3f119742 authored by Eric CHARPENTIER's avatar Eric CHARPENTIER 🐍
Browse files

fixed bugs for R4

parent e404dd87
...@@ -48,4 +48,5 @@ dependencies: ...@@ -48,4 +48,5 @@ dependencies:
- r-rcolorbrewer - r-rcolorbrewer
- r-tidyverse - r-tidyverse
- r-ggiraph - r-ggiraph
- r-r.utils
- pandoc - pandoc
...@@ -7,11 +7,7 @@ cond2=args[3] ...@@ -7,11 +7,7 @@ cond2=args[3]
org=args[4] org=args[4]
corresFile=args[5] corresFile=args[5]
library(GO.db)
library(GSEABase)
library(clusterProfiler) library(clusterProfiler)
library(DOSE)
library(fgsea)
makeGeneList<-function(data,org){ makeGeneList<-function(data,org){
pAdj=data[,"padj"] pAdj=data[,"padj"]
...@@ -31,13 +27,13 @@ makeGeneList<-function(data,org){ ...@@ -31,13 +27,13 @@ makeGeneList<-function(data,org){
return(geneList) return(geneList)
} }
corresIDorg=read.table(corresFile,header=T,row.names=1) corresIDorg=read.table(corresFile,header=T,row.names=1,stringsAsFactors=T)
orgGO=as.character(corresIDorg[org,1]) orgGO=as.character(corresIDorg[org,1])
orgKegg=as.character(corresIDorg[org,2]) orgKegg=as.character(corresIDorg[org,2])
comp=paste(cond1,cond2,sep="__vs__") comp=paste(cond1,cond2,sep="__vs__")
data=read.csv(paste(paste(outputDir,comp,sep="/"),"DEseqResFiltered.tsv",sep="/"), header=TRUE, sep="\t") data=read.csv(paste(paste(outputDir,comp,sep="/"),"DEseqResFiltered.tsv",sep="/"), header=TRUE, sep="\t",stringsAsFactors=T)
#Sys.setenv(http_proxy="http://cache.ha.univ-nantes.fr:3128") #Sys.setenv(http_proxy="http://cache.ha.univ-nantes.fr:3128")
#Sys.setenv(https_proxy="https://cache.ha.univ-nantes.fr:3128") #Sys.setenv(https_proxy="https://cache.ha.univ-nantes.fr:3128")
...@@ -60,10 +56,10 @@ if(dim(data)[1]>10){ ...@@ -60,10 +56,10 @@ if(dim(data)[1]>10){
} }
dataTot=read.csv(paste(paste(outputDir,comp,sep="/"),"DEseqRes.tsv",sep="/"), header=TRUE, sep="\t") dataTot=read.csv(paste(paste(outputDir,comp,sep="/"),"DEseqRes.tsv",sep="/"), header=TRUE, sep="\t",stringsAsFactors=T)
geneListTot=makeGeneList(dataTot,orgGO) geneListTot=makeGeneList(dataTot,orgGO)
ego2=gseGO(geneList=geneListTot,OrgDb=orgGO,ont="ALL",nPerm=1000,minGSSize=20,maxGSSize=500,pvalueCutoff=1,verbose=FALSE) ego2=gseGO(geneList=geneListTot,OrgDb=get(orgGO),ont="ALL",nPerm=1000,minGSSize=20,maxGSSize=500,pvalueCutoff=1,verbose=FALSE)
ego2Symbol=setReadable(ego2,orgGO,keyType="ENTREZID") ego2Symbol=setReadable(ego2,orgGO,keyType="ENTREZID")
kk2=gseKEGG(geneList=geneListTot,organism=as.character(orgKegg),nPerm=1000,minGSSize=2,pvalueCutoff=1,verbose=FALSE) kk2=gseKEGG(geneList=geneListTot,organism=as.character(orgKegg),nPerm=1000,minGSSize=2,pvalueCutoff=1,verbose=FALSE)
......
...@@ -33,9 +33,9 @@ outputDir=opt$outdir ...@@ -33,9 +33,9 @@ outputDir=opt$outdir
# usual functions # usual functions
lire<-function(x, character=FALSE){ lire<-function(x, character=FALSE){
if(character){ if(character){
d<-read.table(file = x,sep = "\t",header=T,row.names = 1,colClasses = "character",quote="",check.names=FALSE) d<-read.table(file = x,sep = "\t",header=T,row.names = 1,colClasses = "character",quote="",check.names=FALSE,stringsAsFactors=T)
}else{ }else{
d<-read.table(file = x,sep = "\t",header=T,row.names = 1,quote="",check.names=FALSE) d<-read.table(file = x,sep = "\t",header=T,row.names = 1,quote="",check.names=FALSE,stringsAsFactors=T)
} }
return(d) return(d)
} }
......
...@@ -11,6 +11,8 @@ library("pvclust") ...@@ -11,6 +11,8 @@ library("pvclust")
library("circlize") library("circlize")
library("RColorBrewer") library("RColorBrewer")
library(optparse) library(optparse)
library("R.utils")
# Getting options from command line # Getting options from command line
option_list = list( option_list = list(
...@@ -270,11 +272,11 @@ ecrire(rbind(DE.sel$up,DE.sel$down),paste(paste(outputDir,comp,sep="/"),"DEseqRe ...@@ -270,11 +272,11 @@ ecrire(rbind(DE.sel$up,DE.sel$down),paste(paste(outputDir,comp,sep="/"),"DEseqRe
#Volcano-plot #Volcano-plot
p <- ggvulcano(DE, cond1, cond2, logFCthreshold=logFCthreshold, AdjPValthreshold=AdjPValthreshold, GenesInFig=GenesInFig) p <- ggvulcano(DE, cond1, cond2, logFCthreshold=logFCthreshold, AdjPValthreshold=AdjPValthreshold, GenesInFig=GenesInFig)
htmlwidgets::saveWidget(girafe(ggobj = p, pointsize = 12, width_svg = 17, height_svg = 14), paste(outputDir, comp, "Volcano-plot.html", sep="/"), selfcontained = FALSE) htmlwidgets::saveWidget(girafe(ggobj = p, pointsize = 12, width_svg = 17, height_svg = 14), getAbsolutePath(paste(outputDir, comp, "Volcano-plot.html", sep="/")), selfcontained = FALSE)
#MA-plot #MA-plot
p <- ggMA(DE, cond1, cond2, meanInCompThreshold=0.5, GenesInFig=GenesInFig) p <- ggMA(DE, cond1, cond2, meanInCompThreshold=0.5, GenesInFig=GenesInFig)
htmlwidgets::saveWidget(girafe(ggobj = p, pointsize = 12, width_svg = 17, height_svg = 14), paste(outputDir, comp, "MA-plot.html", sep="/"), selfcontained = FALSE) htmlwidgets::saveWidget(girafe(ggobj = p, pointsize = 12, width_svg = 17, height_svg = 14), getAbsolutePath(paste(outputDir, comp, "MA-plot.html", sep="/")), selfcontained = FALSE)
#DE genes clustering #DE genes clustering
if(nrow(DE.sel$isDE)>=10){ if(nrow(DE.sel$isDE)>=10){
......
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