• Overview
  • FASTQ+
  • PISA
  • Yano
  • My GitHub Page
  • Discussions
    • Workflows & Short cases
      • From FASTQ to counts
      • Annotate various features
      • Select cells from reduction maps
      • Alternative splicing analysis
      • Allele-specific gene expression analysis
      • Annotating genetic variants
      • Analysis multiple Visium samples
      • Cell trajectory analysis

    On this page

    • RunAutoCorr
      • Description
      • Usage
      • Arguments

    RunAutoCorr

    Source code

    Description

    Calculate spatial autocorrelation (Moran’s I) for features in parallel.

    Usage

    RunAutoCorr(
      object = NULL,
      assay = NULL,
      layer = "data",
      reduction = "pca",
      dims = 1:20,
      k.param = 20,
      prune.SNN = 1/50,
      nn.method = "annoy",
      n.trees = 50,
      annoy.metric = "euclidean",
      nn.eps = 0,
      l2.norm = FALSE,
      cells = NULL,
      min.cells = 10,
      snn.name = NULL,
      spatial = FALSE,
      order.cells = NULL,
      weight.method = c("dist", "average"),
      prune.distance = -1,
      features = NULL,
      wm.name = NULL,
      prefix = "moransi",
      threads = 0,
      verbose = TRUE,
      ...
    )
    

    Arguments

    object Seurat object
    assay Working assay
    layer Input data layer, usually be ‘data’.
    reduction Cell space used to calculate SNN graph, default is ‘pca’.
    dims Dimensions of reduction used to calculate SNN graph.
    k.param Defines k for K-nearest neighbor algorithm
    prune.SNN This parameter sets the cutoff for the acceptable Jaccard index when computing neighborhood overlap during SNN (Shared Nearest Neighbor) construction. It is passed to Seurat::FindNeighbors. Any edges with Jaccard index values less than or equal to this cutoff will be set to 0 and removed from the SNN graph, effectively controlling the stringency of pruning (with 0 meaning no pruning and 1 meaning everything is pruned). The default value is 1/50, which differs from Seurat’s default setting. This is because Seurat’s default is OK for cell clustering but may cause the loss of many sparse features in large cell populations during spatial dissimilarity test. Setting the cutoff to a smaller value can capture more features, but it will also increase computational time.
    nn.method nn.method passed to Seurat::FindNeighbors, default is “euclidean”.
    n.trees n.trees passed to Seurat::FindNeighbors, default is 50.
    annoy.metric annoy.metric passed to Seurat::FindNeighbors, default is “annoy”.
    nn.eps nn.eps passed to Seurat::FindNeighbors, default is 0
    l2.norm L2 normalization. Default is FALSE.
    cells Cells used for calculate weight matrix. Used with snn graph. In default will use all cells.
    min.cells If a feature can be detect in few than min.cells, will skip to save time. Default is 10.
    snn.name name of SNN space. If spatial=FALSE and order.cells = NULL, default snn.name will set to ‘RNA_snn’. Use SNN space to calculate the cell-cell weight martix.
    spatial Use spatial coordinate instead of SNN space and linear trajectory to calculate the cell-cell weight matrix.
    order.cells For linear trajetory, input ordered cell names to calculate the cell-cell distance weight matrix. Conflict with sptaial=TRUE and snn.name != NULL.
    weight.method Weight method for distance, default 1/dist^2. Also support average, use mean weight value for nearby cells.
    prune.distance Set the cutoff for neighbors for order cells and spatial coordinates. In default, 50 for order cells, 8 for spatial coordinates.
    features List of features to test. Default is all features with that coverage >= min.cells.
    wm.name Weight matrix/graph name in Seurat object. After this function, the graph can be visited by obj[[wm.name]]. Default name is “RNA_wm”, if you change the default name, you should specific the new name in RunBlockCorr.
    prefix Prefix for score and p value names. Default prefix is “moransi”. If you change the default name, you should specific the new name in SetAutoCorrFeatures.
    threads Threads.
    verbose Print log message. Default is TRUE.
    … parameters pass to GetWeightFromSpatial, so it only works if spatial is TRUE.
    Back to top