Skip to contents

Native R implementation of the ConnectomeInfluenceCalculator functionality.

Details

This class provides a pure R implementation of connectome influence calculation using efficient sparse matrix operations.

Public fields

W_signed

Whether connectivity matrix uses signed weights

meta

Metadata table from database

n_neurons

Number of neurons in the network

W

Sparse connectivity matrix

id_to_index

Mapping from neuron IDs to matrix indices

index_to_id

Mapping from matrix indices to neuron IDs

const

Constant value for adjusted influence calculation

edgelist_hash

Hash of edgelist for cache validation

W_normalized

Cached normalized connectivity matrix

W_factorization

Cached matrix factorization for solving

max_eigenvalue

Cached maximum eigenvalue for normalization

lambda_max

Target spectral radius of the rescaled matrix

inhibitory_nts

top_nt values whose pre-neurons get negated weights when signed

excluded_nts

top_nt values whose pre-neurons contribute nothing to W

syn_weight_measure

Edge column used to populate W ("norm" or "count")

Methods


Method new()

Create a new InfluenceCalculatorR object

Usage

InfluenceCalculatorR$new(
  edgelist_simple = NULL,
  meta = NULL,
  filename = NULL,
  sqlite = FALSE,
  signed = FALSE,
  count_thresh = 3,
  const = 24,
  inhibitory_nts = NULL,
  excluded_nts = NULL,
  lambda_max = 0.99,
  syn_weight_measure = c("norm", "count")
)

Arguments

edgelist_simple

Data frame with edge list

meta

Data frame with metadata

filename

Path to SQLite database

sqlite

Whether to use SQLite database

signed

Whether to use signed connectivity matrix

count_thresh

Minimum synapse count threshold

const

Constant value for adjusted influence calculation

inhibitory_nts

Character vector of top_nt values whose pre-neurons receive negative weights when signed = TRUE. Required for signed mode.

excluded_nts

Character vector of top_nt values whose pre-neurons contribute nothing to W (their outgoing edges are dropped). Independent of signed.

lambda_max

Target spectral radius of the rescaled W~; default 0.99. See influence_calculator_r() for the trade-off it controls.

syn_weight_measure

Edge column used to populate W, "norm" (default) or "count". See influence_calculator_r() for the trade-off.


Method calculate_influence()

Calculate influence scores for given seed neurons

Usage

InfluenceCalculatorR$calculate_influence(
  seed_ids,
  silenced_neurons = numeric(0),
  const = NULL
)

Arguments

seed_ids

Vector of seed neuron IDs

silenced_neurons

Vector of neuron IDs to silence (default: none, for performance)

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. If NULL, uses value from initialization (default: NULL).

Returns

Data frame with influence scores and adjusted influence column


Method clone()

The objects of this class are cloneable with this method.

Usage

InfluenceCalculatorR$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.