Computes adjusted influence scores by taking the natural logarithm of steady-state neural activity and adding a constant to bring values into the non-negative range. The adjusted influence is defined as: adjusted_influence = log(r) + c, where r is the steady-state response and c is a constant. Poorly connected neurons with log(r) << c are set to 0.
Arguments
- influence_df
Data frame, as returned by
calculate_influence. If a 'target' column is present, influence scores will be grouped and averaged by target.- const
Constant value added to log(influence) to ensure non-negative adjusted influence scores. Should be set to -log(minimum_accepted_influence) where minimum_accepted_influence is the smallest influence value considered meaningful. Default 24 corresponds to minimum_accepted_influence = exp(-24) ~ 3.78e-11.
- signif
Number of significant figures for output values.
- minmax
Logical. If TRUE, add min-max normalised columns by target and by seed. Default FALSE for backwards compatibility.
Value
Data frame with adjusted influence columns:
- adjusted_influence
log(summed_influence) + const - basic adjusted influence
- adjusted_influence_norm_by_targets
Normalized by number of target neurons: log(summed_influence/n_targets) + const
- adjusted_influence_norm_by_sources_and_targets
Normalized by both source and target counts: log(summed_influence/(n_sources * n_targets)) + const
- adjusted_influence_minmax_by_target
(if minmax=TRUE) Min-max normalised adjusted_influence within each target group
- adjusted_influence_minmax_by_seed
(if minmax=TRUE) Min-max normalised adjusted_influence within each seed group
Details
When a 'target' column is present, influence scores are averaged within each target group, allowing analysis of influence on cell types or anatomical regions rather than individual neurons.
Examples
if (FALSE) { # \dontrun{
# Basic adjusted influence calculation
ic <- influence_calculator_r(edgelist_simple = edges.table, meta = meta)
influence_scores <- ic$calculate_influence(seed_ids)
adjusted_scores <- adjust_influence(influence_scores)
head(adjusted_scores)
# Determine const based on your minimum meaningful influence
min_meaningful_influence <- 1e-10 # Set your threshold
custom_const <- -log(min_meaningful_influence) # const = 23.03
adjusted_scores_custom <- adjust_influence(influence_scores, const = custom_const)
# Group targets by cell type and calculate averaged influence
# This averages influence within each target group
influence_by_celltype <- influence_scores %>%
dplyr::left_join(meta %>%
dplyr::select(root_id, target = cell_type),
by = c("id" = "root_id")) %>%
adjust_influence()
head(influence_by_celltype)
# Group targets by brain region
influence_by_region <- influence_scores %>%
dplyr::left_join(meta %>%
dplyr::select(root_id, target = brain_region),
by = c("id" = "root_id")) %>%
adjust_influence()
} # }