class WhiteDataReader(ConnectomeDataset):
"""Reader for datasets from [White et al. 1986](../../White_1986.md)"""
verbose = False
def __init__(self, spreadsheet_filename):
ConnectomeDataset.__init__(self)
self.filename = spreadsheet_filename
neurons, muscles, other_cells, conns = self.read_all_data()
# neurons, conns = self.read_data()
for conn in conns:
self.add_connection_info(conn)
def read_all_data(self):
neurons = set([])
muscles = set([])
other_cells = set([])
conns = []
with open(self.filename, "r") as f:
print_("Opened file: " + self.filename)
f.readline()
# known_nonconnected_cells = ["CANL", "CANR"]
for line in f:
pre, post, num, syntype, synclass = parse_line(line)
pre = remove_leading_index_zero(pre)
post = remove_leading_index_zero(post)
if is_potential_muscle(pre):
pre = convert_to_preferred_muscle_name(pre)
if is_potential_muscle(post):
post = convert_to_preferred_muscle_name(post)
if synclass == "Generic_GJ":
conns.append(ConnectionInfo(post, pre, num, syntype, synclass))
conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
for p in [pre, post]:
if is_herm_neuron(p):
neurons.add(pre)
elif is_known_muscle(p):
muscles.add(pre)
else:
other_cells.add(p)
return list(neurons), list(muscles), list(other_cells), conns