Skip to content

Bentley2016MAReader

Bentley2016MAReader

Bases: ConnectomeDataset

Reader of data from Bentley et al. 2016 - Monoaminergic connectivity in C. elegans

Returns:

Type Description
Bentley2016MAReader

The initialized Bentley et al. 2016 monoaminergic connectome reader

Source code in cect/readers/Bentley2016MAReader.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
class Bentley2016MAReader(ConnectomeDataset):
    """
    Reader of data from Bentley et al. 2016 - Monoaminergic connectivity in C. elegans

    Returns:
        (Bentley2016MAReader): The initialized Bentley et al. 2016 monoaminergic connectome reader
    """

    def __init__(self):
        ConnectomeDataset.__init__(self)

        cells, neuron_conns = self.read_data()
        for conn in neuron_conns:
            self.add_connection_info(
                conn,
                check_overwritten_connections=False,
                append_existing_connections=False,
                fail_on_any_repeated_connection=False,
            )

        print_("\n*********************** Validation Info ************************")
        print(self.validation_info)
        print_("****************************************************************")

    def read_data(self):
        """
        Returns:
            (tuple[list, list]): List of cells (str) and list of connections (``ConnectionInfo``) which have been read in
        """
        cells = []
        conns = []

        with open(filename, "r") as f:
            reader = csv.reader(f)
            print_("Opened file: " + filename)

            for row in reader:
                # print_("Reading row: " + str(row))
                pre = str.strip(row[0])
                post = str.strip(row[1])
                num = 1
                syntype = EXTRASYNAPTIC_SYN_TYPE

                synclass = str.strip(row[2]).capitalize()

                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(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/Bentley2016MAReader.py
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
def read_data(self):
    """
    Returns:
        (tuple[list, list]): List of cells (str) and list of connections (``ConnectionInfo``) which have been read in
    """
    cells = []
    conns = []

    with open(filename, "r") as f:
        reader = csv.reader(f)
        print_("Opened file: " + filename)

        for row in reader:
            # print_("Reading row: " + str(row))
            pre = str.strip(row[0])
            post = str.strip(row[1])
            num = 1
            syntype = EXTRASYNAPTIC_SYN_TYPE

            synclass = str.strip(row[2]).capitalize()

            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