Skip to content

Commit

Permalink
Witvliet
Browse files Browse the repository at this point in the history
  • Loading branch information
yasinthanvickneswaran committed Feb 14, 2024
1 parent 9ebb6f4 commit e7402a2
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 273 deletions.
94 changes: 0 additions & 94 deletions c302/W00_SpreadsheetDataReader.py

This file was deleted.

6 changes: 3 additions & 3 deletions c302/WL3_SpreadsheetDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def read_data(include_nonconnected_cells=False, neuron_connect=False):
if neuron_connect:
conns = []
cells = []
filename = "%switvliet_2020_6_L3.xlsx"%spreadsheet_location
filename = "%switvliet_2020_6.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]
print_("Opened the Excel file: " + filename)
Expand All @@ -38,7 +38,7 @@ def read_data(include_nonconnected_cells=False, neuron_connect=False):
else:
conns = []
cells = []
filename = "%switvliet_2020_6_L3.xlsx"%spreadsheet_location
filename = "%switvliet_2020_6.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]

Expand Down Expand Up @@ -73,7 +73,7 @@ def read_muscle_data():
neurons = []
muscles = []

filename = "%switvliet_2020_6_L3.xlsx"%spreadsheet_location
filename = "%switvliet_2020_6.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]

Expand Down
226 changes: 161 additions & 65 deletions c302/W_SpreadsheetDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,101 +9,197 @@

from c302 import print_

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

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

class WitvlietDataReader1:

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

if neuron_connect:
conns = []
cells = []
filename = "%switvliet_2020_7.xlsx"%spreadsheet_location
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 'electrical' 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

else:
conns = []
cells = []
filename = "%switvliet_2020_7.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]

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 'electrical' in syntype else 'Chemical_Synapse'
print_("Opened Excel file..: " + filename)

conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)
known_nonconnected_cells = ['CANL', 'CANR', 'VC6']

return cells, conns

else:
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 'electrical' 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)

return cells, conns


def read_muscle_data():

conns = []
cells = []
filename = "%switvliet_2020_8.xlsx"%spreadsheet_location
neurons = []
muscles = []

filename = "%switvliet_2020_7.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]

print_("Opened Excel file..: " + filename)
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 'electrical' in syntype else 'Chemical_Synapse'

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

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 'electrical' in syntype else 'Chemical_Synapse'

return neurons, muscles, conns

def main1():

cells, neuron_conns = WitvlietDataReader1.read_data(include_nonconnected_cells=True)
neurons2muscles, muscles, muscle_conns = WitvlietDataReader1.read_muscle_data()

analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_conns)


conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)
class WitvlietDataReader2:
def read_data(include_nonconnected_cells=False, neuron_connect=False):

if include_nonconnected_cells:
for c in known_nonconnected_cells: cells.append(c)
if neuron_connect:
conns = []
cells = []
filename = "%switvliet_2020_8.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]
print_("Opened the Excel file: " + filename)


return cells, conns
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 'electrical' 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)

def read_muscle_data():
return cells, conns

conns = []
neurons = []
muscles = []
else:
conns = []
cells = []
filename = "%switvliet_2020_8.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]

filename = "%switvliet_2020_8.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]
print_("Opened Excel file..: " + filename)

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 'electrical' in syntype else 'Chemical_Synapse'

conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in neurons:
neurons.append(pre)
if post not in muscles:
muscles.append(post)
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 'electrical' in syntype else 'Chemical_Synapse'


return neurons, muscles, conns
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)

return cells, conns

def main():

cells, neuron_conns = read_data(include_nonconnected_cells=True)
neurons2muscles, muscles, muscle_conns = read_muscle_data()
def read_muscle_data():

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

filename = "%switvliet_2020_8.xlsx"%spreadsheet_location
wb = load_workbook(filename)
sheet = wb.worksheets[0]

print_("Opened Excel file: "+ filename)

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 'electrical' in syntype else 'Chemical_Synapse'

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


return neurons, muscles, conns

def main2():

cells, neuron_conns = WitvlietDataReader2.read_data(include_nonconnected_cells=True)
neurons2muscles, muscles, muscle_conns = WitvlietDataReader2.read_muscle_data()

analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_conns)

if __name__ == '__main__':

main()
main1()
main2()
Loading

0 comments on commit e7402a2

Please sign in to comment.