Skip to content

Data structures

dean geckt edited this page Sep 8, 2024 · 3 revisions

Documentation: Data Structures and Classes

This documentation provides an overview of the data structures used for the network detection software.

Enum Classes

NetworkInputType

Different supported network input formats (each has a different loader under /networks/loaders/)

  • simple_adj_txt: Simple adjacency matrix in text format. Each line contains (v1, v2, w), where v1 -> v2, and w is ignored
  • worm_wiring_xlsx: C.elegans connectomes from wormwiring
  • polarity_xlsx: C.elegans connectomes with polarity data in Excel format , from the paper
  • durbin_txt: C.elegans connectomes from Durbin in a text format.
  • multilayer: C.elegans multilayer connectomes from the paper
  • graph: General graph (list of strings (tuples) where each is an edge. in the format: ["1 2" "2 3" ...])
  • binary_network: Binary network file format (saved by this software)

SubGraphAlgoName

An enumeration of algorithms used for subgraph detection:

  • specific: Specific subgraph detection algorithm.
  • mfinder_induced: MFinder induced subgraphs.
  • mfinder_none_induced: MFinder non-induced subgraphs.
  • fanmod_esu: Fanmod ESU algorithm.
  • triadic_census: Triadic census algorithm.

RandomGeneratorAlgoName

An enumeration of random network generation algorithms:

  • markov_chain_switching: Markov chain switching algorithm.
  • nerve_ring_markov_chain_switching: Markov chain switching algorithm for nerve ring networks.
  • erdos_renyi: Erdős-Rényi random graph model.
  • barabasi: Barabási-Albert scale-free network model.

MotifType

An enumeration of different types of motifs:

  • motif: Regular motif.
  • anti_motif: Anti-motif.
  • none: No motif.

MotifName

An enumeration of specific motif names:

  • self_loop: Self-loop motif.
  • mutual_regulation: Mutual regulation motif.
  • fan_out: Fan-out motif (also known as sim_2).
  • fan_in: Fan-in motif.
  • cascade: Cascade motif.
  • feed_forward: Feed-forward motif.
  • bi_fan: Bi-fan motif.
  • bi_parallel: Bi-parallel motif.
  • sim_3: Sim_3 motif.
  • na: Not available (n/a).

Data Models

NetworkLoaderArgs

A Pydantic model that defines the arguments for loading a network:

  • synapse_threshold: Integer threshold for synapses.
  • filter_polarity: Optional list of polarities to filter, default is ['+', '-'].
  • filter_prim_nt: Optional list of primary neurotransmitters or integers to filter, default is ['GABA', 'Glu', 'ACh', 0].
  • filter_syn_type: Optional type of synapse to filter, default is 'chem'.
  • filter_sex_type: Optional sex type to filter, default is 'herm'.
  • filter_nerve_ring_neurons: Optional boolean to filter nerve ring neurons, default is False.
  • filter_monoamines: Optional list of monoamines to filter, default is ['dopamine', 'octopamine', 'serotonin', 'tyramine'].
  • allow_self_loops: Optional boolean to allow self-loops, default is False.

MotifCriteriaArgs

A Pydantic model defining criteria for motif detection:

  • alpha: Significance level (float).
  • uniqueness_threshold: Threshold for uniqueness (int).
  • use_uniq_criteria: Boolean to indicate if uniqueness criteria should be used.
  • frequency_threshold: Frequency threshold for motif detection (float).

MotifCriteriaResults

A Pydantic model for storing the results of motif criteria evaluation:

  • n_real: Number of real appearances of the motif (int).
  • is_statistically_significant: Optional boolean indicating statistical significance, default is False.
  • n_rand: Optional float representing the number of random appearances.
  • z_score: Optional float for the z-score.
  • std: Optional float for the standard deviation.
  • p_value: Optional float for the p-value.
  • uniq: Optional integer for uniqueness.
  • is_motif_frequent: Optional boolean indicating if the motif is frequent.
  • is_anti_motif_frequent: Optional boolean indicating if the anti-motif is frequent.
  • is_uniq: Optional boolean or string indicating if it is unique.
  • is_motif: Optional MotifType indicating the type of motif.

PolarityFrequencies

A Pydantic model for polarity frequencies:

  • frequency: Frequency count (int).
  • polarity: List of polarities (list of strings).
  • sub_graphs: List of subgraphs (list).

Motif

A Pydantic model representing a motif:

  • name: MotifName of the motif.
  • id: ID of the motif or subgraph (int or string).
  • adj_mat: Adjacency matrix (numpy array).
  • role_pattern: List of role patterns as tuples (list of tuples).
  • n_real: Optional number of real appearances (int, default is 0).
  • motif_criteria: Optional MotifCriteriaResults.
  • random_network_samples: Optional list of integers representing random network samples (list of ints).
  • sub_graphs: Optional list of subgraph appearances in tuple-edge format (list of tuples).
  • node_roles: Optional dictionary of node roles and frequencies (dict).
  • node_appearances: Optional dictionary of node appearances (dict).
  • polarity_motifs: Optional list of related motifs (list of Motif).
  • polarity: Optional list of polarities (list of strings).

SubGraphSearchResult

A Pydantic model for the result of a subgraph search:

  • fsl: Dictionary of frequent subgraph lists (dict).
  • fsl_fully_mapped: Same frequent subgraph lists with fully mapped subgraphs (dict).

LargeSubGraphSearchResult

An extension of SubGraphSearchResult with additional attributes:

  • adj_mat: Dictionary of adjacency matrices (dict of numpy arrays).

SearchResultBinaryFile

A TypedDict representing the binary file for search results:

  • args: Namespace containing arguments.
  • motifs: Dictionary of motifs (dict).

NetworkBinaryFile

A TypedDict representing the binary file for network data:

  • graph: DiGraph representing the network.
  • participating_nodes: Set of participating nodes.
  • neuron_names: List of neuron names.
Clone this wiki locally