Bases: ConnectomeDataset
Reader for datasets from Brittin et al. 2021
Source code in cect/BrittinDataReader.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 | class BrittinDataReader(ConnectomeDataset):
"""Reader for datasets from [Brittin et al. 2021](../../Brittin_2021.md)"""
verbose = False
def __init__(self, reference_graph):
ConnectomeDataset.__init__(self)
self.reference_graph = reference_graph
cells, neuron_conns = self.read_data()
for conn in neuron_conns:
self.add_connection_info(conn)
def read_data(self):
cells = []
conns = []
wb = load_workbook(filename)
sheet = wb.get_sheet_by_name(self.reference_graph)
print_("Opened sheet %s in Excel file: %s" % (sheet, filename))
print(dir(sheet))
for row in sheet.rows:
print(row[0].value)
if "cell_1" not in row[0].value:
delta = int(row[3].value)
if delta == 4:
pre = row[0].value
post = row[1].value
num = float(row[2].value)
syntype = "Contact"
synclass = "%s%s" % (self.reference_graph, row[3].value)
synclass = "Contact"
ci = ConnectionInfo(pre, post, num, syntype, synclass)
print("Adding %s" % ci)
conns.append(ci)
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)
return cells, conns
|