Usage
Installation
To use cagraph, first install it using pip:
(.venv) $ pip install cagraph
Generating CaGraph object
To create a CaGraph object which can be used to build and analyze graphs
you can use the cagraph.CaGraph() Class:
- cagraph.CaGraph()
Author: Veronica Porubsky Author Github: https://github.com/vporubsky Author ORCID: https://orcid.org/0000-0001-7216-3368
Class: CaGraph(data_file, node_labels=None, node_metadata=None, dataset_id=None, threshold=None)
This class provides functionality to easily visualize time-series data of neuronal activity and to compute correlation metrics of neuronal networks, and generate graph objects which can be analyzed using graph theory. There are several graph theoretical metrics for further analysis of neuronal network connectivity patterns.
Attributes
- datastr or numpy.ndarray
A string pointing to the file to be used for data analysis, or a numpy.ndarray containing data loaded into memory. The first (idx 0) row must contain timepoints, the subsequent rows each represent a single neuron timeseries of calcium fluorescence data sampled at the timepoints specified in the first row.
- node_labels: list
A list of identifiers for each row of calcium imaging data (each neuron) in the data_file passed to CaGraph.
- node_metadata: dict
Contains metadata which is associated with neurons in the network. Each key in the dictionary will be added as an attribute to the CaGraph object, and the associated value will be . Each value
- dataset_id: str
A unique identifier can be added to the CaGraph object.
- threshold: float
Sets a threshold to be used for thresholded graph.
Generating graphs
To construct a graph, you can use the CaGraph(data='data.csv').get_graph() function:
The data parameter should be either a numpy.ndarray, CSV file, or NWB file. Otherwise, CaGraph(data='data.csv')()
will raise an exception.
For example:
>>> from cagraph import CaGraph
>>> cg = CaGraph(data='data.csv')
>>> cg_graph = cg.get_graph()