/
.Rhistory
133 lines (133 loc) · 4.36 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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")