R/cpd2kegg.R

Defines functions cpd2kegg

Documented in cpd2kegg

cpd2kegg <-
function(in.ids, in.type){
#cpd id or name to kegg accession, use cpdname2kegg or cpdidmap
#  cpd.type=c(names(rn.list),"name")
data(rn.list)
cpd.type=tolower(c(names(rn.list),"name"))
  if(!tolower(in.type) %in% cpd.type) stop("Incorrect type!")
  kg.idx=grep("kegg", cpd.type)
  if(in.type %in% cpd.type[kg.idx]) stop("A native KEGG compound ID type, no need to map!")
  if(in.type=="name") {
    kg.accs=cpdname2kegg(in.ids)
  } else kg.accs=cpdidmap(in.ids, in.type=in.type, out.type="KEGG")
  
  return(kg.accs)
}
DGendooLab/pathviewM documentation built on Dec. 17, 2021, 4 p.m.