High Level API
NeuroArch Class
The NeuroArch class provides basic operations such as connecting to the OrientDB database, loading database, and queries.
- class neuroarch.na.NeuroArch(db_name, host='localhost', port=2424, user='root', password='root', mode='r', storage='plocal', new_models=False, debug=False, serialization_type='Binary', version=None, maintainer_name='', maintainer_email='')[source]
Create or connect to a NeuroArch object for database access.
- Parameters:
db_name (str) – name of the database to connect to or create
host (str (optional)) – IP of the host
port (int (optional)) – binary port of the OrientDB server
user (str (optional)) – user name to access the database
password (str (optional)) – password to access the database
mode (str (optional)) – ‘r’: read only ‘w’: read/write on existing database, if does not exist, one is created. ‘o’: read/write and overwrite any of the existing data in the database.
storage (str (optional)) – ‘plocal’: using disk-based storage for the database ‘memory’: memory storage
new_models (bool (optional)) – If true, recreate the ogm classes.
debug (bool (optional)) – Whether the queries are done in debug mode
serialization_type (str) – Either ‘Binary’ or ‘CSV’, specifying the seriailzation strategy of pyorient communication with OrientDB server.
version (str) – If a new database will be created, e.g., mode = ‘o’ or mode = ‘w’ and database does not exist, then version should be provided.
maintainer_name (str) – If a new database will be created, e.g., mode = ‘o’ or mode = ‘w’ and database does not exist, then maintainer of the author name should be provided.
maintainer_email (str) – Email of the maintainer, should be provided when maintainer_name is needed.
Methods for Connection
|
Connect to the database specified during instantiation |
Reconnect to the database specified during instantiation |
Methods for Queries
|
Query NeuroArch database with a SQL query |
Methods for Loading Biological Entities
|
Query neurons by unique name or referenceId |
|
Query neurons by cell type. |
|
Query synapses by presynaptic and postsynaptic neuron unames |
|
Query neuropil by name. |
|
Query subregion by name. |
|
Add a Species. |
|
Add a DataSource. |
|
Create a Subsystem record and link it to related node types. |
|
Create a Neuropil record and link it to related node types. |
|
Create a Subregion record and link it to related node types. |
|
Create a Subregion record and link it to related node types. |
|
Create a Subregion record and link it to related node types. |
|
Create a Neuron Record and link it to the related node types. |
|
Add neurotransmitter data and link it to a neuron. |
|
Add a morphology to a node, e.g., a neuropil, or a neuron. |
|
Add arborization data of a neuron and link it to the neuron. |
|
Add a Synapse from pre_neuron and post_neuron. |
|
Add data for the distribution of synapses within a Synapse node in Neuropils, Subregions and Tracts. |
|
Add an InferredSynapse from pre_neuron and post_neuron. |
|
Remove neurons |
|
Remove synapses. |
|
Remove synapses between a list of presynaptic neurons and a list of postsynaptic neurons. |
|
Update any property/data of a neuron. |
|
Update any property/data of a synapse. |
|
Create a model of a circuit. |
|
Add an executable circuit. |
|
Add circuit diagram. |
|
Add an LPU. |
|
Create a NeuronModel node. |
|
Create a Port node. |
|
Create a NeuronModel node. |
Auxilliary Methods
|
Retrieve an object with name under data_source, either from cache or from database. |
|
Set an entry in the local database cache. |
|
Check if data exists in the database. |
|
Find all instances in the database that meets the criteria. |
|
Find all instances in the database that meets the criteria. |
|
To create an edge between node1 and node2 with specified edge type. |
|
To create an edge between node1 and node2 with specified edge type, when node1 and node2 are to be created in batch. |
|
Export all the tags to a JSON file. |
|
Import tags from a JSON file. |
|
Remove a tag. |
Retrieve all available DataSources. |
High Level Query Functions
- neuroarch.na.outgoing_synapses(q, N=None, rel='>', include_inferred=True)[source]
Get all the outgoing synapses from neurons in a QueryWrapper object.
- Parameters:
q (query.QueryWrapper) – The query to search for outgoing synapses
N (int or None) – Filter for number of synapses (default: None, equivalent to 0)
rel (str) – Ralation operator to the number of synapses when applying the filter. (default: ‘>’)
include_inferred (bool) – Whether to include InferredSynapses (default: True)
- Returns:
containing the outgoing synapses.
- Return type:
Example
db = NeuroArch(‘hemibrain’) neurons = db.sql_query(“select from Neuron where name like ‘EPG’ “) q = outgoing_synapses(neurons) q.node_objs
- neuroarch.na.incoming_synapses(q, N=None, rel='>', include_inferred=True)[source]
Get all the input synapses to neurons in a QueryWrapper object.
- Parameters:
q (query.QueryWrapper) – The query to search for outgoing synapses
N (int or None) – Filter for number of synapses (default: None, equivalent to 0)
rel (str) – Ralation operator to the number of synapses when applying the filter. (default: ‘>’)
include_inferred (bool) – Whether to include InferredSynapses (default: True)
- Returns:
containing the input synapses.
- Return type:
Example
db = NeuroArch(‘hemibrain’) neurons = db.sql_query(“select from Neuron where name like ‘EPG’ “) q = incoming_synapses(neurons) q.node_objs
- neuroarch.na.get_data(q, data_types=None)[source]
Get all the data associated with a QueryWrapper object.
- Parameters:
q (query.QueryWrapper) – The query to search for outgoing synapses
data_types (list or None) – The types of data to be retrieved (default: None, equivalent to all data types)
- Returns:
containing the data.
- Return type:
Example
db = NeuroArch(‘hemibrain’) neurons = db.sql_query(“select from Neuron where name like ‘EPG’ “) q = get_data(neurons, ‘MorphologyData’) q.node_objs
Auxilliary Functions
Exceptions and Warnings
NeuroArch not writeable error |
|
NeuroArch got duplicate nodes |
|
NeuroArch node with the same property already exsits |
|
Cannot find the data in NeuroArch database |
|
NeuroArch node with the same property already exsits |
|
NeuroArch got duplicate nodes |
|
The node is not owned by a DataSource |