This function allows to savely add features to the gene meta data.frame of an expression matrix of choice.

addGeneFeatures(
  object,
  gene_df,
  feature_names = NULL,
  mtr_name = NULL,
  overwrite = FALSE,
  verbose = NULL,
  of_sample = NA
)

Arguments

object

A valid spata-object.

gene_df

A data.frame that contains the variables specified by name in the argument feature_names and the key variable genes by which the feature variables are joined to the already existing gene meta data.frame.

feature_names

Character vector or NULL. See details for more.

mtr_name

Character value. The name of the matrix of interest.

overwrite

Logical. If the specified feature names already exist in the current spata-object this argument must be set to TRUE in order to overwrite them.

verbose

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

(Warning messages will always be printed.)

of_sample

This argument is currently inactive. It might be reactivated when spata-objects can store more than one sample.

Value

The input spata2 object containing the added or computed results.

Details

If you are only interested in adding specific features to the spata-object you can specify those with the feature_names-argument. If no variables are specified this way all variables found in the input data.frame for argument gene_df are taken. (Apart from the key variable genes).

Eventually the new features are joined via dplyr::left_join() over the key-variables genes. Additional steps secure the joining process.