Skip to content

Commit

Permalink
Merge pull request #19 from pgleeson/main
Browse files Browse the repository at this point in the history
Add initial Bentley monaminergic/peptidergic info
  • Loading branch information
yasinthanvickneswaran authored Sep 6, 2024
2 parents 67c94f9 + 8b282e4 commit 853324e
Show file tree
Hide file tree
Showing 43 changed files with 2,666,588 additions and 2,886 deletions.
6 changes: 6 additions & 0 deletions cect/Cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
"Serotonin_Glutamate",
]

EXTRASYNAPTIC_SYN_TYPE = "Extrasynaptic"
MONOAMINERGIC_SYN_CLASS = "Monoaminergic"
PEPTIDERGIC_SYN_CLASS = "Peptidergic"

ALL_KNOWN_EXTRASYNAPTIC_CLASSES = [MONOAMINERGIC_SYN_CLASS, PEPTIDERGIC_SYN_CLASS]

cell_notes = {}

connectomes = None
Expand Down
9 changes: 7 additions & 2 deletions cect/Comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"SSData": "SSDR_data",
"UpdSSData": "UpdSSData_data",
"UpdSSData2": "UpdSSData2_data",
"Bentley2016_MA": "Bentley2016_MA_data",
"Bentley2016_PEP": "Bentley2016_PEP_data",
}

all_data[""] = [
Expand Down Expand Up @@ -129,8 +131,10 @@ def generate_comparison_page(quick: bool, color_table=True):
"Cook2020": ["cect.Cook2020DataReader", "Cook_2020"],
"Witvliet1": ["cect.WitvlietDataReader1", "Witvliet_2021"],
}
# readers = {}

readers["Randi2023"] = ["cect.WormNeuroAtlasFuncReader", "Randi_2023"]
readers["Bentley2016_MA"] = ["cect.WormNeuroAtlasMAReader", "Bentley_2016"]
readers["Bentley2016_PEP"] = ["cect.WormNeuroAtlasPepReader", "Bentley_2016"]

if not quick:
readers["Witvliet2"] = ["cect.WitvlietDataReader2", "Witvliet_2021"]
Expand All @@ -142,9 +146,10 @@ def generate_comparison_page(quick: bool, color_table=True):
readers["Witvliet8"] = ["cect.WitvlietDataReader8", "Witvliet_2021"]
readers["White_A"] = ["cect.White_A", "White_1986"]
readers["White_L4"] = ["cect.White_L4", "White_1986"]
readers["WormNeuroAtlas"] = ["cect.WormNeuroAtlasReader", "Randi_2023"]
readers["Cook2019Herm"] = ["cect.Cook2019HermReader", "Cook_2019"]
readers["Cook2019Male"] = ["cect.Cook2019MaleReader", "Cook_2019"]
readers["WormNeuroAtlas"] = ["cect.WormNeuroAtlasReader", "Randi_2023"]
readers["Randi2023"] = ["cect.WormNeuroAtlasFuncReader", "Randi_2023"]

main_mk = "# Comparison between data readers\n"
table = ""
Expand Down
3 changes: 3 additions & 0 deletions cect/ConnectomeView.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from cect.Cells import PHARYNGEAL_MOTORNEURONS

from cect.Cells import ALL_KNOWN_CHEMICAL_NEUROTRANSMITTERS
from cect.Cells import ALL_KNOWN_EXTRASYNAPTIC_CLASSES

from cect.Cells import get_standard_color

Expand Down Expand Up @@ -93,6 +94,7 @@ def get_index_of_cell(self, cell):
"Chemical Exc": ["Generic_CS"] + putative_exc_syn_class,
"Chemical Inh": ["GABA"],
"Electrical": ["Generic_GJ"],
"Extrasynaptic": ALL_KNOWN_EXTRASYNAPTIC_CLASSES,
}

EXC_INH_GJ_FUNC_SYN_CLASSES = copy.deepcopy(EXC_INH_GJ_SYN_CLASSES)
Expand All @@ -103,6 +105,7 @@ def get_index_of_cell(self, cell):
"Chemical": EXC_INH_GJ_SYN_CLASSES["Chemical Exc"]
+ EXC_INH_GJ_SYN_CLASSES["Chemical Inh"],
"Electrical": ["Generic_GJ"],
"Extrasynaptic": EXC_INH_GJ_SYN_CLASSES["Extrasynaptic"],
}

CHEM_GJ_FUNC_SYN_CLASSES = copy.deepcopy(CHEM_GJ_SYN_CLASSES)
Expand Down
129 changes: 129 additions & 0 deletions cect/WormNeuroAtlasExtSynReader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import logging

from cect.ConnectomeReader import ConnectionInfo
from cect.ConnectomeDataset import ConnectomeDataset
from cect.Cells import EXTRASYNAPTIC_SYN_TYPE
from cect.Cells import MONOAMINERGIC_SYN_CLASS
from cect.Cells import PEPTIDERGIC_SYN_CLASS

from cect import print_

import wormneuroatlas as wa
import sys

from cect.WormNeuroAtlasReader import get_all_cells


############################################################

# A script to read the values in WormNeuroAtlas

############################################################

LOGGER = logging.getLogger(__name__)

READER_DESCRIPTION = """Data extracted from the **WormNeuroAtlas package** for extrasynaptic connectivity"""


class WormNeuroAtlasExtSynReader(ConnectomeDataset):
def __init__(self, synclass):
ConnectomeDataset.__init__(self)

self.synclass = synclass

print_(
"Initialising WormNeuroAtlasExtSynReader for syn class %s" % self.synclass
)

self.atlas = wa.NeuroAtlas()

self.all_cells = get_all_cells(self.atlas)

cells, neuron_conns = self.read_data()

for conn in neuron_conns:
self.add_connection_info(conn)

def read_data(self):
conns = []

if self.synclass == MONOAMINERGIC_SYN_CLASS:
connectome = self.atlas.get_monoaminergic_connectome()
syntype = EXTRASYNAPTIC_SYN_TYPE

if self.synclass == PEPTIDERGIC_SYN_CLASS:
connectome = self.atlas.get_peptidergic_connectome()
syntype = EXTRASYNAPTIC_SYN_TYPE

connected_cells = []

for pre in self.all_cells:
apre = self.atlas.ids_to_ai([pre])
for post in self.all_cells:
apost = self.atlas.ids_to_ai([post])

connection = False

weight = connectome[apost, apre][0]

if weight != 0:
print(
"%s conn (%s (%i) -> %s (%i):\t%s "
% (self.synclass, pre, apre, post, apost, weight)
)
conns.append(
ConnectionInfo(pre, post, weight, syntype, self.synclass)
)
connection = True

if connection:
if pre not in connected_cells:
connected_cells.append(pre)
if post not in connected_cells:
connected_cells.append(post)

return connected_cells, conns

def read_muscle_data(self):
neurons = []
muscles = []
conns = []
return neurons, muscles, conns


if __name__ == "__main__":
syn_class_to_test = PEPTIDERGIC_SYN_CLASS

my_instance = WormNeuroAtlasExtSynReader(syn_class_to_test)
cells, neuron_conns = my_instance.read_data()
print("Loaded %s connections" % len(neuron_conns))

# from cect.ConnectomeReader import analyse_connections
# analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_conns)

to_test = ["RIMR"]

for cell in to_test:
my_instance.atlas.all_about(cell)

print(
"MA conns from %s: %s"
% (
cell,
my_instance.get_connections_from(
cell, syn_class_to_test, ordered_by_weight=True
),
)
)
print(
"MA conns to %s: %s"
% (
cell,
my_instance.get_connections_to(
cell, syn_class_to_test, ordered_by_weight=True
),
)
)

if "-nogui" not in sys.argv:
my_instance.connection_number_plot(syn_class_to_test)
60 changes: 60 additions & 0 deletions cect/WormNeuroAtlasMAReader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
############################################################

# A script to read the values in WormNeuroAtlas

############################################################

from cect.WormNeuroAtlasExtSynReader import WormNeuroAtlasExtSynReader
from cect.Cells import MONOAMINERGIC_SYN_CLASS

import logging
import sys


LOGGER = logging.getLogger(__name__)

READER_DESCRIPTION = """Data extracted from the **WormNeuroAtlas package** for monoaminergic connectivity"""


def get_instance():
return WormNeuroAtlasExtSynReader(MONOAMINERGIC_SYN_CLASS)


my_instance = get_instance()

read_data = my_instance.read_data
read_muscle_data = my_instance.read_muscle_data

if __name__ == "__main__":
cells, neuron_conns = my_instance.read_data()
print("Loaded %s connections" % len(neuron_conns))

# from cect.ConnectomeReader import analyse_connections
# analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_conns)

to_test = ["ADAL", "MCL", "M5"]

for cell in to_test:
my_instance.atlas.all_about(cell)

print(
"MA conns from %s: %s"
% (
cell,
my_instance.get_connections_from(
cell, MONOAMINERGIC_SYN_CLASS, ordered_by_weight=True
),
)
)
print(
"MA conns to %s: %s"
% (
cell,
my_instance.get_connections_to(
cell, MONOAMINERGIC_SYN_CLASS, ordered_by_weight=True
),
)
)

if "-nogui" not in sys.argv:
my_instance.connection_number_plot(MONOAMINERGIC_SYN_CLASS)
62 changes: 62 additions & 0 deletions cect/WormNeuroAtlasPepReader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
############################################################

# A script to read the values in WormNeuroAtlas

############################################################

from cect.WormNeuroAtlasExtSynReader import WormNeuroAtlasExtSynReader
from cect.Cells import PEPTIDERGIC_SYN_CLASS

import logging
import sys


LOGGER = logging.getLogger(__name__)

READER_DESCRIPTION = """Data extracted from the **WormNeuroAtlas package** for peptidergic connectivity"""


def get_instance():
return WormNeuroAtlasExtSynReader(PEPTIDERGIC_SYN_CLASS)


my_instance = get_instance()

read_data = my_instance.read_data
read_muscle_data = my_instance.read_muscle_data

if __name__ == "__main__":
syn_class_to_test = PEPTIDERGIC_SYN_CLASS

cells, neuron_conns = my_instance.read_data()
print("Loaded %s connections" % len(neuron_conns))

# from cect.ConnectomeReader import analyse_connections
# analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_conns)

to_test = ["ADAL", "MCL", "M5"]

for cell in to_test:
my_instance.atlas.all_about(cell)

print(
"MA conns from %s: %s"
% (
cell,
my_instance.get_connections_from(
cell, syn_class_to_test, ordered_by_weight=True
),
)
)
print(
"MA conns to %s: %s"
% (
cell,
my_instance.get_connections_to(
cell, syn_class_to_test, ordered_by_weight=True
),
)
)

if "-nogui" not in sys.argv:
my_instance.connection_number_plot(syn_class_to_test)
50 changes: 50 additions & 0 deletions docs/Bentley2016_MA_data.md

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions docs/Bentley2016_MA_data_graph.md

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions docs/Bentley2016_PEP_data.md

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions docs/Bentley2016_PEP_data_graph.md

Large diffs are not rendered by default.

Loading

0 comments on commit 853324e

Please sign in to comment.