com_factor: Combine Factors in Targets File

View source: R/com_factor.R

com_factorR Documentation

Combine Factors in Targets File

Description

This is a helper function for data/aSVGs involving three or more factors such as sample, time, condition. It combine factors in targets file to make composite factors.

Usage

com_factor(se, target, factors2com, sep = ".", factor.new)

Arguments

se

A SummarizedExperiment object.

target

A data.frame object of targets file.

factors2com

A character vector of column names or a numeric vector of column indeces in the targets file. Entries in these columns are combined.

sep

The separator in the combined factors. One of _, and . (default).

factor.new

The column name of the new combined factors.

Value

If se is provided, a SummarizedExperiment object is returned, where the colData slot contains the new column of combined factors. Otherwise, adata.frame object is returned, where the new column of combined factors is appended.

Author(s)

Jianhai Zhang jzhan067@ucr.edu
Dr. Thomas Girke thomas.girke@ucr.edu

References

Attilio, Peter J, Dustin M Snapper, Milan Rusnak, Akira Isaac, Anthony R Soltis, Matthew D Wilkerson, Clifton L Dalgard, and Aviva J Symes. 2021. “Transcriptomic Analysis of Mouse Brain After Traumatic Brain Injury Reveals That the Angiotensin Receptor Blocker Candesartan Acts Through Novel Pathways.” Front. Neurosci. 15 (March): 636259

Examples

library(SummarizedExperiment)
mus.se.pa <- system.file('extdata/shinyApp/data/mus_brain_vars_se.rds', package='spatialHeatmap')
mus.se <- readRDS(mus.se.pa); targets.info <- colData(mus.se)
targets.new <- com_factor(target=targets.info, factors2com=c('time', 'treatment', 'injury'), factor.new='comDim')

jianhaizhang/spatialHeatmap documentation built on Nov. 28, 2024, 4:44 p.m.