Bases: ConnectomeDataset
Reader of data from Bentley et al. 2016 - Peptidergic connectivity in C. elegans
Returns:
| Type |
Description |
Bentley2016PepReader
|
The initialized Bentley et al. 2016 peptidergic connectome reader
|
Source code in cect/readers/Bentley2016PepReader.py
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 | class Bentley2016PepReader(ConnectomeDataset):
"""
Reader of data from Bentley et al. 2016 - Peptidergic connectivity in C. elegans
Returns:
(Bentley2016PepReader): The initialized Bentley et al. 2016 peptidergic connectome reader
"""
def __init__(self):
ConnectomeDataset.__init__(self)
cells, neuron_conns = self.read_data()
self.verbose = False
for conn in neuron_conns:
self.add_connection_info(
conn,
check_overwritten_connections=False,
append_existing_connections=False,
fail_on_any_repeated_connection=False,
)
def read_data(self):
"""
Returns:
(tuple[list, list]): List of cells (str) and list of connections (``ConnectionInfo``) which have been read in
"""
cells = []
conns = []
all_pairs = []
with open(filename, "r") as f:
reader = csv.reader(f)
print_("Opened file: " + filename)
for row in reader:
pre = str.strip(row[0])
post = str.strip(row[1])
num = 1
syntype = EXTRASYNAPTIC_SYN_TYPE
synclass = PEPTIDERGIC_SYN_CLASS
conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)
pre_post = "%s-%s" % (pre, post)
if pre_post not in all_pairs:
all_pairs.append(pre_post)
print_(
f"Read {len(conns)} connections, with {len(all_pairs)} unique pre-post pairs, and {len(cells)} unique cells"
)
return cells, conns
def read_muscle_data(self):
return self._read_muscle_data()
|
read_data()
Returns:
| Type |
Description |
tuple[list, list]
|
List of cells (str) and list of connections (ConnectionInfo) which have been read in
|
Source code in cect/readers/Bentley2016PepReader.py
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 | def read_data(self):
"""
Returns:
(tuple[list, list]): List of cells (str) and list of connections (``ConnectionInfo``) which have been read in
"""
cells = []
conns = []
all_pairs = []
with open(filename, "r") as f:
reader = csv.reader(f)
print_("Opened file: " + filename)
for row in reader:
pre = str.strip(row[0])
post = str.strip(row[1])
num = 1
syntype = EXTRASYNAPTIC_SYN_TYPE
synclass = PEPTIDERGIC_SYN_CLASS
conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in cells:
cells.append(pre)
if post not in cells:
cells.append(post)
pre_post = "%s-%s" % (pre, post)
if pre_post not in all_pairs:
all_pairs.append(pre_post)
print_(
f"Read {len(conns)} connections, with {len(all_pairs)} unique pre-post pairs, and {len(cells)} unique cells"
)
return cells, conns
|