R/ti_slingshot.R

Defines functions ti_slingshot

Documented in ti_slingshot

######################################### DO NOT EDIT! #########################################
#### This file is automatically generated from data-raw/2-generate_r_code_from_containers.R ####
################################################################################################

#' @title Slingshot
#'
#' @description
#' Will generate a trajectory using
#' [Slingshot](https://doi.org/10.1186/s12864-018-4772-0).
#'
#' This method was wrapped inside a
#' [container](https://github.com/dynverse/ti_slingshot).
#' The original code of this method is available
#' [here](https://github.com/kstreet13/slingshot).
#'
#' @references Street, K., Risso, D., Fletcher, R.B., Das, D., Ngai, J., Yosef,
#' N., Purdom, E., Dudoit, S., 2018. Slingshot: cell lineage and pseudotime
#' inference for single-cell transcriptomics. BMC Genomics 19.
#'
#' @param cluster_method . Domain: {pam, clara}. Default: pam. Format: character.
#' @param ndim The number of dimensions in the new space. Domain: U(2, 100).
#' Default: 20. Format: integer.
#' @param shrink Logical or numeric between 0 and 1, determines whether and how
#' much to shrink branching lineages toward their average prior to the split.
#' Domain: e^U(-Inf, 0.00). Default: 1. Format: numeric.
#' @param reweight Logical, whether to allow cells shared between lineages to be
#' reweighted during curve-fitting. If `TRUE`, cells shared between lineages will
#' be weighted by: distance to nearest curve / distance to curve. Default: TRUE.
#' Format: logical.
#' @param reassign Logical, whether to reassign cells to lineages at each
#' iteration. If TRUE, cells will be added to a lineage when their projection
#' distance to the curve is less than the median distance for all cells currently
#' assigned to the lineage. Additionally, shared cells will be removed from a
#' lineage if their projection distance to the curve is above the 90th percentile
#' and their weight along the curve is less than 0.1. Default: TRUE. Format:
#' logical.
#' @param thresh Numeric, determines the convergence criterion. Percent change in
#' the total distance from cells to their projections along curves must be less
#' than thresh. Default is 0.001, similar to principal.curve. Domain: e^U(-11.51,
#' 11.51). Default: 0.001. Format: numeric.
#' @param maxit Numeric, maximum number of iterations, see principal.curve.
#' Domain: U(0, 50). Default: 10. Format: integer.
#' @param stretch Numeric factor by which curves can be extrapolated beyond
#' endpoints. Default is 2, see principal.curve. Domain: e^U(-Inf, 1.61). Default:
#' 2. Format: numeric.
#' @param smoother Choice of scatter plot smoother. Same as principal.curve, but
#' "lowess" option is replaced with "loess" for additional flexibility. Domain:
#' {smooth.spline, loess, periodic.lowess}. Default: smooth.spline. Format:
#' character.
#' @param shrink.method Character denoting how to determine the appropriate amount
#' of shrinkage for a branching lineage. Accepted values are the same as for
#' `kernel` in `density()` (default is `"cosine"`), as well as `"tricube"` and
#' `"density"`. See 'Details' for more. Domain: {cosine, tricube, density}.
#' Default: cosine. Format: character.
#'
#' @keywords method
#'
#' @return A TI method wrapper to be used together with
#' \code{\link[dynwrap:infer_trajectories]{infer_trajectory}}
#' @export
ti_slingshot <- function(
    cluster_method = "pam",
    ndim = 20L,
    shrink = 1L,
    reweight = TRUE,
    reassign = TRUE,
    thresh = 0.001,
    maxit = 10L,
    stretch = 2L,
    smoother = "smooth.spline",
    shrink.method = "cosine"
) {
  method_choose_backend(
    package_repository = "dynverse/ti_slingshot/package",
    package_name = "tislingshot",
    function_name = "ti_slingshot",
    package_version = "1.0.3",
    container_id = "dynverse/ti_slingshot:v1.0.3"
  )(
    cluster_method = cluster_method,
    ndim = ndim,
    shrink = shrink,
    reweight = reweight,
    reassign = reassign,
    thresh = thresh,
    maxit = maxit,
    stretch = stretch,
    smoother = smoother,
    shrink.method = shrink.method
  )
}
dynverse/dynmethods documentation built on Jan. 18, 2024, 4:44 a.m.