joinWith: Join barcodes with additional variables

View source: R/j.R

joinWithR Documentation

Join barcodes with additional variables

Description

Each member of the joinWith()-family takes a data.frame as input that contains at least the variables barcodes and sample. (Easily obtained with the get*()-family.) It extracts the specified variables and joins them over the barcode variable with the provided data.frame.

Usage

joinWith(
  object,
  spata_df = getCoordsDf(object),
  features = NULL,
  gene_sets = NULL,
  method_gs = NULL,
  genes = NULL,
  average_genes = NULL,
  uniform_genes = NULL,
  smooth = FALSE,
  smooth_span = NULL,
  verbose = NULL,
  normalize = NULL
)

joinWithFeatures(
  object,
  spata_df = getCoordsDf(object),
  features,
  smooth = FALSE,
  smooth_span = 0.02,
  verbose = TRUE
)

joinWithGenes(
  object,
  spata_df = getCoordsDf(object),
  genes,
  average_genes = FALSE,
  uniform_genes = "keep",
  smooth = FALSE,
  smooth_span = 0.02,
  normalize = TRUE,
  verbose = TRUE
)

joinWithGeneSets(
  object,
  spata_df = getCoordsDf(object),
  gene_sets,
  method_gs = "mean",
  smooth = FALSE,
  smooth_span = 0.02,
  normalize = TRUE,
  verbose = TRUE,
  ignore = T
)

joinWithVariables(
  object,
  spata_df = getCoordsDf(object),
  variables,
  method_gs = "mean",
  average_genes = FALSE,
  uniform_genes = "discard",
  smooth = FALSE,
  smooth_span = 0.02,
  normalize = TRUE,
  verbose = TRUE
)

Arguments

object

An object of class spata2.

features

The features of interest specified as a character vector.

gene_sets

The gene sets of interest specified as a character vector.

method_gs

Character value. The method according to which gene sets will be handled specified as a character of length one. This can be either 'mean or one of 'gsva', 'ssgsea', 'zscore', or 'plage'. The latter four will be given to gsva::GSVA().

genes

The genes of interest specified as a character vector.

average_genes

Logical. If set to TRUE the average expression of the specified genes is calculated and saved under one variable named 'mean_genes'.

uniform_genes

Character value. If set to 'discard' genes that are uniformly expressed across all barcode-spots of the specified coordinates data.frame are discarded. If set to 'keep' they are kept.

smooth

Logical. If TRUE, a loess fit is used to smooth the values.

smooth_span

Numeric value. Controls the degree of smoothing. Given to argument span of stats::loess().

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

normalize

Logical. If set to TRUE values will be scaled to 0-1.

Hint: Variables that are uniformly expressed can not be scaled and are discarded.

variables

Character vector. The variables of interest:

  • Gene sets: Must be in getGeneSets()

  • Genes: Must be in getGenes()

  • Features: Must be numeric ones of getFeatureNames()

Details

Hint: Variables of the specified data.frame spata_df that have equal names as the specified features, genes and gene-sets are overwritten!

Value

The input data.frame of spata_df joined with all the specified genes, gene-sets and/or features by the key-variable barcodes.


kueckelj/SPATA2 documentation built on March 16, 2024, 10:25 a.m.