ModuleScoreCalculator

Calculate the module scores for each cell

The module scores are calculated by Seurat::AddModuleScore() or Seurat::CellCycleScoring() for cell cycle scores.

The module scores are calculated as the average expression levels of each program on single cell level, subtracted by the aggregated expression of control feature sets. All analyzed features are binned based on averaged expression, and the control features are randomly selected from each bin.

Environment Variables

  • defaults (ns): The default parameters for modules.
    • features: The features to calculate the scores. Multiple features should be separated by comma.
      You can also specify cc.genes or cc.genes.updated.2019 to use the cell cycle genes to calculate cell cycle scores.
      If so, three columns will be added to the metadata, including S.Score, G2M.Score and Phase.
      Only one type of cell cycle scores can be calculated at a time.
    • nbin (type=int): Default: 24.
      Number of bins of aggregate expression levels for all analyzed features.
    • ctrl (type=int): Default: 100.
      Number of control features selected from the same bin per analyzed feature.
    • k (flag): Default: False.
      Use feature clusters returned from DoKMeans.
    • assay: The assay to use.
    • seed (type=int): Default: 8525.
      Set a random seed.
    • search (flag): Default: False.
      Search for symbol synonyms for features in features that don't match features in object?
    • keep (flag): Default: False.
      Keep the scores for each feature?
      Only works for non-cell cycle scores.
    • agg (choice): Default: mean.
      The aggregation function to use.
      Only works for non-cell cycle scores.
      • mean: The mean of the expression levels
      • median: The median of the expression levels
      • sum: The sum of the expression levels
      • max: The max of the expression levels
      • min: The min of the expression levels
      • var: The variance of the expression levels
      • sd: The standard deviation of the expression levels
  • modules (type=json): Default: {}.
    The modules to calculate the scores.
    Keys are the names of the expression programs and values are the dicts inherited from env.defaults.
    Here are some examples -

    {
        "CellCycle": {"features": "cc.genes.updated.2019"},
        "Exhaustion": {"features": "HAVCR2,ENTPD1,LAYN,LAG3"},
        "Activation": {"features": "IFNG"},
        "Proliferation": {"features": "STMN1,TUBB"}
    }
    

    For CellCycle, the columns S.Score, G2M.Score and Phase will be added to the metadata. S.Score and G2M.Score are the cell cycle scores for each cell, and Phase is the cell cycle phase for each cell.

    You can also add Diffusion Components (DC) to the modules

    {"DC": {"features": 2, "kind": "diffmap"}}
    

    will perform diffusion map as a reduction and add the first 2 components as DC_1 and DC_2 to the metadata. diffmap is a shortcut for diffusion_map. Other key-value pairs will pass to destiny::DiffusionMap().
    You can later plot the diffusion map by using reduction = "DC" in env.dimplots in SeuratClusterStats.
    This requires SingleCellExperiment and destiny R packages.

Metadata

The metadata of the Seurat object will be updated with the module scores:

ModuleScoreCalculator-metadata