process_abund_info: process_abund_info

View source: R/expression_processing.R

process_abund_infoR Documentation

process_abund_info

Description

process_abund_info Process cell type abundance information into intercellular communication focused information.

Usage

process_abund_info(abund_data, ic_type = "sender")

Arguments

abund_data

Data frame with number of cells per cell type - sample combination

ic_type

"sender" or "receiver": indicates whether we should rename celltype to sender or receiver.

Value

Data frame with number of cells per cell type - sample combination; but now adapted to sender/receiver nomenclature

Examples

## Not run: 
library(dplyr)
sample_id = "tumor"
group_id = "pEMT"
celltype_id = "celltype"
min_cells = 10
metadata_abundance = SummarizedExperiment::colData(sce)[,c(sample_id, group_id, celltype_id)]
colnames(metadata_abundance) =c("sample_id", "group_id", "celltype_id")
abundance_data = metadata_abundance %>% tibble::as_tibble() %>% dplyr::group_by(sample_id , celltype_id) %>% dplyr::count() %>% dplyr::inner_join(metadata_abundance %>% dplyr::distinct(sample_id , group_id ))
abundance_data = abundance_data %>% dplyr::mutate(keep = n >= min_cells) %>% dplyr::mutate(keep = factor(keep, levels = c(TRUE,FALSE)))
receiver_abundance_data = process_info_to_ic(abund_data = abundance_data, ic_type = "receiver")
sender_abundance_data = process_info_to_ic(abund_data = abundance_data, ic_type = "sender")

## End(Not run)


saeyslab/multinichenetr documentation built on Jan. 15, 2025, 7:55 p.m.