R/getCompensation.R

Defines functions getCompensation

Documented in getCompensation

#' Get compensation
#'
#' Retrieves a compensation. The returned object has a \code{spillMatrix}
#' property that is a \code{matrix}.
#'
#' @param experimentId ID of experiment or a \code{byName} expression.
#' @param compensationId ID of compensation or a \code{byName} expression.
#' @export
#' @examples
#' \dontrun{
#' # Retrieve by ID
#' getCompensation(experimentId, compensationId)
#'
#' # Lookup by name
#' getCompensation(experimentId, byName("Comp 1"))
#' }
getCompensation <- function(experimentId, compensationId) {
  stopIfParamIsNull(experimentId)
  experimentId <- lookupByName("/api/v1/experiments", experimentId)
  stopIfParamIsNull(compensationId)
  compensationId <- lookupByName(paste0("/api/v1/experiments/", experimentId, "/compensations"),
                                 compensationId)
  r <- baseGet(paste0("/api/v1/experiments/", experimentId, "/compensations/", compensationId))
  formatCompensationResponse(r)
}
primitybio/cellengine-r-toolkit documentation built on Oct. 19, 2024, 1:17 a.m.