Skip to content

Commit

Permalink
Deleted enrichmbKEGG function
Browse files Browse the repository at this point in the history
  • Loading branch information
mjchen1996 committed Feb 17, 2021
1 parent 7e3bb53 commit 5452fd9
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 75 deletions.
Binary file added .RData
Binary file not shown.
2 changes: 2 additions & 0 deletions .Rbuildignore
Expand Up @@ -13,3 +13,5 @@ docs
.github
site_src
TODO.md
^.*\.Rproj$
^\.Rproj\.user$
133 changes: 133 additions & 0 deletions .Rhistory
@@ -0,0 +1,133 @@
install.packages("ggplot2")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("clusterProfiler")
library(ggplot2)
library(clusterProfiler)
BiocManager::install("clusterProfiler")
BiocManager::install("MicrobiotaProcess")
install.packages("VennDiagram")
library(VennDiagram)
nifW.out <- read.table(file = "/mnt/e/SMU/Projects/Genepredict/data/hmmbuild_hmmfiles/nifW_NCyc_idv2.txt", header = F)
nifW.out <- read.table(file = "E:/SMU/Projects/Genepredict/data/hmmbuild_hmmfiles/nifW_NCyc_idv2.txt", header = F)
View(nifW.out)
View(nifW.out)
View(nifW.out)
View(nifW.out)
nifK.out <- read.table(file = "E:/SMU/Projects/Genepredict/data/hmmbuild_hmmfiles/nifK_NCyc_idv2.txt", header = F)
nifD.out <- read.table(file = "E:/SMU/Projects/Genepredict/data/hmmbuild_hmmfiles/nifD_NCyc_idv2.txt", header = F)
nifW.in <- read.table(file = "E:/SMU/Projects/Genepredict/data/NCycDB/data/NCyc_100_2019Jul/nifW.NCyc.txt")
nifK.in <- read.table(file = "E:/SMU/Projects/Genepredict/data/NCycDB/data/NCyc_100_2019Jul/nifK.NCyc.txt")
nifD.in <- read.table(file = "E:/SMU/Projects/Genepredict/data/NCycDB/data/NCyc_100_2019Jul/nifD.NCyc.txt")
venn.diagram(x=list(hmmfiles=nifD.in, NCycdb=nifD.out), "nifW.png", height = 450, width = 450, resolution =300,
imagetype="png", col="white", fill=c(colors()[616], colors()[38]),
alpha=c(0.6, 0.6), lwd=c(1, 1), cex=0, cat.dist=c(-0.07, -0.07, -0.05), cat.pos=c(300, 60, 180),
cat.cex=0.45)
venn.diagram(x=list(hmmfiles=nifD.in, NCycdb=nifD.out), "nifW.png", height = 450, width = 450, resolution =300,
imagetype="png", col="white", fill=c(colors()[616], colors()[38]),
alpha=c(0.6, 0.6), lwd=c(1, 1), cex=0)
View(nifD.in)
View(nifD.out)
x <- sample(1:10,1)
x
x <- sample(1:10,1)
x
x <- sample(1:100,1)
x
x <- sample(1:100,1)
x
sample(1:100,1)
sample(1:100,1)
sample(1:100,1)
sample(1:100,1)
sample(1:100,1)
x <- sample(1:100,1)
x
x <- sample(1:100,1)
x
ll
update.packages()
setwd("D:/yulab/clusterProfiler")
#'
#' @return A gene annotation table of human gut microbiome
#' @export
#'
#' @examples
#' \dontrun{
#' getM_DATA(hgmlist)
#' }
#'
#'
getM_DATA <- function(Kgenelist){
p <- kegg_list('pathway')
p2 <- kegg_link('ko',"pathway")
p2 <- p2[grep(pattern="path:map",p2[,1]),]
res <- merge(p2, p, by = 'from', all.x=TRUE)
colnames(res) <- c("pathway", "Knum", "name")
res$Knum <- gsub("ko:","",res$Knum)
M_DATA <- res[res[,2] %in% Kgenelist,]
return(M_DATA)
}
#' @return A \code{enrichResult} instance.
#' @export
#'
#' @examples
#' \dontrun{
#' data(hgmlist)
#' yy <- enrichmbKEGG(hgmlist[1:20],microbe_data=hgmlist)
#' }
#'
#'
enrichmbKEGG <- function(gene,
pvalueCutoff = 0.05,
pAdjustMethod = "BH",
universe,
minGSSize = 10,
maxGSSize = 500,
qvalueCutoff = 0.2,
use_internal_data = FALSE,
microbe_data) {
M_DATA <- getM_DATA(microbe_data)
KEGG_DATA <- build_Anno(M_DATA[c(c("pathway","Knum"))], M_DATA[c("pathway","name")])
res <- enricher_internal(gene,
pvalueCutoff = pvalueCutoff,
pAdjustMethod = pAdjustMethod,
universe = universe,
minGSSize = minGSSize,
maxGSSize = maxGSSize,
qvalueCutoff = qvalueCutoff,
USER_DATA = KEGG_DATA)
if (is.null(res))
return(res)
res@ontology <- "KEGG"
res@organism <- "microbiome"
return(res)
}
setwd("E:/SMU/Projects/FunctionalAnnoforMGS/2_functionalannformgs/8_hgmKO")
nbt_hgm <- read.table(file = "E:/SMU/Projects/FunctionalAnnoforMGS/2_functionalannformgs/8_hgmKO/NBT_6980KOs_for_humangutmetagenome.txt", header = T, sep = "\t",quote ="", fill = T)
library(clusterProfiler)
library(DOSE)
ko2path <- read.table(file = "NBT_HGM_KO2PATHWAY.txt",header = T,sep = "\t")
data <- read.delim(file = "E:/SMU/Projects/test/IBS.txt",stringsAsFactors=FALSE,header = T,row.names = 1)
genelist <- rownames(data)
kk2 <- enrichKEGG(genelist[101:200],organism = "ko")
genelist <- rownames(data)
kk <- enricher(gene = genelist[101:200],
pvalueCutoff = 0.05,
pAdjustMethod = "BH",
minGSSize = 10,
maxGSSize = 500,
qvalueCutoff =0.05,
TERM2GENE = ko2path[c("pathway","KO")],
TERM2NAME = ko2path[c("pathway","description")])
dotplot(kk)
#kk2 <- enrichKEGG(genelist[101:200],organism = "ko")
kk3 <- enrichKEGG(genelist[101:200],organism = "ko",universe = ko2path$KO)
dotplot(kk3)
setwd("D:/yulab/clusterProfiler")
data(hgmlist)
kk <- enrichKEGG(gene = hgmlist[1:20], organism = "ko", universe = hgmlist )
dotplot(kk)
kk2 <- enrichKEGG(gene = hgmlist[1:20], organism = "ko")
dotplot(kk2)
setwd("D:/yulab/clusterProfiler")
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ vignettes/.DS_Store
__pycache__
__init__.py
__init__.pyc
.Rproj.user
2 changes: 0 additions & 2 deletions NAMESPACE
Expand Up @@ -54,11 +54,9 @@ export(enrichKEGG)
export(enrichMKEGG)
export(enrichWP)
export(enricher)
export(enrichmbKEGG)
export(filter)
export(geneID)
export(geneInCategory)
export(getM_DATA)
export(get_wp_organisms)
export(go2ont)
export(go2term)
Expand Down
21 changes: 21 additions & 0 deletions clusterProfiler.Rproj
@@ -0,0 +1,21 @@
Version: 1.0

RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 4
Encoding: UTF-8

RnwWeave: knitr
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
49 changes: 0 additions & 49 deletions man/enrichmbKEGG.Rd

This file was deleted.

24 changes: 0 additions & 24 deletions man/getM_DATA.Rd

This file was deleted.

0 comments on commit 5452fd9

Please sign in to comment.