Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: meshes
Title: MeSH Enrichment and Semantic analyses
Version: 1.23.0
Version: 1.23.0.991
Authors@R: c( person(given = "Guangchuang", family = "Yu", email = "[email protected]", role = c("aut", "cre")),
person(given = "Erqiang", family = "Hu", email = "[email protected]", role = "ctb"))
Description: MeSH (Medical Subject Headings) is the NLM controlled vocabulary
Expand All @@ -24,7 +24,8 @@ Imports:
utils,
AnnotationHub,
MeSHDbi,
yulab.utils
yulab.utils,
gson
Suggests:
knitr,
rmarkdown,
Expand All @@ -37,4 +38,4 @@ BugReports: https://github.com/GuangchuangYu/meshes/issues
biocViews: Annotation, Clustering, MultipleComparison, Software
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.2
RoxygenNote: 7.2.0
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export(geneInCategory)
export(geneSim)
export(gseMeSH)
export(gseaplot)
export(gson_mesh)
export(heatplot)
export(meshSim)
export(meshdata)
Expand All @@ -32,8 +33,10 @@ importFrom(enrichplot,emapplot)
importFrom(enrichplot,gseaplot)
importFrom(enrichplot,heatplot)
importFrom(enrichplot,ridgeplot)
importFrom(gson,gson)
importFrom(methods,new)
importFrom(utils,packageDescription)
importFrom(utils,stack)
importFrom(yulab.utils,get_fun_from_pkg)
importMethodsFrom(DOSE,show)
importMethodsFrom(DOSE,summary)
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# meshes 1.23.0.991
+ add `gson_mesh()` (2022-7-13, Wed)

# meshes 1.19.3

+ cache mesh db and table (2021-09-01, Wed)
Expand Down
37 changes: 37 additions & 0 deletions R/gson.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##' download the latest version of mesh data and stored in a 'GSON' object
##'
##'
##' @title gson_Reactome
##' @param MeSHDb MeSHDb
##' @param database one of 'gendoo', 'gene2pubmed' or 'RBBH'
##' @param category one of "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L","M", "N", "V", "Z"
##' @importFrom utils stack
##' @importFrom gson gson
##' @export
gson_mesh <- function(MeSHDb, database, category) {

MeSH_DATA <- get_MeSH_data(MeSHDb, database, category)
EXTID2PATHID = get("EXTID2PATHID", envir = MeSH_DATA)
PATHID2EXTID = get("PATHID2EXTID", envir = MeSH_DATA)
PATHID2NAME = get("PATHID2NAME", envir = MeSH_DATA) # NULL

reactomeAnno <- stack(PATHID2EXTID)
gsid2gene <- reactomeAnno[, c(2,1)]
colnames(gsid2gene) <- c("gsid", "gene")
gsid2gene <- unique(gsid2gene[!is.na(gsid2gene[,2]), ])

termname <- PATHID2NAME
gsid2name <- NULL
if (is.null(termname)) {
gsid2name <- data.frame(gsid = names(termname), name = termname)
}

gson(gsid2gene = gsid2gene,
gsid2name = gsid2name,
# species = species,
gsname = "MeSH",
# version = version,
accessed_date = as.character(Sys.Date())
# keytype = keytype
)
}
18 changes: 18 additions & 0 deletions man/gson_mesh.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.