Skip to content

Commit

Permalink
add universal converter
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhimingYe committed Dec 19, 2024
1 parent c305139 commit 14bc04e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: EnrichGT
Title: Parse and cluster biological enrichment result to great tables
Version: 0.5.5
Version: 0.5.8
Author: Zhiming Ye
Maintainer: Zhiming Ye <[email protected]>
Description: Parse and cluster biological enrichment result to great
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(convert_annotations_genes)
export(database_CollecTRI_human)
export(database_CollecTRI_mouse)
export(database_GO_ALL)
Expand Down
24 changes: 24 additions & 0 deletions R/getDB.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

db_getter_env<-new.env()

cvgs<-function(genes,from_what,to_what,orgDB){
loadNamespace("AnnotationDbi")
x <- AnnotationDbi::select(orgDB, keys =genes,
keytype = from_what, columns = c(from_what,to_what))
return(x)
}

#' Convert gene annotations from any keys to any keys
#'
#' @param genes gene vector
#' @param from_what input type (like "SYMBOL","ENTREZID","ENSEMBL","GENENAME",...), keys should be supported by AnnotationDbi. Search for the help page of AnnotationDbi for further help.
#' @param to_what output type (like "SYMBOL","ENTREZID","ENSEMBL","GENENAME",...), keys should be supported by AnnotationDbi. Search for the help page of AnnotationDbi for further help. Can be multiple items E.g. `c("ENTREZID","ENSEMBL","GENENAME")`
#' @param orgDB human = org.Hs.eg.db, mouse = org.Mm.eg.db, search BioConductor website for further help
#'
#' @returns a data.frame
#' @export
#'
#' @examples
convert_annotations_genes <- function(genes,from_what,to_what,orgDB){
assign("cvgs",cvgs,envir = db_getter_env)
x <- db_getter_env$cvgs(genes,from_what,to_what,orgDB)
return(x)
}

database_GO <- function(OrgDB,ONTOLOGY,...) {
t1 <- Sys.time()
loadNamespace("dplyr")
Expand Down
23 changes: 23 additions & 0 deletions man/convert_annotations_genes.Rd

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

0 comments on commit 14bc04e

Please sign in to comment.