R/maps.R

Defines functions maps

Documented in maps

maps <- function(mapper, identifiers, target=NULL){
  if (!is.data.frame(identifiers)) stop("The provided identifiers parameter must be a data frame.")
  allResults <- data.frame(
    source = character(),
    identifier = character(),
    target = character(),
    mapping = character()
  )
  for (i in 1:nrow(identifiers)) {
    source = as.character(identifiers$source[[i]])
    identifier = as.character(identifiers$identifier[[i]])
    if (is.null(target)) {
      singleResults <- map(
        mapper, source=source, identifier=identifier
      )
    } else {
      singleResults <- map(
        mapper, source=source, identifier=identifier,
        target=target
      )
    }
    allResults <- rbind(allResults, singleResults)
  }
  allResults
}

Try the BridgeDbR package in your browser

Any scripts or data that you put into this service are public.

BridgeDbR documentation built on Nov. 8, 2020, 5:09 p.m.