-
Notifications
You must be signed in to change notification settings - Fork 14
/
prioritize_condition_specific_receiver.Rd
124 lines (102 loc) · 7.28 KB
/
prioritize_condition_specific_receiver.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/condition_specific_celltypes.R
\name{prioritize_condition_specific_receiver}
\alias{prioritize_condition_specific_receiver}
\title{prioritize_condition_specific_receiver}
\usage{
prioritize_condition_specific_receiver(abundance_info, abundance_expression_info, condition_specific_celltypes, grouping_tbl, fraction_cutoff, contrast_tbl, sender_receiver_de, lr_network, ligand_activities_targets_DEgenes, scenario = "regular", ligand_activity_down = FALSE)
}
\arguments{
\item{abundance_info}{Output from `make_abundance_plots`}
\item{abundance_expression_info}{Output from `get_abundance_expression_info`}
\item{condition_specific_celltypes}{Character vector of condition-specific cell types}
\item{grouping_tbl}{Data frame showing the groups of each sample (and batches per sample if applicable) (columns: sample and group; and if applicable all batches of interest)}
\item{fraction_cutoff}{Cutoff indicating the minimum fraction of cells of a cell type in a specific sample that are necessary to consider a gene (e.g. ligand/receptor) as expressed in a sample.}
\item{contrast_tbl}{Data frame providing names for each of the contrasts in contrasts_oi in the 'contrast' column, and the corresponding group of interest in the 'group' column. Entries in the 'group' column should thus be present in the group_id column in the metadata.
Example for `contrasts_oi = c("'A-(B+C+D)/3', 'B-(A+C+D)/3'")`:
`contrast_tbl = tibble(contrast = c("A-(B+C+D)/3","B-(A+C+D)/3"), group = c("A","B"))`}
\item{sender_receiver_de}{Output of `combine_sender_receiver_de`}
\item{lr_network}{Prior knowledge Ligand-Receptor network (columns: ligand, receptor)}
\item{ligand_activities_targets_DEgenes}{Output of `get_ligand_activities_targets_DEgenes`}
\item{scenario}{Character vector indicating which prioritization weights should be used during the MultiNicheNet analysis. Currently 3 settings are implemented: "regular" (default), "lower_DE", and "no_frac_LR_expr". The setting "regular" is strongly recommended and gives each criterion equal weight. The setting "lower_DE" is recommended in cases your hypothesis is that the differential CCC patterns in your data are less likely to be driven by DE (eg in cases of differential migration into a niche). It halves the weight for DE criteria, and doubles the weight for ligand activity. "no_frac_LR_expr" is the scenario that will exclude the criterion "fraction of samples expressing the LR pair'. This may be beneficial in case of few samples per group.}
\item{ligand_activity_down}{For prioritization based on ligand activity: consider the max of up- and downregulation (`TRUE`) or consider only upregulated activity (`FALSE`, default from version 2 on).}
}
\value{
List containing multiple data frames of prioritized senderLigand-receiverReceptor interactions (with sample- and group-based expression information), ligand activities and ligand-target links.
}
\description{
\code{prioritize_condition_specific_receiver} Perform the MultiNicheNet prioritization of cell-cell interactions. Focus on including condition-specific cell types as receiver cells. This implies no DE information will be used for prioritization of receptors, nor ligand activities for ligands
}
\examples{
\dontrun{
library(dplyr)
lr_network = readRDS(url("https://zenodo.org/record/3260758/files/lr_network.rds"))
lr_network = lr_network \%>\% dplyr::rename(ligand = from, receptor = to) \%>\% dplyr::distinct(ligand, receptor)
ligand_target_matrix = readRDS(url("https://zenodo.org/record/3260758/files/ligand_target_matrix.rds"))
sample_id = "tumor"
group_id = "pEMT"
celltype_id = "celltype"
batches = NA
contrasts_oi = c("'High-Low','Low-High'")
contrast_tbl = tibble(contrast = c("High-Low","Low-High"), group = c("High","Low"))
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 \%>\% tibble::as_tibble() \%>\% 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)))
abundance_data_receiver = process_info_to_ic(abund_data = abundance_data, ic_type = "receiver")
abundance_data_sender = process_info_to_ic(abund_data = abundance_data, ic_type = "sender")
celltype_info = get_avg_frac_exprs_abund(sce = sce, sample_id = sample_id, celltype_id = celltype_id, group_id = group_id)
receiver_info_ic = process_info_to_ic(info_object = celltype_info, ic_type = "receiver", lr_network = lr_network)
sender_info_ic = process_info_to_ic(info_object = celltype_info, ic_type = "sender", lr_network = lr_network)
senders_oi = SummarizedExperiment::colData(sce)[,celltype_id] \%>\% unique()
receivers_oi = SummarizedExperiment::colData(sce)[,celltype_id] \%>\% unique()
sender_receiver_info = combine_sender_receiver_info_ic(sender_info = sender_info_ic,receiver_info = receiver_info_ic,senders_oi = senders_oi,receivers_oi = receivers_oi,lr_network = lr_network)
celltype_de = perform_muscat_de_analysis(
sce = sce,
sample_id = sample_id,
celltype_id = celltype_id,
group_id = group_id,
batches = batches,
contrasts = contrasts_oi)
sender_receiver_de = combine_sender_receiver_de(
sender_de = celltype_de,
receiver_de = celltype_de,
senders_oi = senders_oi,
receivers_oi = receivers_oi,
lr_network = lr_network)
ligand_activities_targets_DEgenes = get_ligand_activities_targets_DEgenes(
receiver_de = celltype_de,
receivers_oi = receivers_oi,
receiver_frq_df_group = celltype_info$frq_df_group,
ligand_target_matrix = ligand_target_matrix)
sender_receiver_tbl = sender_receiver_de \%>\% dplyr::distinct(sender, receiver)
metadata_combined = SummarizedExperiment::colData(sce) \%>\% tibble::as_tibble()
grouping_tbl = metadata_combined[,c(sample_id, group_id)] \%>\% tibble::as_tibble() \%>\% dplyr::distinct()
colnames(grouping_tbl) = c("sample","group")
frac_cutoff = 0.05
prioritization_tables = generate_prioritization_tables(
sender_receiver_info = sender_receiver_info,
sender_receiver_de = sender_receiver_de,
ligand_activities_targets_DEgenes = ligand_activities_targets_DEgenes,
contrast_tbl = contrast_tbl,
sender_receiver_tbl = sender_receiver_tbl,
grouping_tbl = grouping_tbl,
fraction_cutoff = frac_cutoff, abundance_data_receiver, abundance_data_sender)
condition_specific_celltypes = "CAFs"
abundance_info = make_abundance_plots(sce = sce, sample_id = sample_id, group_id = group_id, celltype_id = celltype_id, min_cells = 10, senders_oi = senders_oi, receivers_oi = receivers_oi)
prioritization_tables_with_condition_specific_celltype_receiver = prioritize_condition_specific_receiver(
abundance_info = abundance_info,
abundance_expression_info = abundance_expression_info,
condition_specific_celltypes = condition_specific_celltypes,
grouping_tbl = grouping_tbl,
fraction_cutoff = fraction_cutoff,
contrast_tbl = contrast_tbl,
sender_receiver_de = sender_receiver_de,
lr_network = lr_network,
ligand_activities_targets_DEgenes = ligand_activities_targets_DEgenes,
scenario = "regular",
ligand_activity_down = FALSE
)
}
}