Skip to content

Commit

Permalink
Updates to Varshney
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Feb 15, 2024
1 parent b199ed1 commit fe43d31
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 51 deletions.
16 changes: 16 additions & 0 deletions c302/NeuroMLUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

from c302 import print_

PREFERRED_NEURON_NAMES = ['ADAL', 'ADAR', 'ADEL', 'ADER', 'ADFL', 'ADFR', 'ADLL', 'ADLR', 'AFDL', 'AFDR', 'AIAL', 'AIAR', 'AIBL', 'AIBR', 'AIML', 'AIMR', 'AINL', 'AINR', 'AIYL', 'AIYR', 'AIZL', 'AIZR', 'ALA', 'ALML', 'ALMR', 'ALNL', 'ALNR', 'AQR', 'AS1', 'AS10', 'AS11', 'AS2', 'AS3', 'AS4', 'AS5', 'AS6', 'AS7', 'AS8', 'AS9', 'ASEL', 'ASER', 'ASGL', 'ASGR', 'ASHL', 'ASHR', 'ASIL', 'ASIR', 'ASJL', 'ASJR', 'ASKL', 'ASKR', 'AUAL', 'AUAR', 'AVAL', 'AVAR', 'AVBL', 'AVBR', 'AVDL', 'AVDR', 'AVEL', 'AVER', 'AVFL', 'AVFR', 'AVG', 'AVHL', 'AVHR', 'AVJL', 'AVJR', 'AVKL', 'AVKR', 'AVL', 'AVM', 'AWAL', 'AWAR', 'AWBL', 'AWBR', 'AWCL', 'AWCR', 'BAGL', 'BAGR', 'BDUL', 'BDUR', 'CANL', 'CANR', 'CEPDL', 'CEPDR', 'CEPVL', 'CEPVR', 'DA1', 'DA2', 'DA3', 'DA4', 'DA5', 'DA6', 'DA7', 'DA8', 'DA9', 'DB1', 'DB2', 'DB3', 'DB4', 'DB5', 'DB6', 'DB7', 'DD1', 'DD2', 'DD3', 'DD4', 'DD5', 'DD6', 'DVA', 'DVB', 'DVC', 'FLPL', 'FLPR', 'HSNL', 'HSNR', 'I1L', 'I1R', 'I2L', 'I2R', 'I3', 'I4', 'I5', 'I6', 'IL1DL', 'IL1DR', 'IL1L', 'IL1R', 'IL1VL', 'IL1VR', 'IL2DL', 'IL2DR', 'IL2L', 'IL2R', 'IL2VL', 'IL2VR', 'LUAL', 'LUAR', 'M1', 'M2L', 'M2R', 'M3L', 'M3R', 'M4', 'M5', 'MCL', 'MCR', 'MI', 'NSML', 'NSMR', 'OLLL', 'OLLR', 'OLQDL', 'OLQDR', 'OLQVL', 'OLQVR', 'PDA', 'PDB', 'PDEL', 'PDER', 'PHAL', 'PHAR', 'PHBL', 'PHBR', 'PHCL', 'PHCR', 'PLML', 'PLMR', 'PLNL', 'PLNR', 'PQR', 'PVCL', 'PVCR', 'PVDL', 'PVDR', 'PVM', 'PVNL', 'PVNR', 'PVPL', 'PVPR', 'PVQL', 'PVQR', 'PVR', 'PVT', 'PVWL', 'PVWR', 'RIAL', 'RIAR', 'RIBL', 'RIBR', 'RICL', 'RICR', 'RID', 'RIFL', 'RIFR', 'RIGL', 'RIGR', 'RIH', 'RIML', 'RIMR', 'RIPL', 'RIPR', 'RIR', 'RIS', 'RIVL', 'RIVR', 'RMDDL', 'RMDDR', 'RMDL', 'RMDR', 'RMDVL', 'RMDVR', 'RMED', 'RMEL', 'RMER', 'RMEV', 'RMFL', 'RMFR', 'RMGL', 'RMGR', 'RMHL', 'RMHR', 'SAADL', 'SAADR', 'SAAVL', 'SAAVR', 'SABD', 'SABVL', 'SABVR', 'SDQL', 'SDQR', 'SIADL', 'SIADR', 'SIAVL', 'SIAVR', 'SIBDL', 'SIBDR', 'SIBVL', 'SIBVR', 'SMBDL', 'SMBDR', 'SMBVL', 'SMBVR', 'SMDDL', 'SMDDR', 'SMDVL', 'SMDVR', 'URADL', 'URADR', 'URAVL', 'URAVR', 'URBL', 'URBR', 'URXL', 'URXR', 'URYDL', 'URYDR', 'URYVL', 'URYVR', 'VA1', 'VA10', 'VA11', 'VA12', 'VA2', 'VA3', 'VA4', 'VA5', 'VA6', 'VA7', 'VA8', 'VA9', 'VB1', 'VB10', 'VB11', 'VB2', 'VB3', 'VB4', 'VB5', 'VB6', 'VB7', 'VB8', 'VB9', 'VC1', 'VC2', 'VC3', 'VC4', 'VC5', 'VC6', 'VD1', 'VD10', 'VD11', 'VD12', 'VD13', 'VD2', 'VD3', 'VD4', 'VD5', 'VD6', 'VD7', 'VD8', 'VD9']
PREFERRED_MUSCLE_NAMES = ['MANAL', 'MDL01', 'MDL02', 'MDL03', 'MDL04', 'MDL05', 'MDL06', 'MDL07', 'MDL08', 'MDL09', 'MDL10', 'MDL11', 'MDL12', 'MDL13', 'MDL14', 'MDL15', 'MDL16', 'MDL17', 'MDL18', 'MDL19', 'MDL20', 'MDL21', 'MDL22', 'MDL23', 'MDL24', 'MDR01', 'MDR02', 'MDR03', 'MDR04', 'MDR05', 'MDR06', 'MDR07', 'MDR08', 'MDR09', 'MDR10', 'MDR11', 'MDR12', 'MDR13', 'MDR14', 'MDR15', 'MDR16', 'MDR17', 'MDR18', 'MDR19', 'MDR20', 'MDR21', 'MDR22', 'MDR23', 'MDR24', 'MVL01', 'MVL02', 'MVL03', 'MVL04', 'MVL05', 'MVL06', 'MVL07', 'MVL08', 'MVL09', 'MVL10', 'MVL11', 'MVL12', 'MVL13', 'MVL14', 'MVL15', 'MVL16', 'MVL17', 'MVL18', 'MVL19', 'MVL20', 'MVL21', 'MVL22', 'MVL23', 'MVR01', 'MVR02', 'MVR03', 'MVR04', 'MVR05', 'MVR06', 'MVR07', 'MVR08', 'MVR09', 'MVR10', 'MVR11', 'MVR12', 'MVR13', 'MVR14', 'MVR15', 'MVR16', 'MVR17', 'MVR18', 'MVR19', 'MVR20', 'MVR21', 'MVR22', 'MVR23', 'MVR24', 'MVULVA']


class ConnectionInfo:

def __init__(self,
Expand Down Expand Up @@ -79,7 +83,12 @@ def analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_co
print_("Found %s cells: %s\n"%(len(cells),sorted(cells)))
#assert(len(cells) == 302)
#print_("Expected number of cells correct if include_nonconnected_cells=True")
not_in_preferred = []
for c in cells:
if not c in PREFERRED_NEURON_NAMES:
not_in_preferred.append(c)

print_("Found %s non-neuron(s): %s\n"%(len(not_in_preferred),sorted(not_in_preferred)))

print_("Found %s connections..."%(len(neuron_conns)))
for c in neuron_conns[:5]: print_(" %s"%c)
Expand All @@ -102,6 +111,13 @@ def analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_co
print_(" --- Muscles ---")
print_("")

print_("Found %s muscles: %s\n"%(len(muscles),sorted(muscles)))
not_in_preferred = []
for m in muscles:
if not m in PREFERRED_MUSCLE_NAMES:
not_in_preferred.append(m)

print_("Found %s unidentified muscles: %s\n"%(len(not_in_preferred),sorted(not_in_preferred)))

print_("Found %i neurons connected to muscles: %s\n"%(len(neurons2muscles), sorted(neurons2muscles)))
print_("Found %i muscles connected to neurons: %s\n"%(len(muscles), sorted(muscles)))
Expand Down
78 changes: 27 additions & 51 deletions c302/VarshneyDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,51 @@
from openpyxl import load_workbook

import os
from c302 import print_

spreadsheet_location = os.path.dirname(os.path.abspath(__file__))+"/data/"
spreadsheet_name = "NeuronConnect.xlsx" # has old name...
spreadsheet_name = "NeuronConnectFormatted.xlsx"

from c302 import print_

READER_DESCRIPTION = """Data extracted from NeuronConnectFormatted.xlsx for neuronal connectivity"""
READER_DESCRIPTION = """Data extracted from %s for neuronal connectivity"""%spreadsheet_name

NMJ_ENDPOINT = 'NMJ'

def read_data(include_nonconnected_cells=False, neuron_connect=True):

if neuron_connect:
conns = []
cells = []
filename = "%sNeuronConnectFormatted.xlsx"%spreadsheet_location
filename = "%s%s"%(spreadsheet_location,spreadsheet_name)
wb = load_workbook(filename)
sheet = wb.worksheets[0]
print_("Opened the Excel file: " + filename)

for row in sheet.iter_rows(min_row=2, values_only=True): # Assuming data starts from the second row
pre = str(row[0])
post = str(row[1])
syntype = str(row[2])
num = int(row[3])
synclass = 'Generic_GJ' if 'EJ' in syntype else 'Chemical_Synapse'

conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)

return cells, conns
post = str(row[1])

else:
conns = []
cells = []
filename = "%sNeuronConnectFormatted.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]
if not post==NMJ_ENDPOINT:
syntype = str(row[2])
num = int(row[3])
synclass = 'Generic_GJ' if 'EJ' in syntype else 'Chemical_Synapse'

print_("Opened Excel file..: " + filename)

known_nonconnected_cells = ['CANL', 'CANR', 'VC6']

for row in sheet.iter_rows(min_row=2, values_only=True):
pre = str(row[0])
post = str(row[1])
syntype = str(row[2])
num = int(row[3])
synclass = 'Generic_GJ' if 'EJ' in syntype else 'Chemical_Synapse'


conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)

if include_nonconnected_cells:
for c in known_nonconnected_cells: cells.append(c)
conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)

return cells, conns


def read_muscle_data():

conns = []
neurons = []
muscles = []

filename = "%sNeuronConnectFormatted.xlsx"%spreadsheet_location
filename = "%s%s"%(spreadsheet_location,spreadsheet_name)
wb = load_workbook(filename)
sheet = wb.worksheets[0]

Expand All @@ -81,16 +56,17 @@ def read_muscle_data():
for row in sheet.iter_rows(min_row=2, values_only=True): # Assuming data starts from the second row
pre = str(row[0])
post = str(row[1])
syntype = str(row[2])
num = int(row[3])
synclass = 'Generic_GJ' if 'EJ' in syntype else 'Chemical_Synapse'

if post==NMJ_ENDPOINT:
syntype = str(row[2])
num = int(row[3])
synclass = 'Generic_GJ' if 'EJ' in syntype else 'Chemical_Synapse'

conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in neurons:
neurons.append(pre)
if syntype == "NMJ":
muscles.append(post)
conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in neurons:
neurons.append(pre)
if not post in muscles:
muscles.append(post)


return neurons, muscles, conns
Expand Down

0 comments on commit fe43d31

Please sign in to comment.