create.metadata.vector: Create a Metadata Vector

View source: R/Seurat.Utils.Metadata.R

create.metadata.vectorR Documentation

Create a Metadata Vector

Description

This function creates a metadata vector from an input vector and a Seurat object. The resulting vector contains values from 'vec' for the intersecting cell names between 'vec' and 'obj'. It also checks if the intersection between the cell names in 'vec' and 'obj' is more than a minimum intersection size.

Usage

create.metadata.vector(
  vec,
  obj = combined.obj,
  fill = NA,
  min.intersect = min(length(vec), ncol(obj), 100)
)

Arguments

vec

A named vector where the names represent cell IDs. This vector should have partial overlap with the cells in a Seurat object.

obj

A Seurat object that contains cell IDs which partially overlap with 'vec'.

fill

The value to fill for non-intersecting cell names in 'obj'. Default is NA.

min.intersect

The minimum number of cells to find in both 'vec' and 'obj'. The function will stop if the intersection is less than this number. Default is 100.

Value

A named vector of length equal to the number of cells in 'obj', with names from 'obj' and values from 'vec' for intersecting cell names.

Examples

## Not run: 
create.metadata.vector(vec = my_vector, obj = my_seurat_object, min.intersect = 50)

## End(Not run)

vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.