Create an InfluenceCalculator object using the Python library from the r-reticulate
environment. From v0.2.0 of ConnectomeInfluenceCalculator the Python library accepts
data frames and several on-disk formats directly, so no temporary SQLite database
needs to be written when you pass edgelist_simple / meta.
Usage
influence_calculator_py(
filename = NULL,
edgelist_simple = NULL,
meta = NULL,
signed = FALSE,
count_thresh = 0,
syn_weight_measure = c("norm", "count"),
inhibitory_nts = NULL,
excluded_nts = NULL,
lambda_max = 0.99
)Arguments
- filename
Character. Path to a connectome data file. The format is detected from the file extension:
.sqlite/.dbuse the original SQLite constructor,.csvusesfrom_csv,.parquetusesfrom_parquet, and.feather/.arrowusefrom_feather. If the extension is unrecognised the original SQLite path is tried (matching pre-v0.2.0 behaviour).- edgelist_simple
Data frame with edge list containing columns 'pre', 'post', and either 'count' (raw synapse count) or 'weight' (pre-normalised). 'norm' is optional and recomputed from 'count' if absent. Used when filename is NULL.
- meta
Data frame with metadata containing at least 'root_id' column. Must also contain 'top_nt' when
signed = TRUEorexcluded_ntsis supplied. Used when filename is NULL.- signed
Logical. Whether to use signed connectivity matrix (default: FALSE). When
TRUE,inhibitory_ntsmust be supplied.- count_thresh
Numeric. Minimum threshold count for postsynaptic connections (default: 0, i.e. no filtering — make any silent filtering visible to the caller).
- syn_weight_measure
Character, one of
"norm"(default) or"count". Which edge column populates the connectivity matrix W:"count"is the raw synapse count,"norm"is the per-postsynaptic input fraction (count / sum(count) per post). The package default"norm"matchesinfluence_calculator_r(), so the R and Python backends agree; note the upstream Python library's own default is"count". Forsigned = TRUE,"count"is the more natural choice: negating"norm"weights breaks the column-sum-to-1 property and loses the input-normalisation interpretation.- inhibitory_nts
Character vector of
top_ntvalues whose pre-neurons should receive negative weights whensigned = TRUE. The Python library has no per-organism default; you must supply this set explicitly whensigned = TRUE.- excluded_nts
Character vector of
top_ntvalues whose pre-neurons should contribute nothing to W. Independent ofsigned. Use for transmitter classes whose sign at a given target depends on the receptor mix and so cannot be assigned a single sign safely.- lambda_max
Numeric in
(0, 1). Target spectral radius of the rescaled connectivity matrix W~ (default0.99). Sets the leading-mode gain to1/(1 - lambda_max). Lower values (e.g.0.5) are more appropriate for small graphs like C. elegans; the default is calibrated for whole-CNS Drosophila (BANC-scale) graphs. Seeinfluence_calculator_r()for the full discussion.
Examples
if (FALSE) { # \dontrun{
# SQLite (legacy)
ic <- influence_calculator_py("connectome.sqlite")
# Feather (e.g. the BANC edge list on the lab's GCS bucket)
ic <- influence_calculator_py("banc_888_edgelist_simple_v2.feather", meta = banc_meta)
# Data frames (no temp file written)
ic <- influence_calculator_py(edgelist_simple = my_edges, meta = my_meta,
signed = TRUE,
inhibitory_nts = c("glutamate", "gaba",
"serotonin", "octopamine"),
lambda_max = 0.99)
} # }